Page MenuHome

Modifiers: Surface Deform add vertex group and strength control
ClosedPublic

Authored by Cody Winchester (CodyWinch) on Feb 19 2020, 7:29 PM.
Tags
None
Subscribers
None
Tokens
"Like" token, awarded by lucky3."Like" token, awarded by amonpaike."Like" token, awarded by dulrich.

Details

Summary

This patch aims to add functionality to the surface deform modifier that gives more control and allows it to work better with the modifier stack.

  • Maintains compatibility with older files. The default settings keep it so that the whole object is bound and vertex coordinates get overwritten as the modifier currently does.
  • Turns the deformations from an absolute vertex coordinate overwrite into an additive offset from the vertex location before the modifier to the resulting bound deformation. This gives the ability to control the strength of the deformation and mix the deformation of the modifier with the modifier stack that comes before it.
  • Also adds in a vertex group with the invert option. This is applied after the bind deformation is added. So the whole object is still bound to target, and the vertex group filters afterwards what parts get affected. I experimented with a version to only binds the geometry weighted to the vertex group, but that would break compatibility with old files. I may bring it in later as a separate option/mode for the surface deform.

Diff Detail

Repository
rB Blender

Event Timeline

Bastien Montagne (mont29) requested changes to this revision.Thu, Mar 26, 4:32 PM

Generally looks fine, but patch does not apply anymore on current master...

source/blender/modifiers/intern/MOD_surfacedeform.c
150

Full sentences please, including end point. ;)

1142

Full sentences please, including end point. ;)

1193–1199

Full sentences in comments please, including end point. ;)

1196–1200

would be more efficient to do a single madd_v3_v3fl here, passing data->strength * data->weights[index] as float coefficient.

1275–1290

Would more efficient to leave weights to unallocated NULL instead when there is no vgroup, and check for that in related code above.

1325

Full sentences please, including end point. ;)

1347

Full sentences please, including end point. ;)

This revision now requires changes to proceed.Thu, Mar 26, 4:32 PM
Cody Winchester (CodyWinch) marked 7 inline comments as done.

Updated to match new master.

Also added a check for existing dvert and add it if none added. Without this it would crash when trying to check the weight of the vertex group. If it fails to add the dvert data then it sets the weights to NULL.

LGTM (will fix the noted issues while committing).

source/blender/modifiers/intern/MOD_surfacedeform.c
1146

data->strength should be tested outside of data->weights` being non-NULL.

1293–1300

Nice memleak in perspective... :P

This revision is now accepted and ready to land.Fri, Mar 27, 11:29 AM
source/blender/modifiers/intern/MOD_surfacedeform.c
1276

Hmmpf. that one was actually not freed anywhere!