Difference between revisions of "HoudiniKinefx"

From cgwiki
Line 71: Line 71:
  
 
[[File:skeleton_sop_hotkeys.png|link=https://www.sidefx.com/docs/houdini/character/kinefx/skeletons.html#creatingskels]]
 
[[File:skeleton_sop_hotkeys.png|link=https://www.sidefx.com/docs/houdini/character/kinefx/skeletons.html#creatingskels]]
 +
 +
Take 2 mins to go over the shortcuts and various modes, its pretty good fun. Still you'll see in this little mp4:
 +
 +
* Mostly in 'freehand' mode to click-click-click the core hips-to-head joint chain
 +
* Hit enter to swap to edit mode, tweak on, child compensate on, drag on joints to fix placement
 +
* Select a joint, hit enter again to draw arm, leg, tail
 +
* r.click, split to create elbow
 +
* select shoulder/elbow/wrist, r.click, mirror and duplicate to create opposite side.
  
 
=== Rig from labs straight skeleton ===
 
=== Rig from labs straight skeleton ===

Revision as of 21:49, 23 October 2020

Kinefx

Kinefx covers a lot of ground, but there's a pleasing DNA share with a lot of established houdini workflows. Basically if you've used packed prims before and wrangles, you get the core of kinefx.

Localtransform and kinefx wrangle

For me one of the most exciting things is the core ability to treat curves as joint chains. I've experimented with doing this in the past (see CurveUnrollTutorial ), but it's quite a lot of work. Now all that stuff comes for free!

When you get into kinefx, the sections of a line are treated as joint chains. Each point gets a @localtransform matrix4 attribute. If you rotate it, it is treated as a FK rotation in a joint chain, ie, rotate the elbow, and you'll have the wrist, hand, fingers all come along too in a FK style.

This means if you animate all the rotations of all the joints, you get easy wiggly waggly setups. So:

  1. Make a line with 10 segments
  2. Append a skeleton sop which will create @localtransform for you
  3. Append a rig wrangle
  4. Try something like this:
rotate(4@localtransform, @Time, {1,0,0});

When you scrub the timeline, you'll see the line curl up as each 'joint' is rotated over time. What if you increase the amount of rotation from the start to the end of the curve?

rotate(4@localtransform, @Time*@ptnum*0.1, {1,0,0});

or drive with a sine wave and tweak the values a bit?

rotate(4@localtransform, .2*sin(-@Time*3+@ptnum*0.2), {1,0,0});

or just be really silly, do this, and copy some lines to a sphere:

rotate(4@localtransform, .4*sin(rand(@primnum)-@Time*2+@ptnum*.05), vector(curlnoise(@P+rand(@prinum)+@Time*0.2)));

Kinefx starfish.gif

Download hip: File:kinefx_starfish.hip

FBIK

Kinefx fbik.gif

Download hip: File:kinefx_fbik_hips.hip

Not sure if this is the right way to use it, but its fun.

Bring in a rig, here I've loaded mocapbiped3, chose a walk, and imported it with the scenecharacterimport node. Split off the feet and hips, move the hips, feed those to the second input of the fbik sop, and the original rig to the first input.

FBIK will do its best to push the rig to match the positions of the bones you specify. Tweaking some weighting options on the FBIK node can help get rid of glitches.

It's not perfect, things like knees will wobble everywhere, but like I said, its fun.

Simple skinning from scratch

Kinefx skin.png

Download hip: File:kinefx_skin_simple.hip

The launch docs gloss over this a little bit, you can work it out by reverse engineering some of the later examples.

Captureproximity sop is what you want. Geo to the left, rig to the right, feed that and your animated skeleton to a bone deform.

Play with the weights tab on the capture proximity to boost the number of influences, smooth out the reuslts.

The skeleton was drawn directly in the skeleton sop, it has lots of options to help you draw joints, mirror them, constrain to planes or inside geo etc, detail are in the sidefx docs.

Skeleton sop hotkeys.png

Take 2 mins to go over the shortcuts and various modes, its pretty good fun. Still you'll see in this little mp4:

  • Mostly in 'freehand' mode to click-click-click the core hips-to-head joint chain
  • Hit enter to swap to edit mode, tweak on, child compensate on, drag on joints to fix placement
  • Select a joint, hit enter again to draw arm, leg, tail
  • r.click, split to create elbow
  • select shoulder/elbow/wrist, r.click, mirror and duplicate to create opposite side.

Rig from labs straight skeleton

Kinefx straight skel.png

Download hip: File:kinefx_straight_skeleton.hip

Takes a bit of cleanup, but it works. The key thing is for the curves to have their orientation correct, ie if you were to follow the vertex ordering, the joints must flow like joints. No child joints pointing back up to the root or backwards joints, most of the errors I had were due to this.

A fix here after chatting with Henry Dean is to select the 'hips', use edge transport to calculate distance to the hips, sort by that distance attribute, and polypath to force a rebuild of the vertex order based on point/prim order.

Rig doctor to help debug curve direction

Kinefx rigdoctor parent to child.gif

When you get warnings of cycle errors, that implies some of your curves are backwards. Append a rig doctor, turn on 'show parent to child', and you'll see a little arrowhead to show how the curves are flowing. Red is bad. In the gif the red arrows appear if I take the resampled straight skeleton. The good one is using the edge transport, sort, polypath trick outlined above.