Home » Featured, Houdini, Miscellaneous

Houdini CHOPs: Curves from animation

21 July 2009 55,622 views 7 Comments

This is a simple but in depth 4 page tutorial on how to use CHOPs to create a curve from the path of an animated object.

It is possible to use all sorts of methods to create plotted animation curves (like, for example, the Trail SOP), but the aim is to create a curve that will respond to any future changes in the object’s animation. Additionally, I also want to be able to specify the amount of detail in the curve. To finish the tutorial, I’ll show you how to turn the curve into a Houdini Digital Asset (HDA) so that you can easily reuse it in your own scenes.

The CHOP network

In Houdini, CHOPs allow us to look at animation data across the entire time range of the scene, and process it in many different ways. CHOPs can offer unique solutions to problems that would otherwise be very difficult to solve.

Step1 So to start, add a Null object and animate it any way you like. Call it “animatedNull”. Note that in the image to the left, I’ve added a particle trail so you can see where I’ve animated it.

Step2 Add a new Sub Network node next to the Null node and call it “AnimationCurve” and press Enter to go inside. Press Tab again and create a CHOP Network node and rename it to “chop_GetAnim”.

Go Inside the new CHOP Network and create a Fetch CHOP called “fetch_Anim”. Change your main window to Motion View. In the Fetch CHOPs Node parameter, select the animated null that you created (which should be /obj/animatedNull), and in the Channels parameter, enter:


t[xyz]
 

Technical Detail

In Houdini, this is known as a string pattern. You can find it in the documentation under Houdini10 > Expression Functions > Pattern Matching or by searching for “Pattern Matching”. The syntax is very similar to wildcards in DOS and in this case is just a way of telling the Fetch SOP which channels you want to use. The above expression will match any of the following names:


tx ty tz
 

Which are the channels that you want to use from the animatedNull object. If you prefer, you could just type the channel names as shown above into the Channels parameter. It will still work.

Note that the following pattern will also work:


t*
 

but it spreads the net too wide as it will import any channel that has “t” as its first letter. Not hugely problematic, but it could mean unnecessary processing for Houdini.

It is also worth noting that the order of the channels is dependent on what you type here. For example, either of the following two patterns:


tz ty tx
t[zyx]
 

will import the channels in reverse order. Generally this doesn’t matter too much as the channels are usually identified by name, but it is worth being aware of.

Finally, add a Null CHOP and feed the output of the Fetch CHOP into it. Rename the Null to “OUT”, and enable the display flag for the new node.

Press h in the main viewport to frame the curves so that you see something similar to that shown in the image below.

The CHOP network
The CHOP network and imported animation curves

The Fetch CHOP also has a parameter called Sample Rate which can be found on the node’s Channel tab. Changing its value changes the number of points (known as samples in CHOPs) that make up the animation curves in the viewport. If you press d in the viewport, you will toggle the display of dots that show the curve samples. Keep the Sample Rate set to default for the moment.

On the next page, you will use this value to control the resolution of your curve.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

7 Comments »

  • Dragos Stefan said:

    A great and clear tutorial! As an option, one can use an Object CHOP instead of the Fetch CHOP to get the animation into CHOPs. However, while the Object CHOP can be more flexible in some cases, it is also much slower, especially if it has to compute the whole timeline.

  • varomix said:

    HI Andy

    I totally loved this one, very useful one

    Do you think this could be made so that the curve(SOP) can shape the animation curves?

    or maybe add a little manipulator at each key an move it around?

    that would be awesome

    thank you Andy, please keep sharing this nice techniques

    varomix

  • AndyN (author) said:

    Great, thanks for the feedback.

    As far as I know, you wouldn’t be able to feed this system back into the animation again, because you’d end up with cyclical evaluation. I did try it when I was putting this tutorial together and Houdini bombed on me. In the docs, it says that you can’t export CHOPs back to parameters if you’re already importing data from them in the same CHOP network.

    It would be trivial to drive a different object with that curve though.

  • Jason said:

    Awesome tutorial. I’m just starting to get into CHOP’s and this really helps out on learning it. This is probably realy simple, but do you have any suggestions on animating a curve through CHOPs that controls an IK rig. I tried hand animating it, but I didn’t get the look I was going for. Anyways, like I said this really helped me in getting started with CHOPs.
    –Jason

  • AndyN (author) said:

    Hi Jason,
    No problem, glad you found it helpful.

    It’s hard to give any recommendations based on what you’ve said about the curve animation. If you can send me more info, I might be able to help.

    You can email me here:
    http://www.andynicholas.com/?page_id=224

    Cheers,

    Andy

  • Helene said:

    Hi Andy,

    Just wanted to say ‘Hi’ and thank you for a great tutorial. I’m just beginning to get into CHOPs – am finding it fascinating. This is a lovely introduction. Just to say you tutorials are greatly appreciated. Keep up the great work. :)

    Regards,
    Helene

  • AndyN (author) said:

    No problem Helene, thanks!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Security Code: