Page MenuHome

Crash after using Dyntopo with assigned Displace
Closed, DuplicatePublic

Description

System Information
Operating system: Windows 10 1809
Graphics card: GTX 970

Blender Version
Broken: 1b839e85e142
Worked: At least 2.79b

Short description of error
If Displace assigned to an object and you edit it sculpt mode with Dyntopo enabled, and then try to switch back to object mode, Blender crash.

Exact steps for others to reproduce the error

  1. Open new file
  2. Assign Displace modifier (even without any maps)
  3. Switch to Sculpt mode, press CTRL+D
  4. Make a stroke, so new triangles will be added
  5. Switch back to object mode

Details

Type
Bug

Related Objects

Event Timeline

Sebastian Parborg (zeddb) triaged this task as Confirmed, Medium priority.

I'm getting this assert which I suspect will lead to a crash:

BLI_assert failed: /home/zed/prog/blender/source/blender/blenkernel/intern/pbvh.c:2333, BKE_pbvh_apply_vertCos(), at '!"PBVH: Given deforming vcos number does not natch PBVH vertex number!"'

Thread 1 "blender" received signal SIGABRT, Aborted.
0x00007ffff326f61b in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff326f61b in raise () from /lib64/libc.so.6
#1  0x00007ffff3258535 in abort () from /lib64/libc.so.6
#2  0x0000555557cce441 in BKE_pbvh_apply_vertCos (pbvh=0x7fffd457a308, vertCos=0x7fffd48f3898, totvert=8)
    at /home/zed/prog/blender/source/blender/blenkernel/intern/pbvh.c:2333
#3  0x0000555557c9f7ff in build_pbvh_from_regular_mesh (ob=0x7fffeb3f0c08, me_eval_deform=0x7fffd4af1908)
    at /home/zed/prog/blender/source/blender/blenkernel/intern/paint.c:1399
#4  0x0000555557c9fa88 in BKE_sculpt_object_pbvh_ensure (depsgraph=0x7fffdd8fe208, ob=0x7fffeb3f0c08)
    at /home/zed/prog/blender/source/blender/blenkernel/intern/paint.c:1456
#5  0x0000555557c9ebb4 in BKE_sculpt_update_mesh_elements (depsgraph=0x7fffdd8fe208, scene=0x7fffe63c3008, sd=0x7fffe637eb68, ob=0x7fffeb3f0c08,
    need_pmap=false, need_mask=false) at /home/zed/prog/blender/source/blender/blenkernel/intern/paint.c:1176
#6  0x0000555558b6ce4f in sculpt_update_after_dynamic_topology_toggle (depsgraph=0x7fffdd8fe208, scene=0x7fffe63c3008, ob=0x7fffeb3f0c08)
    at /home/zed/prog/blender/source/blender/editors/sculpt_paint/sculpt.c:5622
#7  0x0000555558b6d38b in sculpt_dynamic_topology_disable_ex (depsgraph=0x7fffdd8fe208, scene=0x7fffe63c3008, ob=0x7fffeb3f0c08, unode=0x0)
    at /home/zed/prog/blender/source/blender/editors/sculpt_paint/sculpt.c:5743
#8  0x0000555558b6d454 in sculpt_dynamic_topology_disable_with_undo (depsgraph=0x7fffdd8fe208, scene=0x7fffe63c3008, ob=0x7fffeb3f0c08)
    at /home/zed/prog/blender/source/blender/editors/sculpt_paint/sculpt.c:5762
#9  0x0000555558b6e375 in ED_object_sculptmode_exit_ex (depsgraph=0x7fffdd8fe208, scene=0x7fffe63c3008, ob=0x7fffeb3f0c08)
    at /home/zed/prog/blender/source/blender/editors/sculpt_paint/sculpt.c:6180
#10 0x0000555558b6e568 in sculpt_mode_toggle_exec (C=0x7fffeb458208, op=0x7fffd15d1308)
    at /home/zed/prog/blender/source/blender/editors/sculpt_paint/sculpt.c:6228
