Sculpting tool

I am trying to develop sculpting tools. My current plan is the following. I’m looking for some constructive comments on my finding and proposal for a design.

vtkCellLocator is to slow for updating on every interaction.
vtkPointLocator I use this for selecting points withing a radius. Next, I get a unique list of cells using GetPointCells.
Next I move points in a normal direction
Next I refine the mesh, new cells are added to the end and I use a Visibility array to hide cell (triangles) that are no longer used
The refinement is made dividing edges and interpolating normals. The new interpolated normals, I insert into the normals array (for vertices). New points are likewise added and old points are marked as invalid.
Finally, I update the links.
I store all previous locations of points (for undo) and can use the marks for undoing cells.

I can achieve 60 Hz for a mesh with 500.000 cells. I have not yet implemented collapsing of triangles.

My dream is to make it a filter with temporal output, such that undoing corresponds to moving back in time.

Any thoughts?

You might also investigate the new compute-shaders and do all of the mesh updates on the GPU. The workflow would be to upload pointer gestures (click+drag, multi-finger touch-pad paths, etc.) since the last update and apply them to a mesh held in buffer objects on the GPU. The buffers could then be rendered without GPU data transfer. When it comes time to run other algorithms, the buffers could be downloaded to the CPU.

This is what I hope to find funding to implement at some point, but it has not been easy.

That is a good idea. We are on the edge of WebGPU and that has also been on our mind, but we have been struggling with support for WebGPU. If I stick on the CPU, I believe I should make a version of the vtkIncrementalPointLocator, which allows me to remove a point.