18
Software Version: 8.0.383 Published on: 20 October 2005 Level: Basic DYNAMICS QUICKSTART In this lesson, you will learn about Houdini’s dy- namics environment. Starting with Houdini’s rig- id 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 af- fected 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 be- ing used to define how the cracks hold together until impact. CLOTH You will learn how a simple cloth simulation uses a similar approach to the rigid body simu- lation. 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.

Hoidini Software - Dynamics Quickstart

  • Upload
    vixtr

  • View
    36

  • Download
    1

Embed Size (px)

DESCRIPTION

In this lesson, you will learn about Houdini’s dynamics environment. Starting with Houdini’s rigid body dynamics, you will explore the setup of a simulation and the application of forces and constraints.RIGID BODY DYNAMICSRigid 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 beingused to define how the cracks hold together until impact.CLOTHYou 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.

Citation preview

Page 1: Hoidini Software - Dynamics Quickstart

DYNAMICSQUICKSTART

Software Version: 8.0.383Published on: 20 October 2005Level: Basic

In this lesson, you will learn about Houdini’s dy-namics environment. Starting with Houdini’s rig-id 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 af-fected 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 be-ing used to define how the cracks hold together until impact.

CLOTH

You will learn how a simple cloth simulation uses a similar approach to the rigid body simu-lation. 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.

Page 2: Hoidini Software - Dynamics Quickstart

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 les-son 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.

RIGID BODY DYNAMICSThe dynamics architecture in Houdini lets you work with a number of different solvers. One of the main solvers is the rigid body dynamics solver which lets you simulate the interactions between solid objects.

The ultimate goal of this lesson is to throw a ball at a vase that is sitting on a table and break it into pieces.

SETTING UP A RIGID BODY SIMULATION

To create a rigid body simulation, you can bring objects into a dynamics environment then set up a network that will combine objects, forces and solvers.

In this part of the lesson, you will build the dynamics network using primarily the Viewer pane. Be sure to refer to the Network pane to see how the dynamic nodes are being connected.

1. CREATE A DYNAMICS NETWORK

In the Network pane, press tab > Generators >DOP Network. Click to place the network node down. Name it rbd_dopnet.

Tip: In Houdini, the tab key gives you access to your tools. After pressing tab, you can either find the tool through the sub-menus or simply begin typing the name. For instance for the DOP Network you can start typing d... and the tools that start with d show up. For the rest of this lesson, you will be told the name of the tool but not its sub-menu therefore the keyboard method should be used.

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 differ-ent level of your scene which describes a dynamics environ-ment. If you don’t 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.

3. CREATE A RBD OBJECT FOR THE BALL

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.

Network Pane

Main Menu

Viewer Pane

Parameter Pane

Playbar

See One/All Objects

Bypass Flag

Display Flag Output

2

Page 3: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

Like other operator node tiles in Houdini, the dynamics operator has a Bypass flag if you want it be ignored, a Display flag for tagging it as the focus of the network and Input/Outputs for making network connections.

4. ADD A SOLVER

Toggle See One/All Objects to turn off the display of the objects that are not part of the dynamics environment. In the Viewer pane, press tab > RBD Solver. Click on the ball to select it then RMB-click to accept. This adds a solver to the ball but currently there are no forces being applied that would drive a simulation.

Tip: When you are using tools in the Viewer pane, be sure to check the Prompt line found at the bottom of the desktop for instructions. This will help you discover any steps you might have to take to use the tool. After you have followed the instructions you will always RMB-click to accept.

5. ADD GRAVITY

In the Viewer pane, press tab > Gravity Force. Click on the ball to select it then RMB-click to accept. This will put a gravity DOP between the solver and the ball.

In Houdini’s 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 doesn’t 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.

7. ADD A GROUND PLANE

Go to Frame 1. In the Viewer pane, press tab > Ground Plane. Click on the ball to merge it with the new ground plane then RMB-click to accept. This creates both a groundplane node and another merge node in the network.

8. POSITION THE BALL

In the Network pane, select the rbd_ball object. In the Viewer pane, use the handle to drag it up above the ground plane. This Position overrides the original object-level position and makes it easier to get the position just right for the simulation.

9. ADD SOME INITIAL VELOCITY

