利用者:Nazg-gul/SculptModifiersChanges

提供: wiki
移動先: 案内検索

Changes in multires sculpting

At this page I want to describe my approach of fixing problems with sculpting on multires when there are another modifiers in the stack.

Description of my approach

Existing troubles are caused by DAG_id_flush_update(&ob->id, OB_RECALC_DATA) in the sculpt_flush_update() for case when object has got non-multires modifiers. This re-calculation would be flushed on every stroke step.

This is quite dangerous because of asynchronous threads, but main problem comes from PBVH updating. It can't and wouldn't be updated until stroke is done, so CCGDM and PBHV becomes non-synchronized and Blender crashes.

On the other hand, there could be another modifiers after multires. We can't get CCGM from derivedFinal (as it's done at this moment).

I've used approach when CCGDM is creating specially for SculptSession, so any kind of object recalculation wouldn't damage data, needed for sculpting, and pointers from SculptSession wouldn't become "damaged".

After this changes OB_RECALC_DATA could be called in sculpt_flush_update(), so derivedFinal of active object and linked objects could be recalculated on stroke step and changes in final shape of active object and all linked becomes visible immediately. Sculpting became more interactive

Known issues

There are some issues, which I can't easily solve at his moment:

  • Sculpting on deformed object works incorrect. PBVH for sculpting is creating from undeformed mesh, so displacement could be applied on the "wrong" place. There should be some king of translating deformed coordinates to the BPVH. Or maybe we should create deformed PBVH and then subtract deformation from PBVH before flushing it to the original mesh/multires.
  • I'm using ccgdm->multires.update() for applying displacement on the original multires and this is quite slow. Especially when multires has got totlvl near 6, but user is sculpting on lvl 2.
  • Some more XXX's in the patch

Patch

Here is link to the patch