In VFXWorld's latest excerpt from The Magic of Houdini, Will Cunningham discusses the use of initial velocity and other particle forces to be reckoned with.
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.
When a user is first learning about particles, there is often some confusion in choosing which force to use in which situation. Initial velocity, the Force POP, the Wind POP and the Fan POP are similar in that they all affect the velocity of a particle; however, they each do so in a slightly different way and so are appropriate for different situations. Lets look at each now in order to minimize possible confusion.
Initial velocity is the velocity that particles are born with, basically a pre-existing velocity, like the velocity the ignited gunpowder imparts to a bullet. The bullet isnt being continuously pushed forward; it has been born with a certain velocity and will slow down over time if there is resistance, like the friction of air, to its motion. This velocity can either be set explicitly, inherited from a birthing source if one is being used or a combination of the two. You can set these parameters on the Attributes tab of the relevant generator POPs.
Explicitly Set Initial Velocity
- 1. At the object level, ensure a geometry object exists and jump into it.
2. Drop a Popnet and dive into it.
3. Drop a Location POP. Reset the playbar and then play the simulation. You can see that a large number of points are flying off in all directions. If you cant see the simulation, you may need to home the viewport and/or turn on the display of points to more clearly see what is happening.
4. As always in Houdini, if you want to get to a clearer understanding of what is happening, simplify the conditions to zero in on what you are examining. In this case, go to the Birth tab and lower the Constant Birth Rate to 1. Now, one particle will be birthed per second. Press play and view the simulation.
5. You have fewer particles now but they are still flying off in various directions. Go to the Attributes tab and change Variance in X, Y and Z to zero. View it again and now the particles dont move. In fact, it appears there is only one particle. In truth, you have the same number of particles as before. They just arent going anywhere and so are overlapping each other. Turn on the display of point numbers and view the simulation from the beginning. Now you can see the point number zero by itself. Then, at frame 31, another particle is born and the number 1 is laid over the zero to accompany it.
6. Enter a value of -1 in the Velocity parameters Y field and view the simulation. You may need to dolly out to see the system better. Each particle is now born with a velocity of negative one in the Y axis and so is instantly moving at that speed and in that direction when it is born. To verify this, RMB on the icon of the Location node and choose Spreadsheet.
7. You can see each of the particles has quite a few point attributes. MMB on the nodes icon and you can see that each of the attributes listed in the popup window is available for viewing in the Geometry Spreadsheet pane. Narrow the range of display by LMB on the button that says Show/Hide Attributes and choose Hide All Attributes. Now, none of the attributes are shown. LMB again on the selector and choose v (for velocity) and then again on accel (for acceleration).
8. Reset the system and you can see that each particle is born moving at a velocity of -1 in the Y axis. You can also see that they are neither accelerating nor decelerating because all of the accel fields are zero. The reason they are staying at a constant velocity is because there are no additional forces neither speeding the particles nor slowing them down.
Inherit Initial Velocity
You have just seen how to explicitly set the initial velocity. If you are birthing from a source geometry, you can also set the particles to inherit their velocity from the source. If set to inherit velocity, POPs will look for the velocity and point normal attributes of the source geometry and use one of them to set the systems initial velocity. If the source doesnt have either attribute, no initial velocity will be set (or, a value of 0 will be set in all three axes). If the source contains only one of the attributes, that attribute will set the initial velocity. If the source contains both attributes, the velocity attribute will override the point normal attribute. Lets saunter through a little example to see these ideas in action.
- 1. Assuming you just finished the last example, delete the Location POP and lay down a Source POP. Before this POP will work, you need to create some geometry back up at the SOPs level and then come back to POPs and reference it.
2. Jump back up into SOPs and lay down a Grid SOP (unconnected to the Popnet). All of the defaults are fine. Jump back into the popnet.
3. On the Source tab of the Source POP, find the SOP parameter and select the grid you just created. Next, go to the Attributes tab and verify that Initial Velocity is set to the default Use Inherited Velocity. If necessary, reset and then view the simulation. Particles are being born; however, they arent doing much of anything else. That is because they are inheriting velocity but there are no attributes to inherit.
4. Jump back up to the SOP level and MMB on the icon of the Grid node. You can see that there are no attributes listed. As stated earlier, the Source POP is looking for either a velocity or a point normal attribute. Give the grid a velocity attribute and see how it affects the simulation. Append a Point SOP to the grid node and rename it addVelocity. Go to the Particle tab and change Keep Velocity to Add Velocity. Next RMB on the velocity label and choose Delete Channels. Now set the Y axis field to 1. You have just created a velocity point attribute for every point in the grid. If you scrub through the frame range, you can see the grid isnt actually moving anywhere. You didnt animate it up in Y with a value of 1. You just created a point attribute called v (or velocity) and gave it a value of 1. This is basically just a characteristic that each point now has which POPs can read and use for particle velocity.
5. Drop into the popnet and change the source SOP to the point operation you just created. View the simulation and you can see the particles are now flying up in the positive Y axis.
- 6. You can do the same thing with a point normal attribute. Go back up to SOPs and append another point operation and rename it addPointNormal. On the Standard tab, change Keep Normal to Add Normal. RMB on the Normals label and choose Delete Channels. Then enter a value of
in the Y field. MMB on the nodes icon and you can see you now have two point attributes being v (for velocity) and N (for normal). Your network editor should now look like Figure 1.
RMB on the addPointNormal node and choose Spreadsheet. Hide all Attributes and then select the v and N attributes for viewing. You can now see that every point has these attributes and the values you set for them.
7. For now, toggle on the bypass flag of the addVelocity node so that the popnet wont see it. MMB on the addPointNormal node and you should no longer see the v attribute listed. That is because you bypassed and are no longer cooking the node that added the velocity attribute. Jump into the popnet and change the Source POP to birth from the addPointNormal node. Reset the simulation and view it. The particles are now going up in Y at a slower velocity. POPs is reading in the point normal attribute and using it to set the initial velocity.
8. Now jump back up to SOPs and toggle off the bypass flag of the addVelocity node. Go back into the popnet and view the system. The particles are now going up faster again at a velocity of positive 1 in Y. This illustrates the fact that if POPs finds both the v and N point attributes in the source geometry, the v attribute will override the N attribute.
- Why are both attributes able to be inherited instead of just one? They seem to be functioning similarly in this example. Lets change the example a little and see how each attribute can be helpful in its own way.
9. Jump back up to the SOP level and delete the grid node. Lay down a Sphere SOP, change its Primitive Type to NURBs, and connect it in place of the grid. Make sure you connect it to the left input of the addVelocity node.
10. Ensure the display and render flags are on the addPointNormal node. Turn on the display of point normals in the viewport. You may have to zoom in on a particular point to see its normal. Alternatively, change the 0.1 to 1 and you will now visually see that all the point normals are straight up in the world Y axis. If you ran the particle simulation from this source, particles would be born from each point and travel upward as you just did previously with the grid. RMB on the Normals label of this node and choose Revert to Defaults. Notice the difference in the point normals. Each now juts out as if running from the spheres origin through the point. Figure 2 shows this.
11. Toggle on the bypass flag of the addVelocity node so it doesnt override the N attribute. Jump into the popnet and view the simulation. Particles are now shooting off in all directions instead of just going up in Y.
- 12. Next, lets change the example a bit and see how inheriting the velocity can be interesting. Jump back up to SOPs and insert a Transform operation after the sphere. Place the display and render flags on it. Change Pivot in X to 2 to offset the rotation a bit. Enter
sin($F*5)*50 in the Rotate Y field. Scrub through the animation and you can see the sphere is now swinging back and forth.
13. Go to the addVelocity node toggle off the bypass flag. Then RMB on the Velocity label and choose Revert to Defaults. Each point is now set back to whatever its default is coming into that node. RMB on the nodes icon and choose Spreadsheet. Scrub through some frames and you can see that velocity is zero across the board. So, even though the sphere is moving around, there is nothing yet that is measuring that movement.
14. Introducing the loveable and powerful Trail SOP! Insert one after the transform node. You will use this SOP to measure the movement of each point in the sphere and assign an appropriate velocity. Change the Result Type parameter to Compute Velocity. RMB on this nodes icon and choose Spreadsheet. Scrub through some frames and you can see it has measured each points individual movement and assigned the calculated velocity. Can you say, Yum Yum? Your network should now look like Figure 3.
15. Jump into the popnet and run the simulation. Amazing sweetness cubed, Batman! The particles now inherit the velocity of the point at the time of their birth. The simulation mimics how sweat would fly off as you shake your head in mental exhaustion.
Find out more about how to apply each of Houdini's 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, he 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.