Professional Documents
Culture Documents
In this lesson, you will learn about Houdinis dynamics environment. Starting with Houdinis rigid body dynamics, you will explore the setup of a simulation and the application of forces and constraints. RIGID BODY DYNAMICS Rigid body dynamics involves the collisions that occur between solid objects. The objects are affected by forces such as gravity and the impact of other objects that collide with them. You can also create rigid body objects that break up after they are involved in a strong enough collision. In these cases, the object is made up of pre-fractured geometry that is ready to break apart with an RBD glue parameter being used to define how the cracks hold together until impact.
Software Version: 8.0.383 Published on: 20 October 2005 Level: Basic
CLOTH You will learn how a simple cloth simulation uses a similar approach to the rigid body simulation. Using the example of a table cloth settling onto a table, you will explore how to set up the collision of cloth and passive RBD objects.
SETUP
To get started, you will open an existing scene file which includes pre-built objects ready to be integrated into a series of dynamic simulations. 1. DOWNLOAD THE SUPPORT FILES Along with the PDF, you can access the support files for this lesson at www.sidefx.com > Learning > Tutorials. This lesson is listed as Dynamics Quickstart and includes a scene file called dynamics_start.hip. Set up a tutorials directory in your $HOME directory or any other easily accessible place and put the support file in there. 2. LOAD THE START FILE Select File > Open and use the File browser to find and load the dynamics_start.hip file. The scene opens to show a ball, a table, and a vase. You will use these objects in your simulations. There is also a hidden table cloth object that you will use later for a cloth simulation.
Main Menu Parameter Pane
2. GO INTO THE NETWORK MANAGER Press i to go into the dynamics (DOP) network. Even though you can still see all the objects, you are now working at a different level of your scene which describes a dynamics environment. If you dont see the table, ball and vase, select View > See All Objects from the Viewer pane menu. You can also use the Spacebar - e hotkey combination in the Viewer pane to toggle the objects on and off or you can click on the See One/All Objects button in the lower right of the Viewer pane on the Viewer Control bar.
In the Viewer pane, press tab > RBD Object. Click on the ball to select it then RMB-click to accept. In the Network pane, rename this dynamics operator rbd_ball. Even though the ball was outside of your dynamics network, you were able to select it and bring it into the dynamics environment as an RBD object.
In Houdinis dynamics environment the networks define how objects, forces and solvers are connected together. The order of the nodes does not define a direct flow from top to bottom in the same way as other parts of Houdini. For instance, it doesnt actually matter whether the gravity is in front of the RBD solver or the other way around because either way it will be part of the simulation. The important fact here is that they RBD object is being fed into the solver. 6. TEST THE SIMULATION In the playbar, set the End frame to 75 then press Play. The ball is now being affected by gravity and falls to infinity.
This new handle lets you orient the velocity and set its strength. RMB-click on the handle and select Align with X axis. Now drag the circle-shaped strength handle to increase the velocity.
Dynamics QuickStart 3
Press Play to view the simulation. The ball now moves laterally then falls down and bounces on the ground surface. When you are finished, hide the Velocity handle and go back to the Transform handle using the handle controls. You can also set the velocity in the Parameter pane. Under the Initial State tab, set the Velocity in X to 2. This will give the ball a specific value for the initial velocity.
In the Parameter pane, set Create Active Object to Off. This will make the object passive.
COLLISIONS
In addition to colliding with the ground, you can collide with other objects such as the table. You are going to bring in the different parts of the table as passive objects that do not react dynamically. Then you will explore what happens when you make them into active objects that do react dynamically. 1. ADD THE TABLETOP AS A PASSIVE OBJECT Toggle See One/All Objects to see the objects. You will now see two balls. The object-level ball is on the ground where you originally found it. the rbd_ball is floating over the table and possibly intersecting with the vase. In the Viewer pane, press tab > RBD Object. Select the tabletop then RMB-click to accept. Select the rbd_ball object to merge and RMB-click to accept.
2. ADD THE TABLE LEGS AS A PASSIVE OBJECT In the Viewer pane, press tab > RBD Object. Press the Shift key, select the four legs of the table then RMB-click to accept. Click on the rbd_ball object to merge and RMB-click again.
In the Network pane, select the new RBD Object and rename it
rbd_tablelegs. The legs are set up as one RBD object node and
it is connected to the network using a new merge.
1. Select the tabletop as the RBD Object
In the Network pane, select the new RBD Object and rename it
4. HIDE THE GROUND PLANE PROXY GEOMETRY In the Network pane, select the groundplane node. In the Parameter pane, set the Display Proxy Geometry checkbox to Off. This hides the visible geometry while the ground remains part of the simulation. Hiding it will make it easier for you to home your view [h] and focus on the table. 5. RE-POSITION THE BALL Toggle See One/All Objects to hide the objects outside the dynamics network. In the Network pane, select the rbd_ball then in the Viewer pane move it along the X axis until it is a little to the left of the table.
Dynamics QuickStart 5
Press Play. The ball hits the tabletop and the collision makes the table collapse. This is because the tabletop and tablelegs are working independently.
Because both the tabletop and the tablelegs are selected, they both get more dense and better represent their target shape.
Set Show Collision Guide Geometry to Off and in the Viewer pane, press w to go back to a shaded display. 2. DISPLAY THE COLLISION GUIDE GEOMETRY With your cursor in the Viewer pane, press w to go to wireframe mode. in the Network pane, select the rbd_tabletop and rbd_tablelegs nodes. In the Parameter pane, click on the Collisions tab and under Volume, set the Show Collision Guide Geometry checkbox to On. Press Play. The ball hits the tabletop and depending on where your ball is to start, the collision may make the table move but not collapse. The legs wobble but they dont fall down. Otherwise they may collapse again because they are still working independently. In either case, it would be better if there was a more solid connection between the tabletop and the tablelegs. Tip: You can press the Escape key to stop a simulation at any time. Then you can then use Ctrl - Up Arrow to go back to frame 1 and start again.
4. GLUE THE LEGS TO THE TABLETOP Click on the rbd_tablelegs Glue tab. In the Glue to Object field, enter rbd_tabletop. Leave Glue Strength set to -1 which represents an infinite strength. By default, Houdinis RBD solver uses a volume representation of each object for collision detection that results in fast collisions that are tolerant of temporary interpenetrations. To visualize this volume you can display it then adjust the number of divisions on the guide geometry to better match it to the model. 3. INCREASE THE GUIDE GEOMETRY DIVISIONS In the Parameter pane, click on the Collisions tab. Under Volume, set the Divisions in Y to 30. Press Play to run through the simulation. The ball hits the tabletop and the table jerks a bit but the legs stay fixed to the tabletop. The Glue value is holding the parts together. If you set a positive Glue Strength then the table will hold together until the impact is too much and the parts break apart. For the table, an infinite strength works best.
vase to select it then RMB-click to accept. Click on the rbd_ball object to merge and RMB-click to accept.
2. Select rbd_ball to merge
Set the Divisions in X, Y and Z to 30. Now the vase collision geometry is a better match for the model. Set Show Collision Guide Geometry to Off.
In the Network pane, select the new RBD Glue Object and rename it rbd_glue_vase. You will notice that it is connected to the network using a new merge and it appears at the origin. Toggle See One/All Objects to focus on the simulated objects. Use the handles in the Viewer pane to drag the vase back up to the table. 3. RUN THE SIMULATION Press w to go to back to shaded display. Press Play to run the simulation. Before the ball even hits the vase it begins to crack. The Internal glue strength is not strong enough to hold the pieces together and the gravity force is pulling the vase apart.
Dynamics QuickStart 7
4. SET AN INFINITE GLUE STRENGTH In the Parameter pane for the rbd_glue_vase object, click on the Internal Glue tab and set Glue Strength to -1. This will create an infinite strength. Press Play to run the simulation. The vase now holds together but does not crack when the ball collides with it or when it hits the ground. 6. CLEAN UP THE NETWORK By working in the Viewer pane, all the different RBD objects feeding into the solution are using different merge nodes. While this works fine, you may want to feed all the nodes into a single merge in order to clean up the network. In the Network pane, select the top three merge nodes and press Delete. Now select all of the RBD and RBD Glue objects that are no longer connected. Click on one of their outputs then click on the input to the remaining merge node. Merging all of these objects with a single merge will provide the same result as before. The only difference is that your network view is a little more organized than before.
5. SET A NORMAL GLUE STRENGTH Set the Glue Strength to 20 then press Play to run the simulation. The vase now holds together until the ball collides with it and it cracks.
Select the switch_balls node and set the Select Input to 1. This will let you work with the second rbd_pendulum object.
2. ADD A RBD CONSTRAINT TO THE BALL In the Viewer pane, press tab > RBD Constraint. Select the rbd_pendulum ball and RMB-click to accept. A red constraint pivot appears at the origin and an rbdconstraint node is inserted in the dynamics network between rbd_pendulum and the switch node.
Select the rbd_pendulum node in the network pane. In the viewer pane, translate the object to create a nice swing path around the pivot then rotate the ball so that its main axis points at the pivot.
Dynamics QuickStart 9
Press spacebar-1 in the Viewer pane to go back to a perspective view and press Play to run the simulation. The ball now swings around the constraint pivot and hits the vase which then breaks apart.
Select the switch_balls node and set the Select Input to 2. This will let you work with the new rbd_keyframe ball. The ability to set up a switch node shows the flexibility afforded by Houdinis procedural approach. Within a single solution, you can easily set up alternative approaches then simply switch between them for comparison. 2. MOVE THE OBJECT BACK TO THE ORIGIN Select the rbd_keyframe ball. In the Parameter pane, RMBclick on the Position parameter name and select Revert to Defaults. Repeat for the Velocity parameter. This will move the object back to the origin and remove any initial velocity. 3. ADD AN RBD KEYFRAME ACTIVE DOP In the Viewer pane, press tab > RBD Keyframe Active. Select the rbd_keyframe ball and RMB-click to accept. An rbdkeyactive1 node is inserted in the dynamics network between rbd_keyframe and the switch node. This dynamic operator lets you keyframe the active/passive state of your object. 4. KEYFRAME THE BALLS INITIAL POSITION Select the rbdkeyactive1 node. In the Parameter pane, set the Object Active Value parameter to 0. In the Viewer pane, position the ball up above the table and the vase. Make sure you are at Frame 1. In the Parameter pane, press Alt and click on the Position parameter label to keyframe all three parameters. Use the same method to keyframe the Object Active Value parameter. The parameter fields will turn green to indicate that they are keyed.
10
This will let you move the balls handle without the simulation being evaluated but the ball will not immediately follow. Click the Update button to position the ball when you have finished moving the handle. Once it is in place DONT FORGET to click twice on the Never button to change it back to Always. Otherwise you wont see anything update as you work. Position the ball just next to the vase in the position you want. Set the Object Active Value parameter to 1. Use the Alt key to keyframe the Position and Object Active Value parameters.
Click on the arrow icon next to Function in the lower right of the Channel editor, select EaseIn. Now the ball starts slow then speeds up until it is released at frame 10.
Go back to Frame 1. If the ball doesnt go back then you probably forgot to set the Update button back to Always. Play the simulation to see what happens. The ball animates using keyframes then is released into the simulation. The velocity coming out of the keyframes seems a little light. This is because of the shape of the animation curves. 6. ADJUST THE ANIMATION CURVES RMB-click on the Position parameter label and from the popup menu, select Scope Channels. This will open a Channel editor showing the three animation curves. Press h in the Channel editor to home in on the three curves. As you can see their slopes flatten out at the end which means there is not a lot of velocity when the ball is released from the animation. Select the three curves to see that they are using a cubic () Function. Play the simulation. The ball is controlled by the keyframes from frame 1 until 10 then the dynamics take over.
Dynamics QuickStart 11
In the Viewer pane, press spacebar-d. Turn on the Object names display option. This will display the actual names of all the objects in your scene.
Find the vase4 piece. It is called rbd_dopnet:vase4/Geometry. You will use this name to grab the piece for keyframing.
vase4/Geometry
3. COPY OUT A PIECE OF THE SIMULATION As you playback the simulation all of the objects, several of the vase pieces drop to the ground. If you want to determine exactly where one of these will land, you must first Fetch that piece into a separate geometry object. In the Network pane, press tab > Geometry to create a new geometry object. Rename it fetch_vase. Press i to go into it and delete the default file SOP.
Play the simulation. Now the simulation has been saved to disk. Once it is finished, change the File nodes Operation Mode to Read Files. Now the simulation saved to disk will be used to during playback. 2. VIEW THE SIMULATION AT THE OBJECT LEVEL Press u to go back up to the Object level. Right now the original objects and the simulated versions of the objects are visible. Select the tabletop, all the tablelegs, vase and ball objects and set their Display flags to Off.
In the Network pane, press tab > Object Merge and place the node. Select this node and in the Parameter pane, set Object 1 to /obj/rbd_dopnet:vase4/Geometry. Toggle the See One/All Objects option to only see the merged piece. 4. COLOR THE FETCHED PIECE In the Viewer pane, press tab > Color. Press a to select all the faces of the merged piece and RMB-click to accept. In the Parameter pane, change the Color to 1, 0, 0 to make it red. This will help you distinguish this piece from the original. Press u to go back up to the Object level. The original piece and the new piece of the vase are moving together with the simulation. Press spacebar-d and turn off the Display of the object names.
12
Scrub in the playbar to a frame where the fetched piece has settled on the ground. The objects handle is at the origin which makes it appear offset from the piece. Use this handle to move the piece to a different position closer to the table. You should only reposition it. Rotating or scaling this piece would not work well. Press k to keyframe this position.
Dynamics QuickStart 13
SETUP
For the cloth simulation, you can create a new dynamics network manager that references the same objects as the RBD simulation. For the table cloth example you will re-use some of the objects from your RBD network and add in a tablecloth. Before starting this new network, you should take a look at the tablecloth geometry that you are going to use. 1. EXAMINE THE TABLE CLOTH GEOMETRY Select the tablecloth object and press i to go into it. It is made up of a flat closed curve that is triangulated. Use the Display flags to compare the cloth_geo_hi and cloth_geo_low Triangulate 2D operators. You may also want to choose View > Shading > Smooth Wire Shading in the Viewer pane to see the topology.
cloth_geo_low
cloth_geo_hi
These triangulate nodes are breaking the geometry into triangles that work best for cloth simulations. You will use the low resolution model for testing then the higher resolution model for the final tablecloth. 2. CREATE A NEW DYNAMICS NETWORK MANAGER
Press u to go back to the Object level. Turn Off the Display flag for the rbd_dopnet and the fetch_vase object. In the Network pane, press tab > DOP Network. Click to place the network node down. Name it cloth_dopnet. 3. GET COLLISION OBJECTS FROM RBD NETWORK Select the rbd_dopnet and press i to go into it. Select the rbd_tablelegs, rbd_tabletop and groundplane nodes then press Ctrl-c. Press u to go back up to the Object level. Select the cloth_dopnet and press i to go into it. Press Ctrl-v to paste the rbd nodes into the cloth network.
CLOTH DYNAMICS
Now that you have learned how to set up an RBD simulation, you can apply what you have learned to a simple cloth simulation. Using the example of a tablecloth you will see how the general approach is the same with a few subtle differences.
14
CLOTH DYNAMICS
1. CREATE A LOW RESOLUTION CLOTH OBJECT Go to Frame 1. In the Network pane, press tab > Cloth Object. Click to place the node. Rename this node clothobject_low. In the Parameter pane, click on the [+] next to SOP Path and navigate to the tablecloth object and select the cloth_geo_low geometry operator. 4. SET THE TABLE CLOTHS START POSITION Select the clothobject_low node. In the Parameter pane, go to the Initial State tab and set the Position in Y to 1.25. This will raise it above the table in preparation for letting it settle.
Click on the Collisions tab and set the collision Model to Coarse. This will create a faster, less accurate simulation. Later you will crank up the quality once you are happy with your setup. 2. SET THE TABLETOP COLLISION GEOMETRY Select the rbd_tabletop node. In the Parameter pane, Click on the Collisions tab and under Volume set the Divisions to 30, 10, 30. This will put more detail at the corners where the cloth might slide too much. If you want to see the difference, use the Show Collision Guide Geometry option.
5. ADD GRAVITY In the Network pane, press tab > Gravity and click to place the node. Connect the merge node to the gravity node then set the Display flag for gravity. 6. ADD A CLOTH SOLVER In the Network pane, RMB-click on the output of the clothobject and select Cloth Solver. Click to place the node. This puts a cloth solver between the clothobject and the merge. By keeping the tabletop and tablelegs objects outside the solver they will act as passive objects even if they have their Create Active Object parameter turned on. You will notice that the gravity is below the solver. As long as its display is set, it will get used in the resulting simulation.
after
In the Network pane, press tab > Merge and click to place the node. Now select the clothobject_low, rbd_tabletop and rbd_tablelegs nodes then click on the output of any of these nodes and the input of the merge node. Dont merge the groundplane node right now since the tablecloth will stay on the table. Set the Display flag for the merge node to display the tablecloth and the table.
Note: In the Houdini dynamics architecture. the solver sets the behaviour for any objects feeding into it. It is important to network the tabletop and tablelegs after the cloth solver otherwise they risk having their behaviour changed and then they will begin acting like cloth objects.
Dynamics QuickStart 15
7. RUN THE SIMULATION In the playbar, set your Time range from 1 to 60. Play the simulation. The cloth drops and settles on the table.
16
CONCLUSION
Select the merge node and make sure that Affector Relationship is set to Left Inputs Affect Right Inputs. This will make the ball push the cloth but the ball itself will not react to the cloth. 5. SET UP THE RBD BALL Select the rbd_ball node. In the Viewer pane, press enter to bring up the handle then move the ball along the positive Z axis to the side of the table then raise it up so that it is still below the tabletop but will collide with the cloth.
In the Parameter pane, set a negative value such as -8 for Velocity in Z to propel the ball along the Z axis towards the table. Now set the Creation Frame to 40. The ball disappears and will not come back until frame 40. This will give the cloth time to settle before the ball appears. 6. RUN THE SIMULATION AT BOTH RESOLUTIONS In the playbar, set your Time range from 1 to 80. Play the simulation. The cloth settles then at frame 40 the ball appears and begins moving. When it hits the cloth it is pushed. Depending on how you set up the ball, the cloth might even be pushed off of the table and onto the floor. Go to frame 1. Select the switch node and set Select Input to 1. Now play the simulation to see higher quality results.
CONCLUSION
You have now created a rigid body simulation and a cloth simulation using a variety of objects, forces and solvers. Houdinis dynamics environment gives you the tools you need to set up and run simulations procedurally. You have also taken advantage of special features found in the Houdini dynamics architecture. RBD glue provides a great way to deal with the fracturing of objects while the ability to have two solvers interact with each other lets you combine different solvers into a single simulation.
Dynamics QuickStart 17
LEARNING MORE
There is certainly more to learn about dynamics in Houdini. A great way to continue your learning is to use the example files that are part of Houdinis documentation. To access these, open up the Help browser by either clicking on the ? icon in the top right of the desktop, selecting Pane > Help Browser from any pane menu or by selecting Help > Help Contents from the main menu. Once you are in the browser, you can click on Operator Examples > Dynamics operators from the home page. Here you will find many examples that you can load and learn from. Each example can be examined by exploring the Network nodes and seeing how they are linked together. To help you further, some examples include notes on the operator nodes that can be read by MMB-clicking on the node tile in the Network pane. In the Parameter pane, you can also see which parameters have been changed from their defaults because they will be either bolded or, in the case of checkboxes and menus, highlighted with a small dot.
18