Page MenuHome

Multires: remove CCG grids storage for sculpting, use Mesh instead
Needs ReviewPublic

Authored by Brecht Van Lommel (brecht) on Aug 15 2019, 5:58 PM.



This is work in progress, mainly uploaded to show it's being worked on. There
are TODO comments in the code explaining what remains to be done.

This change removes about 3000 lines of code, and means sculpting tools and
drawing code only have to work with Mesh and BMesh types. This includes the
new tools in the sculpt branch, which should work on multires combined with
this change.

The downside is increased memory usage (TODO: measure) and maybe slower
switching between levels and in and out of sculpt mode. Fast Navigate is also
no longer available after this, hopefully drawing the low poly mesh for
navigation is no longer as important with our improving drawing code.

Diff Detail

rB Blender
no-grids (branched from master)
Build Status
Buildable 4626
Build 4626: arc lint + arc unit

Event Timeline

Brecht Van Lommel (brecht) planned changes to this revision.Aug 16 2019, 11:28 AM

Rebase on latest master, remove TODO comments that have been verified not to be a problem.

Preserve multires paint mask when switching levels and on sculpt mode enter/exit.

I looked into memory usage of this, and it's not great but there is room for improvement.

This change is only supposed to affect sculpt mode. But I discovered two issues in object mode that carried over to sculpt mode with this change.

Even if these two are fixed, memory usage is still twice as much in sculpt mode. Note that sculpt mode multires memory usage is quite close between 2.79 and 2.80 releases, with the latter using maybe 10% more. It's mainly object mode that uses more memory in 2.80.

In order to get it closer to that number in sculpt mode, we need to reduce mesh array and PBVH data structure memory usage. Some of the PBVH overhead seems excessive and the cause was not immediately obvious to me, I need to look into it.

Further we could still specialize some things for the subsurf case. For example we don't need medge or looptri arrays for sculpting, and the PBVH could store ranges of vertices/faces knowing they are part of the same subsurf patch. Taking this further, there could be a more minimal mesh data structure that is easily abstracted for sculpting and drawing. But maybe this is more complicated than it needs to be, it needs some further thought.