View Full Version : Controlling blendshapes with particles and fields

06 June 2010, 11:35 AM
I posted this on my webpage and figured I should probably copy it over to the forums here as well. This was brought up at work the other day, and it seems there is still not an easy solution to control a blendshape via animated textures. I know there are scripts out there that hack it, you could be very sneaky and slow via a scriptjob, or you could delve into the world of softbodies like I do.

Backstory: Back in the day I heard about a cool plugin they wrote to do 'The Mystique Effect' on Xmen 1. The guys at Kolektiv ( released that tool called the samplerDeformer ( in a bundle of plugins called Stroika (Enjoy the free advertizing, guys.) Purchasing and using plugins is not an option for everyone, so I wanted to figure out a way to do it using off-the-shelf Maya. What I came up with was taken from what I know in Maya particles.

Demo scene file located at bottom of page (

A sneaky trick that I LOVE to use with particles is querying the inputForce of a field as it is applied to particles. Maya's interaction from fields to particles is incredibly simple, but I wont bore you with that right now. All you need to know is this: Any time you connect a field to a particle system, it adds a new perParticle attibute called inputForce[n], where n is the indice of the field. For example:

Create a particle system. Apply a uniform field, a radial field and a turbulence field to the particle system. Every time one of those fields are connected, a new perParticle attribute gets created. In this case:

uniformField1 = inputForce[0]
radialField1 = inputForce[1]
turbulenceFiled1 = inputForce[2]

Make sense?

While this is usually an internal connection only used by the particle systems to transfer vectors from the fields, we can query that information and use it to control any other per particle attributes we want. In this case, we will use a uniform field to control the goal weights of a softbody to 2 goal objects. (IE: Our softBody blend targets)

To replicate the demo scene:

Create a sphere. Name it softBall. Duplicate it and move it off to the side. Name this goal0. Duplicate goal0. Make some changes to goal0 and goal1's shape so you can see the different blendshapes when its working. Select softBall. Go into the Soft/Rigid bodies menu --> Create soft body --> Options. Set the creation options to Make Soft. (You dont want to duplicate or make targets yet). Click create. Select softBallParticle. Shift-select goal0. Go into Particles-->Goal(Options) set weight to 1. Click create. Select softBallParticle. Shift-select goal1. Go into Particles-->Goal(Options) set weight to 1. Click create.


Awesome. If you click the play button in the timeline you should see the particles bounce to exactly in the middle of your 2 targets. (Just like a blendShape set to .5) Set the particles conserve to be 0. (This will help make the blends ease in instead of bouncing around) Now that this is done, go into the attribute editor for softBallparticleShape. Under Add Dynamic attributes click on General. In there click on the particle tab, highlight goalWeight0PP and goalWeight1PP. Click ok. You now have access to the particles individual weighting.

Select the softBallparticle node and create a uniform field. Name it inForce0_UNIFORM. On the uniform, set

Magnitude to .001
Attentuation to 0
Volume shape to 'cube'
Direction to X = 0, Y = 1, Z = 0

Scale it up so all of the geometry is inside it. When this uniform field was created, maya automatically linked it up with the particles, and added the attribute inputForce[0] to the particles attribute list.

In the softBallparticleShape, right click on the text area to the right of 'Goal Weight 1 PP1' and choose Creation Expression. Type this:

softBallParticleShape.goalWeight0PP = 0;
softBallParticleShape.goalWeight1PP = 1;

Click Create.

Now click on the radio box that says 'Runtime after dynamics', and type this:

$inf = mag(softBallParticleShape.inputForce[0]) * 1;
if ($inf >=.0001)
softBallParticleShape.goalWeight0PP = clamp(0,1,(softBallParticleShape.goalWeight0PP + .1));
softBallParticleShape.goalWeight1PP = clamp(0,1,(1 - softBallParticleShape.goalWeight0PP));
softBallParticleShape.goalWeight0PP = clamp(0,1,(softBallParticleShape.goalWeight0PP - .1));
softBallParticleShape.goalWeight1PP = clamp(0,1,(1 - softBallParticleShape.goalWeight0PP));

Now click Create.

That should be about it! Keyframe the uniform field so it moves through where the soft particles are and you should see it slowly morph from one target to the other, depending on wether or not the particles are inside or outside of the uniform field..

Demo scene file located at bottom of page (

06 June 2010, 11:57 AM
thanks Mike, always usefull to have his memory refresh! I've been using this exact same tech in the past and it works fine, only problem with softbody's is they don't update as you move your obj in space even with expr tricks...too bad, that's why now I do this with full expression querying the color and feeding it to blendshape but it's heavier on big model (much slower)...can't have the best of both world I guess.

thank for the tut! great work and cool work at Dneg lucky guys ;)

06 June 2010, 12:45 PM
Reading your work on this issue in an archived thread is what prompted me to post this method! This one has done me well in the past, but you are correct thats it's not ideal for all situations. I'm mainly in particles these days, so it's not something the average animator may be comfortable working with. It's a shame, Strioka's sampler deformer is exactly what I think Maya's blendshapes should be like.

Thanks for the comments, and ya man, dNeg's treating me very well. My project is in it's early stages, so I have some good ol' R&D time to test things like this out!


06 June 2010, 07:40 AM
Hey mike!
Right on my friend! Maya blendShape have been lacking the ability to be be drove at vertex level for too long, Stroika plug is exactly what it should be! but now with Soup plugin I'm pretty sure it could be replicate easily seing from the demo, so all this may not be an issue anymore.
Hope autodesk will understand the need for those kind of function! I've been asking them for years..but I gave up 'cause it seems that it was not important for them to open maya that much, too bad.
All I have to say is go Peter! go! Soup is the thing!
If you happen to know laetitia gabrielli. (lighting rendering dep at dDneg) say hi from me! ;)..she's a good friend with whom I did a short film back at school.


CGTalk Moderation
06 June 2010, 07:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.