You can also add some initial velocity to the ball. Go to the Selector and Handle Control bar on the left side of the Viewer pane. On this bar you will see two icons. One is for the RBD object’s transform handle and the hidden one is for the Velocity handle. Hide the transform handle and reveal the Veloc-ity handle using these toggles.

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.

Transform HandleVelocity Handle

Drag Velocity Strength Handle

Dynamics QuickStart 3

Page 4: Hoidini Software - Dynamics Quickstart

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 Trans-form 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.

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 dif-ferent 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 pos-sibly intersecting with the vase.

In the Viewer pane, press tab > RBD Object. Select the table-top then RMB-click to accept. Select the rbd_ball object to merge and RMB-click to accept.

In the Network pane, select the new RBD Object and rename it rbd_tabletop. You will notice that it is connected to the network using a new merge.

In the Parameter pane, set Create Active Object to Off. This will make the object passive.

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.

2. Select rbd_ball

1. Select thetabletop asthe RBD Object

to merge

2. Select rbd_ball

1. Select all thetablelegs asthe RBD Object

to merge

4

Page 5: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

3. SET PARAMETERS FOR THE TABLELEGS

In the Parameter pane, you can see that the Number of Objects has been set to 4 and all of the leg objects are being referenced. By default the legs will all be given the same name. Add $OBJ to the end fo the Object Name expression to so that it now reads ‘opname(“.”)‘$OBJ. This will give each tableleg a unique name when it runs through dynamics simulations.

In the Parameter pane, set Create Active Object to Off. This will make the legs passive as well.

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.

Press Play to simulate the ball hitting the table. Because the parts of the table are not active, the ball bounces off of them but the table does not move. If you don’t like the way the ball is bouncing, place the ball a little further back or a little higher. You might also want to increase the initial velocity.

6. SET SUBSTEPS FOR THE SIMULATION

If you look closely at the simulation, especially from the side, the ball does not actually collide with the top of the table. This is because the actual collision should be taking place between frames but the ball can’t reach that point. You need to add some substeps to get more accurate collision results.

Select the rbdsolver node and in the Parameter pane, set the Minimum and Maximum Substeps to 2. This value may need to get higher if your objects were moving faster.

7. PLAYBACK THE SIM CACHE IN REAL TIME

Click on the Global Animation Options at the right end of the playbar. In this window, set Realtime Behaviour to Play every frame, but never faster than FPS. Press Save as Default. Now turn On the Real Time Toggle in the playbar.

Play the simulation. The ball hits the table more accurately.

When you playback a simulation, the first time through the simu-lation is being cached. After that, playback is faster and you can even scrub through the results to evaluate the look of the simula-tion. As your simulations get more complex, the initial caching will take longer but the subsequent playbacks will be more inter-active. The Realtime Behaviour setting used here will make sure that the initial simulation plays every frame but that the cached version never goes faster than the chosen frames per second.

MAKING THE TABLE ACTIVE

The table is currently made up of a tabletop object and a tableleg object. If you make them active then they will act like live objects and will react to the impact of the ball. At first this will simply result in the table falling apart. To keep the parts of the table together you will need to set up some RBD glue.

1. MAKE THE TABLE PARTS ACTIVE

Press Ctrl - Up Arrow to go to Frame 1. You should always go to frame 1 before you start fiddling with the network or parame-ters otherwise objects may not appear correctly.

In the Network pane, select both the rbd_tabletop and rbd_tablelegs nodes. Set the Create Active Object checkbox to On.

Move the ballalong the-X axis-

Dynamics QuickStart 5

Page 6: Hoidini Software - Dynamics Quickstart

Press Play. The ball hits the tabletop and the collision makes the table collapse. This is because the tabletop and tablelegs are working independently.

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 Colli-sions tab and under Volume, set the Show Collision Guide Geometry checkbox to On.

By default, Houdini’s RBD solver uses a volume representation of each object for collision detection that results in fast colli-sions that are tolerant of temporary interpenetrations. To visual-ize 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 Vol-ume, set the Divisions in Y to 30.

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.

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 don’t fall down. Other-wise 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.

Press Play to run through the simulation. The ball hits the table-top and the table jerks a bit but the legs stay fixed to the table-top. 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.

6

Page 7: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

SIMULATING A CRACKED VASE

