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:
CHOPs view with graph of grid and CHOPs
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.
Set up your Desktop
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.
Add Noise to the Grid
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:
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.
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.
Add Some Animation
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:
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 TryTry 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.
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.