CHOPs Deforming Geometry: Part 1 Published: Thursday, February 22, 2007 Video CHOPs [43MB QT - 18 min.]

There isn't a week that goes by where I say "That would have been easier in CHOPs". Once you get over the immediate shock upon hearing the word "CHOPs", I get to hear how learning CHOPs is on your ever growing to-do list when you're not so busy. CHOPs or "Motion and Audio" networks remain elusive to many Houdini TD's, but it doesn't have to be that way. Even with all these new operators with unfamiliar names and different workflows you can make use of the example files in the help cards to get started. Then you can set up CHOP networks that will do "magical" things to geometry, images and more.

I want to blow the dust off of CHOPs and explore some of the powerful operators lurking in this amazing piece of technology. In this entry, I want to take some geometry and see how we can contort and distort it with CHOPs using simple math CHOPs. There will be no complicated expressions used but we will be using math as the main engine and the odd \$F (\$FF) for frames or \$T for time in the mix. Visual math. CHOPs will be our math engine!

Moving Geometry With CHOPs

It is really quite simple to use CHOPs to move geometry around. First we need to get the basic infrastructure in place to get geometry in and out of CHOPs:

• Given some Geometry you want to manipulate (we'll use a default grid SOP), create a local CHOP Network and dive in.
• Append a Geometry CHOP.
• Point the Geometry CHOP to the SOP containing the geometry you want to manipulate.
• Append a Null CHOP and call it OUT and change the display flag to this operator. This will be our export CHOP back out to SOPs. A convenience step to keep things sorted.

CHOPs view with graph of grid and CHOPs

• Back up in SOPs, append a Channel SOP.
• Point the Channel SOP at the CHOP called OUT.

SOPs view with Channel SOP and CHOP network

Do this exercise with a default Grid SOP to match the image above. Once you have this in place, we will be able to dive in to CHOPs and start inserting CHOPs between the Geometry CHOP and the OUT Null CHOP. We see that CHOPs takes some seting up to get data in and out of itself. I believe this is the main reason CHOPs remain elusive: You have to keep on top of the context switches and the abstraction of the various bits of data into raw channels.

I like to work in as interactive a way as possible. This fosters the creative process and reduces context switching. Using the default Build desktop, I usually split the viewer top to bottom ( alt-] ) and with the top viewer at SOPs with the Channel SOP on for Display and Render, unlink this pane by pressing the circled 1 at the upper right corner of this pane and select "No Link" from the menu.

Ready to start working Desktop Setup

With this desktop configuration, we can dive in to CHOPs and work on the network while seeing immediate updates on the geometry. For the more astute Houdini users out there, you are starting to see that I am very free-form with the Build desk and modify it to suit as I work with Houdini. I am a one desk man (most of the time...).

Simple Transform CHOP

The first thing we will do is see how to transform the geometry. This is easily accomplished with the Transform CHOP. Insert a Transform CHOP between the geometry1 Geometry CHOP and the OUT Null CHOP. Now start adjusting the various parameters in the Transform CHOP and watch the grid in the geometry viewport move.

Before we go further, I should explain why this is working.

Each CHOP can have as many channels as you wish, memory permitting. As with SOPs, CHOP Networks always start node chains with generator operators: Nodes that create data. In this case, the geometry1 Geometry CHOP is a generator CHOP. It creates channel data.

The geometry1 Geometry CHOP creates the channels tx, ty and tz. The Geometry CHOP imports attributes from the points of the geometry you point this CHOP at. The defaults are set to P or position and renames the x, y and z values for each point to tx, ty and tz.

Tip: You can use the Geometry CHOP to bring in any Point attribute you wish bound to the geometry. This includes any custom attributes. Simply type in the exact attribute name as it exists in the MMB info on the SOP tile in the Attribute Scope field. See the operator help.

To confirm this, simply hold down the Middle Mouse Button on the geometry1's tile's icon to see the tx ty and tz channels.

I leave the Method option to "Static" when I am just pushing geometry around. See the help if you are curious about the "Animated" option. That one deserves another entry.

The Transform CHOP expects to find channels called tx, ty, tz, rx, ry, rz, sx, sy, sz. Only tx, ty and tz exist but that is enough for the Transform CHOP to work with when dealing with point attribute channels.

By now you might be saying "cool but why would I want to do this?" The reason is that you now have a block of knowledge that can be used to create more complex effects later. For now, continue using Transform SOPs to move geometry in SOPs and put this in the old CHOPs grey matter memory bank. One way of evolving the Transform CHOP would be the setup of Crowd behavior. But that is a ways off right now.

Before you start to insert a Noise CHOP after the Transform CHOP, let me tell you now that it won't work. We will have to add the Noise to the t? channels. This is done with the mandatory Math CHOP. I can't think of a CHOP network I have done that didn't have a Math CHOP.

Do the following steps:

