Page MenuHome

Voxel remesh: Fix poles and preserve volume

Authored by Pablo Dobarro (pablodp606) on Sep 20 2019, 7:13 PM.
"Love" token, awarded by Dusty_Shoe."Like" token, awarded by TheAngerSpecialist."Yellow Medal" token, awarded by franMarz."Love" token, awarded by amonpaike."Yellow Medal" token, awarded by Kraggi."100" token, awarded by Frozen_Death_Knight."Pterodactyl" token, awarded by Way."Love" token, awarded by brilliant_ape."Burninate" token, awarded by lopoIsaac."Love" token, awarded by Zino."Love" token, awarded by johnsyed."Love" token, awarded by xorrito."Love" token, awarded by 3DUnreal."Love" token, awarded by MetinSeven."Love" token, awarded by Floatharr."Love" token, awarded by ace_dragon."Love" token, awarded by xrg."Love" token, awarded by Loner."Mountain of Wealth" token, awarded by ThinkingPolygons.



This patch fixes most of the issues we currently have in the voxel remesher. Mesh volume is preserved when doing multiple iterations, so the sculpt won't shrink and smooth each time you run the remesher. Mesh topology is much better, fixing most issues related to mask extraction and other topology based operations.

Diff Detail

rB Blender

Event Timeline

Way awarded a token.Sep 20 2019, 10:34 PM

This crashes sometimes. How can I dissolve that face properly?

Will this new remesh algorithm also be implemented in the Remesh modifier? Would be great.


Testing this patch I'm getting this assert, which needs to be investigated:

/usr/lib/ [0x7f332a05d6e0]
/src/blender/blender.bin(BLI_system_backtrace+0xc8) [0x5584ad4e90f7]
/src/blender/blender.bin(BM_face_split+0x80c) [0x5584ae730e6c]
/src/blender/blender.bin(BM_vert_collapse_faces+0x47f2) [0x5584ae73744a]
/src/blender/blender.bin(BM_disk_dissolve+0xa46) [0x5584ae72f023]
/src/blender/blender.bin(BM_vert_dissolve+0x36a) [0x5584ae72e5d6]
/src/blender/blender.bin(BKE_mesh_remesh_voxel_fix_poles+0x16a7e) [0x5584b141feb1]
/src/blender/blender.bin(+0x11970756) [0x5584aff86756]
/src/blender/blender.bin(+0xfc900b6) [0x5584ae2a60b6]
/src/blender/blender.bin(+0xfc91d5f) [0x5584ae2a7d5f]
/src/blender/blender.bin(WM_operator_name_call_ptr+0x17e) [0x5584ae2a8050]
/src/blender/blender.bin(+0x10e392e1) [0x5584af44f2e1]
/src/blender/blender.bin(+0x10ec0d37) [0x5584af4d6d37]
/src/blender/blender.bin(+0xfc85462) [0x5584ae29b462]
/src/blender/blender.bin(+0xfc9e276) [0x5584ae2b4276]
/src/blender/blender.bin(+0xfca12e2) [0x5584ae2b72e2]
/src/blender/blender.bin(wm_event_do_handlers+0x1812) [0x5584ae2bcb66]
/src/blender/blender.bin(WM_main+0x30) [0x5584ae2806b0]
/src/blender/blender.bin(+0xdcfc81a) [0x5584ac31281a]
/usr/lib/ [0x7f33283b6ee3]
/src/blender/blender.bin(_start+0x2e) [0x5584ac311b4e]
BLI_assert failed: /src/blender/source/blender/bmesh/intern/bmesh_mods.c:270, BM_face_split(), at '!BM_loop_is_adjacent(l_a, l_b)'

I'm also getting a memory corruption with this file (just run remesh).

BLI_assert failed: /src/blender/source/blender/blenlib/intern/BLI_mempool.c:402, BLI_mempool_free(), at 'newhead->freeword != ((sizeof(void *) > sizeof(int32_t)) ? ((int64_t)('e') << 56 | (int64_t)('e') << 48 | (int64_t)('r') << 40 | (int64_t)('f') << 32 | (int64_t)('f') << 24 | (int64_t)('r') << 16 | (int64_t)('e') << 8 | ('e')) : ((int)('e') << 24 | (int)('f') << 16 | ('f') 0

In general, removing duplicates / merging requires some knowledge of the surrounding topology (which we have, although it can back-fire at times - as happens here), it might be better to use weld_verts bmesh operator.

That, or someone needs to look into the topology causing the problem. If we can skip cases that cause problems listed above - it could work.


too many arguments to function ‘BKE_mesh_from_bmesh_nomain’

Brecht Van Lommel (brecht) requested changes to this revision.Mon, Sep 23, 5:07 PM

Marking as request changes due to the crashes.

This revision now requires changes to proceed.Mon, Sep 23, 5:07 PM
  • Fix assert and crash when deleting faces
  • Rebase
Jeroen Bakker (jbakker) requested changes to this revision.Tue, Sep 24, 9:03 AM

Leaks memory when using Fixed Poles. Please check for leaks before sending a patch.

This is from default cube => Sculpt Workspace => Enable fix pole option => Remesh

Mesh len: 1560 0x7f157166ae38
mesh runtime eval_mutex len: 40 0x7f156abe4ac8
CDMVert len: 52960 0x7f156e2f5038
CustomData->layers len: 520 0x7f156ac105b8
CDMLoop len: 84672 0x7f156e302038
CustomData->layers len: 520 0x7f1561c2f0b8
CDMPoly len: 31752 0x7f156e2d7038
CustomData->layers len: 520 0x7f15600060b8
CustomData->layers len: 520 0x7f1563810338
CDMEdge len: 63504 0x7f156e349038
CustomData->layers len: 520 0x7f15638105b8
BKE_editmesh_create len: 152 0x7f156e1db4d8

em is not freed

This revision now requires changes to proceed.Tue, Sep 24, 9:03 AM
Pablo Dobarro (pablodp606) marked an inline comment as done.
  • Fix memory leaks
Jeroen Bakker (jbakker) requested changes to this revision.Wed, Sep 25, 9:04 AM
Jeroen Bakker (jbakker) added inline comments.

This method seems to create a cache for looptri's.
they are already reset by calling BKE_mesh_runtime_clear_geometry

Is there a need to call BKE_mesh_runtime_clear_cache for every flag? or just BKE_mesh_runtime_clear_geometry once when ME_REMESH_REPROJECT_VOLUME flag is set?

Not sure that this is a correct fix, or that BKE_mesh_remesh_voxel_to_mesh_nomain renders the input mesh to an invalid state.

This revision now requires changes to proceed.Wed, Sep 25, 9:04 AM
Pablo Dobarro (pablodp606) marked an inline comment as done.
  • Use clear geometry instead of clear cache

Yes, it needs to be called per flag. Mask reprojection fails if you run it multiple times without clear_geometry

This revision is now accepted and ready to land.Thu, Sep 26, 4:18 PM