Page MenuHome

Modifiers: Surface Deform add vertex group and strength control

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



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

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...


Full sentences please, including end point. ;)


Full sentences please, including end point. ;)


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


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


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


Full sentences please, including end point. ;)


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).


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


Nice memleak in perspective... :P

This revision is now accepted and ready to land.Fri, Mar 27, 11:29 AM

Hmmpf. that one was actually not freed anywhere!