• Insert a Math CHOP between the trasform1 Transform CHOP and the OUT Null CHOP.
• Place a new Noise CHOP to the right of the transform1 Transform CHOP.
• Wire the noise1 Noise CHOP in to the math1 Math CHOP.
• In the Channel folder for the noise1 CHOP, change the Channel Name to ty.
• Select the math1 Math CHOP in the network and change the field Combine CHOPs to "Add".
• Leave the display flag on the noise1 Noise CHOP for now.

Noisy Grid

You should see the noise channel applied to your grid's ty value only. By changing the name of the channel in noise1 and setting math1 to combine CHOPs channels by name will cause the ty channel from the transform1 CHOP to be added only to the ty channel in noise1. This is an important concept: CHOPs have lots of options to allow you to control how channels affect each other in procedural ways.

Changing any of the parameters on the noise1 Noise CHOP will reflect immediately on both the graph of the noise and the grid. Try changing some of the parameters. I like modifying the period up. The grid looks like it is relaxing. You can manipulate some of the handles in the channel view. Try changing the amp horizontal bar to change the amplitude of the noise.

Just how is the Grid being distorted?

It is important to understand just how the grid is being distorted. It will help us get a deeper understanding of CHOPs.

Just what is a CHOP channel? It is simply a raw channel that contains sample points in time, each sample having it's own value. A CHOP channel can have any sample rate you want! By default a CHOP channel will have a single sample per frame. You can verify this by turning on the display of dots in the CHOP channel view and zoom in until you see the dot samples.

• With your cursor over the CHOP channel viewer, hit the "d" key to turn on dots.
• Zoom in on the channel by holding the middle-mouse-button where dragging left to right scales in on time and up and down scales the value. The pivot point is where you first clicked the mouse pointer in the graph. If you zoom the time across enough, you can see each frame number on the bottom of the graph align with each dot sample in the noise channel.
• Increase the grid display to see more detail zoomed in close up. Press on the Options menu button above the channel view and from the menu select "Grid High".

Zoomed in on noise ty channel

Some common sample rates are 24fps, 48fps (two samples a frame), 44,1000Hz (samples per second cd quality audio). You can easily re-sample CHOP channels using the Resample CHOP if necessary. CHOPs are very flexible at capturing data at any resolution.

Now that we see that CHOP channels are just samples in time, we can look at how the grid's ty channel is indexing in to the noise ty channel. Using the Math CHOP set to Add CHOP channels, it is done on a sample by sample basis. Sample number one on the geometry ty channel is being added to sample number one in the noise channel, geometry ty's second sample adds to the noise ty's second sample and so on. This explains why the grid looks like the noise is being dragged through each row on the grid if you study it closely. It also means that the noise channel needs to have enough samples to cover all the points in the grid. In this case, using the middle-mouse-button on both the geometry1 CHOP and the noise1 CHOP and looking to see the Length: item's first number, we see that geometry1 has 100i samples and the noise1 has 240i samples. More than enough.

Now to add some animation to the system. In the noise1 Noise CHOP's Transform Folder, change the Translate transx channel to read: \$TX*0.1

Add animation to noise1 Noise CHOP

Press Play to see the animated noise channel sweep through the grid.

Modify the Pattern

Let's call the right side of the math1 Math CHOP the pattern. Time to start playing! I'll show you how to build up a more complicated pattern than just noise. I will take a low frequency sine wave and using a Math CHOP, combine the noise to the wave. Here's the Steps:

• Place a Wave CHOP to the left of the noise1 Noise CHOP. Arrange the CHOPs to suit.
• In the Channel folder for the wave1 Wave CHOP, change the Channel Name to ty.
• Append a Math CHOP to the wave1 Wave CHOP.
• Wire the noise1 Noise CHOP in to the math2 Math CHOP,
• Replace the second input in to the original math1 Math CHOP with the math2 Math CHOP.
• Cut down the amplitude of the effect by setting the Amplitude to 0.25 in the wave1 Wave CHOP. Press play and see the grid animate with the animated noise. Stop the playback.
• Animate the wave1 Wave CHOP's Phase parameter by using the expression \$T*0.1
• Jump up to SOPs and select the channel1 Channel SOP.
• Change the Channel Scope to ty and the Attribute Scope to P(1)
• Hit play and watch the noisy waveform work its way through the grid.

You will want to increase the Rows and Columns of the grid. Remember above that the indexing of the points in to the noisey wave is time based. If you have more points in your grid than frames (samples), you will have to increase the time length of the wave1 Wave CHOP and the noise1 Noise CHOP by going to the respective Channel folders and cranking up the End parameter. These default to seconds so don't set it too high. You could also use a Resample SOP after the math2 Math CHOP to add enough samples to match the increased number of points.

Add a Wave to the Noise

The last step above where we set the Channel Scope to ty and the Attribute Scope to P(1) lets us match any channel in the referenced CHOP to any index in to the attribute starting at zero. ty is obvious. Fetch the ty channel from the given CHOP. P(1) will affect the second component of the vector P position or the ty channel. P(0) would index in to the x and P(2) would index in to the z component of P. I am not stopping you from trying this. On a grid it is boring. On a volume, well, give it a go.

