Search form

The Magic of Houdini: Learning the Brush Operations

Brush operations is the subject of VFXWorlds latest excerpt from The Magic of Houdini by Will Cunningham.

All images from The Magic of Houdini by Will Cunningham. Reprinted with permission.

This is the next in a series of excerpts from the Thomson Course Technology book The Magic of Houdini by Will Cunningham. In the next few months VFXWorld readers will learn the basics of the dominant tool that has been used in the creation of some of the most awe-inspiring animation and cinematic effects ever made.

Brush operations in Houdini are a great way to interactively affect geometry. You can sculpt as a sculptor does. You can paint as a painter does. You can comb as a hairstylist does. Welcome to marvelous country. Youve come a long way, baby! Youll be using a mouse in the following exercise. But, if you have Wacom tablet, plug it in and take it for a spin. You can get a very fine degree of control with a tablet rig by modulating the application pressure.

Sculpt It! Comb It! Paint It!

Yes, work with me here darling! You are going to work the magic, as they say. You are going to take a bland and boring flat grid and through the miracle of cosmetic brush applications, turn it into a maaaaarvelous looking bit of scenery. Oh yes, darling. Do come along. You simply must see this! Figure 1 shows the end result of the "from flat to fabulous" miracle makeover.

[Figure 1] I just want to jump around with my shoes off and let it tickle my toes!

  • 1. Fire up a new Houdini session. Drop a Geometry and rename it terrain. Jump into it and delete the file node if it exists. Drop a grid operation. Change the Primitive Type to NURBs and the Rows to 30 and the Columns to 30.

2. Over the viewport, choose a Sculpt operation and choose the entire grid to apply it to. Move your pointer over the grid and youll see the dotted outline of a circle. That is the size of your brush. Hold down the LMB and move around the grid. It looks kind of like in the cartoons when a certain rabbit is digging his way to the destination. Release the LMB. Hold it down again and continue sculpting. If you keep clicking in one spot, you can pull the geometry up to towering heights.

3. Now, hold down the MMB and do the same thing. The MMB will push geometry back down. You can change the amount of displacement per click by adjust the FD value for the LMB and the BD value for the MMB. When you to start from a clean slate again, click the Reset All Changes button and you get to start from scratch.

[Figure 2] The result of the sculpt operation.

  • 4. Adjust the size of the Radius up and down to change the size of your brush. Go to the Brush tab and change Shape to Square. Reset the Changes and play around with that. The brush is now more angular. Even cooler, change the Shape to Bitmap and the Radius to 0.5. Reset the changes and just click once in the center of the grid. Your painting with a butterfly brush now! You can choose which channel of the bitmap you want to paint with. By default, it is set to Alpha. Feel free to take a few minutes to play with the various parameters to get a feel for what each does. When you are finished, change back to the Circle brush and change the Radius to 0.1. Reset the changes and sculpt something like what is shown in Figure 2. It by no means needs to be exacting. Basically, just sculpt some mountains and leave a flat valley area up front.

5. Append a Convert SOP change and change the Level of Detail in U and V to 1.4. This converts the NURBs grid to a polygonal grid and increases the smoothness a little.

[Figure 3] The grid with point normals displayed.

  • 6. Append a Point SOP. The Point SOP is one the most powerful SOPs available because it allows you to modify attributes on a per point basis. As you continue through the book, youll often come back to this operation because it is so useful for a wide variety of things. For now, you are going to color every point on the grid black and give each point a Point Normal which points up in the Y axis. Change Keep Color to Add Color and delete the channels by RMB on the Color label and choosing Delete Channels. Change the triplet (r, g, b) to 0, 0, 0, which turns the grid to black. Go into wireframe shading to make it easier to see. Change Keep Normal to Add Normal and delete the channels. Set this triplet to 0, 1, 0. This gives every point on the grid a point normal pointing up in the Y direction. To verify this, turn on the display of point normals in the right stowbar of the Viewer pane. They may turn out to not be large enough or entirely too large to be very helpful. Over the viewport, press d to bring up the Display Options and go to the Miscellaneous tab. Adjust the Scale Normals slider to around 0.15. MMB on the node to verify that you have added two point attributes being color (Cd) and normal (N), each of which are comprised of three components. Figure 3 shows the grid with point normals displayed and scaled down a bit.

