The Magic of Houdini: Ye Ole Copy SOP

In the latest excerpt from the book The Magic of Houdini, Will Cunningham welcomes all users to Copy SOP.
Posted In | Magazines: VFXWorld

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.

Welcome to the Copy SOP! It rocketh all planes of the multiverse and has at one point, early in its history, brought peace to the warring tribes of the Dantooine System. In fact, I feel it deserves a poem…

Oh Copy SOP
Oh beacon of hope to the seven cities
Please do continue the peace in the lands of Dantooine
Please do rocketh the multiverse, if you know what I mean

I feel better having said that and I hope you do, too. If you haven’t gathered already, the Copy SOP is an amazing piece of ingenuity. Let’s see why. Append a Copy SOP to the switch node. Notice that this node has two inputs. MMB on the left input and it reads: Primitives to Copy. Do the same on the right input and it reads: Template to Copy To. Make sure the left input is connected to the stamp node and that the right input is connected to the scatter node. Your network should now look like Figure 1.

So, what did it do? It copied what is coming into the left input to every point coming into the right input. So, one line is being copied to every point in the scatter node. Though, looking in the viewport, things look a little screwy. There are two problems, which are scale and orientation. The lines are way too big for the terrain and they aren’t being copied with the correct orientation. They are inheriting the point normal information that you set earlier because the Rotate to Normal toggle is on, but you can easily see the ones in front are laying down flat in a swirl as you did to the point normals. You can fix the orientation of the line before it is fed into the copy node. Turn on the Footprint (the burgundy one) flag on the convert node so that you can see the terrain as you continue working.

    1. RMB on the left input of the copy node and insert a Transform SOP. Leave the Display flag on the copy node and make sure the transform node is selected so you adjust its parameters. As always, you’ll immediately see the changes you make cook down the chain. First, change the Uniform Scale to 0.1 to get the lines at a better scale. Now, change the Rotate in X to 90. You now have appropriately sized trees or grass or whatever and they are also correctly inheriting the point normal attribute. The problem was that the copy node expects the input to be facing down the positive Z axis when it copies using the Rotate to Normal option.

    2. Notice that all the lines are exactly the same size. This doesn’t make it look very natural, as it is unlikely you would find everything to be the same size in real life. You can use the Copy operation to randomly add variation to the copies, and this, as they say, eeeez zeeee spice of life! First, let’s get the stamping working and then you’ll determine a good range of scale for the copies. In the transform node (which is probably called xform1), enter stamp (“../copy1”, “height”, 0.1) in the Uniform Scale field.

    Bring up a Textport and type “exhelp stamp” to get help on the stamp() expression. You reference what nodes are going to do the stamping, the name of the variable to be stamped and a default value in case that variable isn’t found.

    3. In the copy node, go to the Stamp tab and type “height” in the first Variable field. Toggle on Stamp Inputs and see what happened in the viewport. All the lines disappeared because the value of height is currently zero. Move the slider back and forth and you’ll see that it sets the Uniform Scale of every copy to that value. Now, let’s make it more interesting by using a simple expression instead of a constant value. Type “rand($PT) * 0.1” in the Value 1 field and check out what happens. Every point that comes in through the right input of the copy node has a unique point number, which can be accessed through the local variable PT. You can then use that point number as a seed for the rand() expression, which will return a random value between 0 and 1 based on the seed. So, every copy has randomly set Uniform Scale from 0 to 1. You then multiply that by 0.1 to get them all back down to a better range of scale. So the final range is from 0 to 0.1. Look around the geometry and you’ll see that some lines are very small and some of the larger lines must have resolved to around 0.1. Figure 2 shows the Stamp tab and what you entered.







Comments

  No comments. Be the first to comment below.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Use <!--pagebreak--> to create page breaks.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.