See the hip file below to see the network we built above plus some other options that I played around with to give you some more ideas. Study it. The next lesson will build on top of this one so time to get a hold of the CHOPs basics in this post.

Things to Try

Try manipulating the noise1 Noise CHOP's Amplitude slider to add more noise to the sine wave. Use the math2 Math CHOP's Range folder parms to remap the amplitude of the channel. Change the "To Range" to either increase or decrease the effect. Try substituting other geometry for the grid For volume type objects, you will want to add back the original ty channel to get the noise to add on top. Try mixing and matching source primitives in to CHOPs. For example, feed a torus in to the geometry1 Geometry CHOP and put the Channel SOP on the grid. Mix it up! Add a second layer of wave – noise with, you guessed it, another Math CHOP.

You will see in the next installment that copy-pasting simple bits of CHOP networks and altering a few values then layering with Math CHOPs gives you amazing organic looks. All without complicated math expressions.

Conclusion of Part 1

Using the Math CHOP to add channels together using name matching is very powerful and is the most frequently used CHOP. It is the workhorse of CHOPs and is the equivalent to the Point SOP in SOPs. There are other ways to distort geometry. I will show you the ultimate way to index the geometry to the noise channel in the next blog entry. For now, enjoy what we have done so far and see just how far you can push the geometry around by replacing both the geometry to deform and the index channel to the right in put in to the math1 Math CHOP.

Once you get comfortable with the above exercises, you can move on to more complicated CHOP networks and push things a bit further.

Part 2

Using the LookUp CHOP to index the channels. You saw how the Math CHOP can take two channels and add them together. You will now use the LookUp CHOP to perform a similar task but with much more control. I will warn you now, you will need to put on your thinking cap to tackle the LookUp CHOP.

Later!

 by digitallysane 2007-02-23 06:08:42 This is wonderful information on the most under-documented (and under-appreciated and brilliant and groundbreaking and...) editor of Houdini. I love CHOPs and this tutorial is eye-opening. I wouldn't mind some more tuts on CHOPs... :)
 by jeff 2007-02-23 10:59:25 The second istallment should be up early next week. I'll be focusing on the LookUp CHOP. An awesome tool as you will see soon.
 by fxrod 2007-02-23 21:05:12 In H8.1.704, there seems to be a bug in the math CHOP. I have "ty" in the Channel tab and it seems to work as expected when the Combine CHOPs parameter is "Off". As soon as I turn on "Add", it moves the points along z as well.
 by onesk8man 2007-02-24 09:17:54 I love your section. Will be great if you could download in .pdf also the text..  Thank you anyway for workshops!  Keep them on!
 by jeff 2007-02-26 12:10:45 fxrod, yep in the Math CHOP there are a couple ways around this: OMethod explained in blog: Make sure you have the "Match By" option set to "Channel Name.  Alternate Method: You can go to the Math CHOP's Common Folder and change the scope to read: ty That makes the Math CHOP only work on channels called ty.
 by fxrod 2007-02-26 16:18:06 Thanks Jeff! I overlooked the "Match By" option.. :)  This blog comes at a perfect time for me, as I've been deforming geometry with complex expressions and tying some of the values in the expressions to the top level of otls.  Using CHOPs is much better for this because you can directly chref() the chop parameters to your otls, instead of having a large and cumbersome expression.  Can you show us some cool ways to control particles with CHOPs?
 by jeff 2007-02-27 10:16:10 I will add this to the list of topics to cover. Thank-you.
 by andrewlowell 2007-02-27 18:18:34 very cool I haven't spent much time with the geometry CHOP yet, I didn't realise the non-animated version (static) was actually a lookup table where the frame corresponds to the point number.  I was actually messing around with a large nest of point expressions the other day and the expression ended up being way too long in a single expression to work with intelligently so I broke it up into different custom variables on points.  I'm guessing if I redu it with geometry chop along with a string of expression/math chops to work with the data instead I can make it more elegant by not having to use lots of extra attributes, and also form a more interactive way of adjusting things.  Wow, why do anything with expressions on points/primitives.
 by circusmonkey 2007-02-27 19:08:16 Jeff what can I say, your insight into these various areas just drives me to further improve my houdini skills and points me to dig in areas I never knew existed   regards   R
 by andrewlowell 2007-02-27 20:27:28 Now that I think about it, there are definately a few CHOPs I either haven't figured out or haven't found a good use for ..  the logic and shuffle CHOPs ... I'm guessing these are pretty powerful CHOPs but the documentation is a bit scarce .. any tips or working examples of where they'd be useful would be very cool
 by bobster 2007-03-07 20:08:32 This is awesome Jeff! I'm very happy to see docs for Chops. This old school blog is a great idea!
 by kursad 2011-05-24 01:32:22 Jeff,  Thanks for the tutorial. Timeless information.