[Figure 4] The combed point normals.

  • 7. Append a Comb SOP to the network. In the viewport, make sure you are in an operational state and start combing around. All of the brush operations basically use the same interface and just affect different things. Press Reset All Changes to start over. Adjust Comb Lift to 1 and now combing will make the normals trend toward their face normal, which is perpendicular to the primitive surface from which they originate. Setting it to 0.5 combs them to halfway between their normal direction and laying flat on the grid. Setting the Opacity to around 0.3 can give you a more controllable brush stroke. Play around a bit and try to end up creating a swirl in the flat terrain up front and path of flattened normals going through the valley between the mountains. Yours should now look roughly like Figure 4. Later, you will copy little L-systems to each of the points and the direction of the point normal will determine how the L-system is oriented. So, the ones up front will kind of lay down and swirl around, a bit like a crop circle.

8. Append a Paint SOP to the network. Again, the interface is basically the same only this time you are painting point colors. Change FG to 1, 0, 0, which means you will be painting pure red. By default, MMB will paint back to black. Turn off the point normals display and go back into shaded mode to more easily see what you are doing. Later, you will use the amount of red that an area contains to determine how many L-systems will be copied to that area. To mimic how it often works in nature with more vegetation growing in the valleys than the peaks, paint more red there and less in the heights. Switch to smooth wire shaded; yours should now look roughly like Figure 5.

[Figure 5] The painted population areas.

  • 9. Now, lets create an attribute based on the amount of red you just painted. Remember that an attribute is just a characteristic. In this case, you will be creating a point attribute and so the attribute will describe how much each point in the grid contains, from 0 being black to 1 being full red. Append an AttribCreate SOP and rename it attribGrow. In the Name field, type in

grow and leave the Class field to Point, as you want to create a point attribute. In the value1 field, type point ("../paint1", $PT, "Cd", 0) and take a second to think about what you did. It likely rings a bell because you used a very similar expression, the prim() expression, in the soccer ball exercise. The point() expression does that same exact thing as the prim() expression, only it references points instead of primitives. It is going to the paint1 node and looking at each point number, using $PT, and retrieving the first component, using 0, of the Cd attribute, which is the red component.

Both of these expressions are used all the time because they allow you to directly and easily access various characteristics of geometry. So, you are giving each point an attribute called grow and it will be equal to how much red is contained in that point.

[Figure 6] The current state of the network.

  • 10. Split the Viewer pane top and bottom and change the bottom pane to a Details View. Click Hide All Attributes and then choose grow and Cd. This makes it easier to compare the two attributes by not displaying attributes that you arent interested in. Scroll down a little and you can see that all you are doing is stuffing Cd[0] into grow.

11. Append a Scatter SOP. The geometry vanished. What happened? Turn on the display of points and you can see something really sweet has happened. This operation has distributed points onto the grid based on the area of each primitive. Because all of the primitives have similar areas, the points are pretty uniformly distributed across the grid. Turn down the number of points to 2000 and toggle off Scatter Based on Primitive Area. In the Alternative Attribute field, type the attribute you just created which is grow. Instantly, youll see that the distribution of points no longer seems uniform. Slide Attribute Bias all the way over to 1 and now points are being distributed based solely on the amount of red contained in the surrounding points. Areas with more red, like in the valley, have far more points than areas that have less red, like higher up in the mountains. Each of these points will have an L-system copied to it. This is a great way to create an organically populated area of trees or grass. Your network should now look like Figure 6.

  • 12. Off to the left side and unconnected, drop a Line SOP. Its fine at the defaults. This will be low-res geometry you use to visualize the look whilst working on it. Later in the exercise, youll create a Switch SOP that will switch to a more complicated geometry only at render time. This keeps the computation load down and so makes working with it more interactive while still getting something more interesting going for the actual render.

13. Append a Switch SOP to the line node and leave it at the defaults.

Find out more about how to apply each of Houdinis features to your projects as you take on modeling, character animation, particle effects animation, dynamic simulation animation, shading, digital asset creation and rendering. The Magic of Houdini by Will Cunninham. Boston, MA: Thomson Course Technology, 2006. 355 pages with illustrations. ISBN: 1-59863-082-2 ($49.95). Check back to VFXWorld frequently to read new excerpts.

Will Cunningham began his trek by studying both traditional art subjects and 3D computer software at the Academy of Entertainment and Technology. After his studies, he was hired as a Houdini technical intern by Side Effects, the developers of the Houdini software package. Eager to create effects for the big screen, he then jumped into production with BlackBox Digital on the feature, The Prince and Me. Shortly thereafter, he also began teaching Introduction to Houdini at the Academy and has since taught both the introductory and intermediate Houdini courses. In the fall of 2004, he was awarded a fellowship grant by Santa Monica College to support his efforts in creating this book. Over the years, Will has worked for a number of production studios on a variety of projects, including The Chronicles of Narnia: The Lion, the Witch and the Wardrobe, Open Season and Ghost Rider. Currently, he is enjoying effects challenges and learning opportunities at Sony Pictures Imageworks.

Tags 
randomness