You have just used RBD glue to hold together two different RBD objects. You can also bring in geometry that has already been broken up into connecting pieces of geometry then use an inter-nal glue value to hold them together until a force is applied or a collision occurs.

1. ADD THE VASE AS A RBD GLUE OBJECT

Go to Frame 1. Select View > See All Objects from the pane menus to show the object level within the dynamics network.

In the Viewer pane, press tab > RBD Glue Object. Click on the vase to select it then RMB-click to accept. Click on the rbd_ball object to merge and RMB-click to accept.

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.

2. ADJUST THE COLLISION GUIDE GEOMETRY

With your cursor in the Viewer pane, press w to go to wireframe display and zoom closer to the vase. You can see that this geom-etry has built-in cracks. In fact, it is made up of several pre-cracked volumes that can be broken apart during the simulation.

Click on the rbd_glue_vase object’s Collisions tab and under Volume, set the Show Collision Guide Geometry checkbox to On. You can see that with this complex shape the default guide geometry is almost not there at all.

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.

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 pull-ing the vase apart.

2. Select rbd_ball

1. Select all thevase as theRBD Glue Object

to merge

Dynamics QuickStart 7

Page 8: Hoidini Software - Dynamics Quickstart

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.

5. SET A NORMAL GLUE STRENGTH

Set the Glue Strength to 20 then press Play to run the simu-lation. The vase now holds together until the ball collides with it and it cracks.

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.

8

Page 9: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

CREATING A WRECKING BALL

To create a pendulum effect for the ball, you can add an RBD constraint that will let you define the constraint’s pivot.

1. COPY THE RBD BALL OBJECT

In the Network pane, RMB-click on the output of the rbd_ball node. Select DataFlow > Switch from the pop-up menu to insert a switch node after the RBD object. Rename the node switch_balls. This node will make it possible to switch between different setups for the ball.

Select the rbd_ball node. Press Ctrl-c then Ctrl-v to copy and paste the node. Rename the node rbd_pendulum. Link the out-put of the rbd_pendulum node to the input of the switch_balls node.

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.

3. ADJUST THE BALL

Press spacebar-3 in the Viewer pane to go to a front view and drag the pivot handle up above the vase.

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

Page 10: Hoidini Software - Dynamics Quickstart

Press spacebar-1 in the Viewer pane to go back to a perspec-tive view and press Play to run the simulation. The ball now swings around the constraint pivot and hits the vase which then breaks apart.

KEYFRAMING INTO A SIMULATION

In the simulations run so far, the motion of the ball has been determined by dynamics only. In cases where you want more control, you can keyframe any of the RBD objects as passive objects then switch them over to active objects when you want dynamics to take over.

1. COPY THE RBD BALL OBJECT

In the Network pane, select the original rbd_ball node. Press Ctrl-c then Ctrl-v to copy and paste the node. Rename this node rbd_keyframe. Link the output of the new rbd_keyframe node into the input of the switch_balls node.

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 Houdini’s 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, RMB-click 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 BALL’S INITIAL POSITION

Select the rbdkeyactive1 node. In the Parameter pane, set the Object Active Value parameter to 0. In the Viewer pane, posi-tion 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

Page 11: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

5. SET KEYFRAMES AT FRAME 10

Go to Frame 10. If you now drag on the Position handle in the Viewer pane, you will see that it is quite slow because the simu-lation is trying to re-evaluate along the way. In the far right of the main menu, click on the Always button to change it to Never.

This will let you move the ball’s 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 DON’T FORGET to click twice on the Never button to change it back to Always. Otherwise you won’t 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.

Go back to Frame 1. If the ball doesn’t go back then you proba-bly 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 veloc-ity 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 pop-up 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.

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.

Play the simulation. The ball is controlled by the keyframes from frame 1 until 10 then the dynamics take over.

Dynamics QuickStart 11

Page 12: Hoidini Software - Dynamics Quickstart

KEYFRAME OUT OF A SIMULATION

You have just learned how you can keyframe the active/passive state of an RBD object in order to control how an object enters a simulation. You can also control how a piece comes out of a simulation by working with it at the object level. In production this is important when you are being asked to make specific refinements your simulation and you don’t want to re-run the whole simulation.

1. CACHE THE SIMULATION TO DISK