#11 0x000055555823d5f5 in wm_operator_invoke (C=0x7fffeb458208, ot=0x7fffe618e788, event=0x0, properties=0x0, reports=0x0, poll_only=false,
    use_last_properties=true) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1421
#12 0x000055555823dcb4 in wm_operator_call_internal (C=0x7fffeb458208, ot=0x7fffe618e788, properties=0x0, reports=0x0, context=7, poll_only=false, event=0x0)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1623
#13 0x000055555823ded7 in WM_operator_name_call_ptr (C=0x7fffeb458208, ot=0x7fffe618e788, context=7, properties=0x0)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1671
#14 0x000055555823df2b in WM_operator_name_call (C=0x7fffeb458208, opstring=0x55555ce6d77a "SCULPT_OT_sculptmode_toggle", context=7, properties=0x0)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1677
#15 0x0000555558aaba5e in ED_object_mode_compat_set (C=0x7fffeb458208, ob=0x7fffeb3f0c08, mode=OB_MODE_OBJECT, reports=0x7fffd15c7bb8)
    at /home/zed/prog/blender/source/blender/editors/object/object_modes.c:152
#16 0x0000555558aa4d85 in object_mode_set_exec (C=0x7fffeb458208, op=0x7fffd15d1248)
    at /home/zed/prog/blender/source/blender/editors/object/object_edit.c:1376
#17 0x000055555823d5f5 in wm_operator_invoke (C=0x7fffeb458208, ot=0x7fffe6136408, event=0x7fffe515c988, properties=0x7fffffffda40, reports=0x0,
    poll_only=false, use_last_properties=true) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1421
#18 0x000055555823dcb4 in wm_operator_call_internal (C=0x7fffeb458208, ot=0x7fffe6136408, properties=0x7fffffffda40, reports=0x0, context=1, poll_only=false,
    event=0x7fffe515c988) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1623
#19 0x000055555823ded7 in WM_operator_name_call_ptr (C=0x7fffeb458208, ot=0x7fffe6136408, context=1, properties=0x7fffffffda40)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:1671
#20 0x000055555884bd3b in ui_apply_but_funcs_after (C=0x7fffeb458208) at /home/zed/prog/blender/source/blender/editors/interface/interface_handlers.c:789
#21 0x0000555558864067 in ui_handler_region_menu (C=0x7fffeb458208, event=0x7fffd15c9808, UNUSED_userdata=0x7fffd48b1e08)
    at /home/zed/prog/blender/source/blender/editors/interface/interface_handlers.c:10108
#22 0x000055555823b27d in wm_handler_ui_call (C=0x7fffeb458208, handler=0x7fffd49fde08, event=0x7fffd15c9808, always_pass=0)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:608
#23 0x00005555582402bf in wm_handlers_do_intern (C=0x7fffeb458208, event=0x7fffd15c9808, handlers=0x7fffe6368598)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:2573
#24 0x0000555558240c9a in wm_handlers_do (C=0x7fffeb458208, event=0x7fffd15c9808, handlers=0x7fffe6368598)
    at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:2804
#25 0x0000555558241f0e in wm_event_do_handlers (C=0x7fffeb458208) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_event_system.c:3172
#26 0x0000555558235b08 in WM_main (C=0x7fffeb458208) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm.c:418
#27 0x0000555557ba2d34 in main (argc=1, argv=0x7fffffffe088) at /home/zed/prog/blender/source/creator/creator.c:500

As we can see, the totvert variable is not up to date with the actual state of the mesh. So I guess this is a depsgraph data refresh issue.

For the record, dependency graph doesn't care about PBVH. Additionally, sculpting and painting are trying to avoid dependency graph as much as possible, to avoid re-evaluation of modifiers and such which is tempting to be slow. This is something going wrong in the painting code itself.

I don't mind having a look. but the reasoning about dependency graph is wrong.