Page MenuHome

Dyntopo + Snake tool produce weird artifacts after grab tool
Closed, DuplicatePublic


System Information
Operating system: Linux-4.15.0-47-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.116

Blender Version
Broken: version: 2.80 (sub 74), branch: blender2.7, commit date: 2019-06-04 22:32, hash: rBe80cbdac331a
Worked: not found

Short description of error
Dyntopo + Snake tool produce weird artifacts after grab tool

Exact steps for others to reproduce the error

  1. Open sculpting UI setup.
  2. Enable dyntopo.
  3. move some geometry with grab tool.
  4. Set big brush size then use snake tool.
  5. Some weird artifacts will be shown. Like part of original mesh stay in original location.

  1. Press Ctrl+Z - artifacts will disappear.



Event Timeline

tom k (tomjk) added a subscriber: tom k (tomjk).EditedJun 5 2019, 11:12 PM

Can duplicate (Linux Mint 18.3, NVIDIA GeForce GTX 750 Ti, today's official build e80cbdac331a)

Does not require to grab or perform any other operation before snake hook.

Edit: Does not actually require snake hook at all, I think any tool that will collapse geometry will do it.

Artifacts also disappear if you enter another mode (object, edit etc.)

Probably duplicate of T58920.

The problem is that within the BVH node, the drawing buffer (ie the batch) and the mesh lose their synchrony when the resulting amount of triangles is 0.
What happens is that while the mesh in the BVH node gets 0 vertices, the batch is untouched.

Something similar happened before and was solved by @Antony Riakiotakis (psy-fi) here: rBe60b18d51d58
In this solution vert_buff and index_buff were deleted.

But another solution was found in rB52af5fa31fbc
There vert_buff and index_buff were untouched but their drawing was ignored.

Here an adaptation of the first solution:

diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index e30fccbf29d..a232327e1d3 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -827,6 +827,11 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
   if (!tottri) {
+    GPU_BATCH_DISCARD_SAFE(buffers->triangles);
+    GPU_BATCH_DISCARD_SAFE(buffers->lines);
+    GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
+    GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
+    GPU_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
     buffers->tot_tri = 0;

An adaptation of the second solution would be to check the buffers->tottri in sculpt_draw_cb.