The simulation is cached the first time you play it through and again each time you edit a parameter or change the network. You can also save the simulation to disk if you want to preserve a particular result.

In the Network pane, press tab > File. Place the file node at the bottom of the network and connect the output of the rbdsolver node into the input of the file node. Make sure the Display flag is set for the file node. In the Parameter pane, set Operation Mode to Write Files.

Click on the [+] next to File to open up a File browser. From the Jump pull down menu select $HIP. Click on the New... button and create a directory called cache. Click on the new directory to enter it. Set the File: name to rbd_table$SF4.sim and click Accept. File should now read as $HIP/cache/rbd_table$SF4.sim.

Play the simulation. Now the simulation has been saved to disk. Once it is finished, change the File node’s 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 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/Geome-try. You will use this name to grab the piece for keyframing.

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.

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 simula-tion. Press spacebar-d and turn off the Display of the object names.

Object Names Toggle

vase4/Geometry

12

Page 13: Hoidini Software - Dynamics Quickstart

RIGID BODY DYNAMICS

5. KEYFRAME THE COPIED PIECE

Scrub in the playbar until a frame just after the impact of the ball and the vase. This is where you will start to modify the piece. In the Network pane, select the fetch_vase object and press k to keyframe its position.

Scrub in the playbar to a frame where the fetched piece has set-tled on the ground. The object’s 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.

Now when you play the simulation, you can see the original piece of the base (gray) and the offset piece (red).

6. HIDE THE ORIGINAL PIECE

Scrub in the playbar until you can see the offset pieces. Select the rbd_dopnet node and under the Simulation tab, go to Dis-play Data Mask, leave the existing * which displays all the con-tents of the dynamics network manager then add ^vase4* to remove the original vase4 piece.

Now the red version is the only part of the simulation.

RENDERING DYNAMIC SIMULATIONS

To render the simulation you will need the pieces to be recog-nized as real objects. The simulation itself gives you limited render parameters therefore you will need to fetch the different parts of the simulation. This can be done using the same method as you used for the keyframed piece of the vase.

1. CREATE A NEW GEOMETRY OBJECT

In the Network pane, press tab > Geometry to create a new geometry object. Rename it fetch_scene. Press i to go into it and delete the default file SOP.

2. OBJECT MERGE ALL THE PIECES

In the Network pane, press tab > Object Merge and place the node. Select this node and set Object 1 to /obj/rbd_dopnet:rbd_keyframe/Geometry. now you see the ball. You can display node names again to verify. Click on the more but-ton to add other objects for merging. The other pieces that you need to set up for this simulation include:

• /obj/rbd_dopnet:tabletop/Geometry• /obj/rbd_dopnet:tablelegs*/Geometry• /obj/rbd_dopnet:vase1/Geometry• /obj/rbd_dopnet:vase2/Geometry• /obj/rbd_dopnet:vase3/Geometry

Dynamics QuickStart 13

Page 14: Hoidini Software - Dynamics Quickstart

• /obj/rbd_dopnet:vase5/Geometry• /obj/rbd_dopnet:vase6/Geometry• /obj/rbd_dopnet:vase7/Geometry

You didn’t merge in vase4 because you already have that piece in its own Geometry object. Once everything has been merged in then hide the dop network node. Be sure to note that the tablelegs reference uses a * to get all the legs.

3. TURN ON MOTION BLUR

Now if you want to motion blur the simulation, you can select the mantra1 render output and in the Parameter pane, go to the Standard tab, and set Motion Blur to Allow and Deformation Blur. To increase the quality of the blur, you can adjust the Super Sample settings. You can then press the Render button on the mantra1 output to see the results.

RIGID BODY OBSERVATIONS

You have now learned how to set up a rigid body dynamics sim-ulation using objects, forces and the RBD solver. You have learned how collisions work and how to set up the collision guide geometry.

You have also learned how to use the RBD glue to hold different objects together or to crack apart a pre-fractured object. While this example used simple geometry, the same rules would apply to more complex simulations.

To control the look of a simulation, you learned how to set key-frames into a simulation and how to keyframe out of a simula-tion. In both cases, you are able to better direct the outcome of a simulation to meet the specific needs of a shot.

CLOTH DYNAMICSNow that you have learned how to set up an RBD simulation, you can apply what you have learned to a simple cloth simula-tion. Using the example of a tablecloth you will see how the gen-eral approach is the same with a few subtle differences.

