fx notes

Search

Search IconIcon to open search

KineFX

Last updated Oct 15, 2024 Edit Source

# Rig Attribute Wrangles

# Basics

We can use any kind of curve and transform it like a parent hierarchy chain using the Rig Attribute Wrangle!

// rigattribwrangle

1
prerotate(4@localtransform, chf("amount") * @curveu, {1,0,0});

The wrangle automatically creates a transform and localtransform matrix on each point to apply all transformations.

Usually you would do this beforehand to better control the orientations. A good way is using the orientalongcurve SOP which has a 3x3 transform export option in combination with a rigdoctor node.

# Secondary Motion with CHOPs

The issue with the default secondary motion SOP is that you can only have a single driver point for now (H19.5). If you want to control many different joints with different drivers without setting up a secondary motion SOP for each you are out of luck.

I had to build a jiggle effect for an unfolding tree with a lot of branches where I would have needed this functionality.

As a workaround I animated an angle attribute and jiggled it using CHOPs before deforming my rig with the prerotate & prescale function.

// rotate_rig wrangle

1
2
prerotate(4@localtransform, @angle, axis);
prescale(4@localtransform, scale_vector);

I used the AttribChop SOP from Nick Taylor’s aeLib to do the jiggle setup more conveniently. Highly recommended HDA collection!

It gives quite convincing results without having to sim anything.

# Deformation in Rest Space

Sometimes you want to see/work with a simulation/deformation result in rest space. To do this you need to create a local coordinate system for every point and then deform that with geometry.

Sources:

This setup was shown to me by Michiel Hagedoorn @ SideFX, while I was working on the ML Groom Deformer project and it comes in handy every once in a while!

// point wrangle “apply_local_coords”

1
2
3
4
5
6
7
v@axis_x = set(1, 0, 0);
v@axis_y = set(0, 1, 0);
v@axis_z = set(0, 0, 1);

setattribtypeinfo(geoself(), 'point', 'axis_x', 'vector');
setattribtypeinfo(geoself(), 'point', 'axis_y', 'vector');
setattribtypeinfo(geoself(), 'point', 'axis_z', 'vector');

You can then introduce some sort of deformation that goes beyond the linear blend skinning one. In this case I’m using the wrinkle deformer, but this could be anything really (Vellum Sim etc.).

// point wrangle “extract_local_disp”

1
2
3
4
5
matrix3 local_from_global = invert( set( v@axis_x, v@axis_y, v@axis_z ) );
vector global_delta = point(1,"P",@ptnum) - v@P;
vector local_delta = global_delta * local_from_global;

v@P = local_delta;

// point wrangle “apply_disp”

1
v@P += point(1, "P", @ptnum);

The resulting geometry has all the deformation data on it with the input animation being removed. You can easily apply any effects and processing now and use a default bonedeform to move it back to the correct pose after.

Download: File

# Misc

# Display Rig Controls on HDA Viewer State

To expose the control rig on an HDA you have to define the “Default State” parameter in the “Node” tab of the Operator Type Properties.

For kineFX controls this should be kinefx__rigpose.

You also have to promote the parameters you want to control with the HDA.


sources / further reading:


Interactive Graph