Tag: expression

Soft IK Again

This is an update about the soft IK video I made almost 10 years ago. I got a question from an audience about adding stretchiness on top of it. While the original source of explanation for Softimage is gone, I had better jot it down before forgetting again.

Here is the updated scene file Soft_IK_END2.ma.

For anyone who haven’t heard of soft IK, it is about “softening” the pop when the ikHandle moves from fully extended to un-extended position. The solution here is to limit the ikHandle’s position such that the joint chain never go straight no matter how far the control goes. We need the equation below.

When x → infinity, y → 1 but never equal to 1

See the graph below. We use a variable soft to define a starting point Ds = D * (1-soft), which is slightly smaller than D.

When the ctrl is moving away from the root joint, and reaches Ds ( along x-axis ), the ikHandle starts to slow down ( along y-axis ), moving toward but never equal D.

You could test and play with the graph interactively at https://www.geogebra.org/calculator. Download and Unzip my graph SoftIK_graph.zip. Load it by Open > LOCAL FILE.

Below is the expression in the scene file. Stretchy works by multiplying the scaling ratio to both joints’ scale x and the offset for the joint softJ_end. You may also note that I’m using D * (1-s) instead of D – s in the old version. It seems that the result would be more consistent for characters of different size.

float $D = 9.715;
float $soft = foot_ctl.soft;
float $d = distanceDimensionShape1.distance;
float $Ds = $D * (1-$soft);

float $stretchy = foot_ctl.stretchy;
float $scaling = (max($d / $D,1) - 1) * $stretchy + 1;

if ($d > $Ds)
	  softJ_end.translateX = $scaling * $D * (1-$soft * exp( -($d-$Ds)));
else
	  softJ_end.translateX = $d;

joint1.scaleX = $scaling;
joint2.scaleX = $scaling;

In my own autorig they are all done with utility nodes. But it seems handful to keep the expression scene as it is faster to experiment with ideas and equation. There are some free plugin solutions which should be more efficient. But I think this is not too difficult and is worth learning if I could apply it somewhere else in the future.


Maya camera shake

Recently i discover the shake attribute under the camera shape node https://www.youtube.com/watch?v=6AS1PJlcHAE.

In the old days cheating in AE was enough. But it comes up right in time since my aerial shots on hands need plenty of shaking. An easy shaking control in 3d might be better. I use them with expression and custom attributes for keyable magnitude and frequency. To send the shake to 3ds Max my first idea was to bring the shake back to 3d. The shakeHorizontal and shakeVertical values are transferred to tx, ty of an extra locator on top the camera.

The result look fine in general, but not when object goes very far or close. The shake is constant in 2d but not with perspective. Thus I’m thinking about the other method, putting the shake into AE.

I did a quick test and it seems to work. Copy the baked shakeHorizontal and shakeVertical keys of original camera to tx ty of a dummy camera. It should be a locator actually but AE recognizes keys on camera only. Export the dummy camera as .ma and import into AE. Create a null object / solid layer, use expression to get the keys and scale it up about 100 times. Parent any comp to this layer to get the shake.

Not 100% sure but i will tell if it really works.