SETUP

For the cloth simulation, you can create a new dynamics net-work 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.

These triangulate nodes are breaking the geometry into trian-gles 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 Net-work pane, press tab > DOP Network. Click to place the net-work 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.

CREATE THE CLOTH NETWORK

For this simulation, you will use the Network pane to build up your network instead of using tools in the Viewer pane. While both methods yield the same results, it is useful to explore both methods. Working in the Network pane is not as interactive as the Viewer pane, but you have a better understanding of how to place and connect the network nodes.

cloth_geo_low cloth_geo_hi

14

Page 15: Hoidini Software - Dynamics Quickstart

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.

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.

3. MERGE THE NODES

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. Don’t merge the ground-plane node right now since the tablecloth will stay on the table.

Set the Display flag for the merge node to display the table-cloth and the table.

4. SET THE TABLE CLOTH’S 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.

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 it’s display is set, it will get used in the resulting simulation.

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.

before after

Dynamics QuickStart 15

Page 16: Hoidini Software - Dynamics Quickstart

7. RUN THE SIMULATION

In the playbar, set your Time range from 1 to 60. Play the simu-lation. The cloth drops and settles on the table.

CREATE A HIGH RESOLUTION SIMULATION

To create a higher quality simulation, you will need to use a denser mesh for the table cloth and adjust the collision accuracy back to fine. The resulting simulation will be slower but yield better results.

1. CREATE A SWITCH

Go back to Frame 1. RMB-click on the output for the clothobject_low node and select Switch from the pop-up menu. Click to place it down. This will make it easy to switch between the high and low resolution cloth objects as you work with this simulation.

2. COPY THE EXISTING CLOTH OBJECT

Select the clothobject_low node and press Ctrl-c and Ctrl-v to copy and paste it. Rename this node clothobject_hi and feed it into the switch node.

Select the clothobject_hi node. In the Parameter pane, set the SOP path to the cloth_geo_hi node then click on the Collisions tab and set Model back to Fine.

3. SWITCH TO THE NEW CLOTH OBJECT

Select the switch node. In the Parameter pane, set the Select Input to 1. Now the high resolution cloth object will be used.

Play the simulation. Now you can see more accurate results as the table cloth settles on the table.

INTEGRATING THE SOLVERS

Houdini’s dynamics environment lets you have more than one solver work together in the same simulation. This integration is possible with any solver type available in Houdini. For this les-son, you will bring in an RBD ball and throw it under the table where it will collide with the tablecloth.

1. SWITCH TO THE LOW RESOLUTION CLOTH

Select the switch node and in the Parameter pane, set the Select Input to 0. Now the low resolution cloth object will be used to test out the integration of the two solvers.

2. BRING IN THE SPHERE AS AN RBD OBJECT

In the Network pane, press tab > RBD Object. Place this node down to the left of the existing network and name it rbd_ball. In the Parameter pane, click on the [+] next to SOP Path and select the ball object.

3. MERGE WITH THE GROUNDPLANE

RMB-click on the output of the rbd_ball object and from the menu select Merge. Place this node down just under the rbd_ball node. Connect the groundplane node you brought in earlier into this merge.

4. SET UP AN RBD SOLVER

RMB-click on the output of the new merge and from the menu select RBD Solver. Place this node down.

Connect the output of the rbdsolver to the existing merge. In the Parameter pane, use the arrows to make sure the rbdsolver is to the left, the clothsolver is to the right and the tabletop and tablelegs in the center. The parts of the table will remain passive because they are not feeding through any solvers.

The same gravity node which is at the end of this network will support both the rbd and the cloth solvers. This makes it easier to make a global change to gravity that will affect all the simu-lated objects.

16

Page 17: Hoidini Software - Dynamics Quickstart

CONCLUSION

Select the merge node and make sure that Affector Relation-ship 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 simu-lation. 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.

CONCLUSIONYou have now created a rigid body simulation and a cloth simu-lation using a variety of objects, forces and solvers. Houdini’s 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 solv-ers into a single simulation.

Dynamics QuickStart 17

Page 18: Hoidini Software - Dynamics Quickstart

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 Houdini’s 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 Exam-ples > 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 opera-tor 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