This should the correct way of implementing laplacian smoothing. The
coordinates and normals are copied before each iteration to avoid
reading and writing at the same time from the main brush loop.
We need to consider the following before implementing this in the rest
of the tools:
- If we want to have a 100% correct implementation, the copy needs to be done for the whole mesh as it is not guaranteed that the neighbor vertex to read the coordinate is in the same node that the vertex that is being modified. Filters will need this to be done for the whole mesh.
- This spawns twice as many threads in the main loop per brush step. In brushes like smooth that can do up to 4 iterations per brush step, this would mean creating threads 8 times in the main brush loop, 1 time to store coordinates to undo, 1 time to recalculate the BB and 2 times to recalculate the normals (+ redrawing). The current performance of smooth is already problematic in mid/high poly meshes and this will make the problem worse.
- I don't see any noticeable difference in the resulting brush deformation
- This requires another copy of the mesh coordinates and normals. When sculpting with deform modifiers enabled I think there are already 4 copies of the mesh coordinates in memory.