Q&A: “How can I procedurally generate a crack creeping up a wall?”

| Guides | Technique | Tutorials | 03/09/2012 16:23pm
No Comments

Carlos Donis Lemus gets out his trowel of expertise to fill an unsightly gap in Natsuko Kobayashi’s Houdini knowledge

Download the supporting files for this Houdini Q&A here.

First, load Crack_on_Wall.hipnc from the files accompanying this tutorial. A few object nodes here have been created for you to get started with – camera, ground, wall, curve and crack. Dive into the crack object by clicking the node and then pressing [Enter] once selected. Drop down a Carve SOP by pressing [Tab] and typing car, which will search the operator list and display the result as you type. Select carve from the list and place it anywhere close to the IN_curve SOP.

Connect the newly placed carve1 SOP input to the IN_curve output. In the carve1 properties pane, untick to disable First U and enable Second U. With the timeline at frame 1, type in 0.001 and then hold down [Alt] and click that field to set a keyframe. Scrub the timeline to frame 120, type 1 and repeat the process to add key. Add a UV Texture SOP to the network and set its parameter Projection Axis to Z axis. Follow that up with a point SOP and change Keep Color to Add Color, then right-click Color and select Delete Channels. Enter the expression 1-$MAPV in its first field, then zero out the others to only apply a value in the red channel. This is just for a visual aid. Add an attribCreate SOP and set Name to width; Local Variable to WIDTH; Value to 1-$MAPV. These few steps will enable you to use the UV 0 to 1 value to then multiply a width factor up the curve as the carve animates, which you can then store into a width attribute. Next, add a Polywire SOP and enter the following: Wire Radius: 0.035+$WIDTH*0.05; Maximum Joint Scale: 1.9; Divisions: 6. Here you use the Width attribute so that the wire starts out thinner and gets thicker as it reaches the width value. Add a Slice SOP and set Direction to 0, 0, 1.

A fast and fun way to approach this is to create a curve, animate its reveal and prepare it so you can cut the wall with it

Next, add a Divide SOP and enable Remove Shared Edges. You end up with a profile that you can now extrude. Split the network by dropping a Polyextrude (connected to divide1) and a Merge. Set Translate to 0, 0, 1 in the polyextrude1 node’s Local tab. Connect the output of divide1 and the output of polyextrude1 to the merge1 SOP. Follow that up with a clean SOP and enable as follows: Consolidate Points; Orient Polygons.

Now add a transform SOP and set Translate to –ch(“../polyextrude1/ltz”)/2. Drop down a Cookie SOP and connect xform1 to its left input, then the node named IN_wall to the right input. Change Operation to Intersect and enable Consolidate Edges. Follow that up with a Facet SOP and enable Cusp Polygons. Clean up by adding a Clean SOP – this gets rid of any unused or unnecessary data. If you scrub the timeline, you’ll see the crack creeping up the wall – pretty neat! You can always jump into the Curve node to modify it if you want to try changing the path or bends and so on.

For your debris particles, set up a network. First, drop down a Group node, which you’ll use to identify your starting point for particles to birth from. Place it to the left of the uvtexture1 SOP. Connect its input to the output of carve1. In the Group SOP, name the group start_point – set entity to Points; Operation to Group By Range; Start/End to $N $N; Select _ of _ to 1 2. Add a Popnetwork to the group1 node. Connect the Ground node to popnet1’s second input.

Tracking and tagging the starting point on the animated curve as it crawls up the wall, you can then create your particle debris system

With popnet1 selected, press [Enter] to dive in. Drop down a Source POP. In the Source tab set Geometry Source to Use First Context Geometry; Source Group to start_point. In the Birth tab set Impulse Birth Rate to 3; Const. Activation to 0; Const. Birth Rate to 0; Life Expectancy to 10. In the Attributes tab set Initial Velocity to Add To Inherited Velocity; Variance to 1, 1, 3. Add a Collision POP and set Geometry Source to Use Second Context Geometry. In the Behavior tab change Behaviour to Stick On Collision. Your particle debris will collide with the ground and stick to it. Finish it up with a Force POP and set Force to 0, -9.8, 0 to give it the correct amount of gravity. Play through the timeline to see how the animation and particles come together.

Jump back into SOPs by pressing [Alt]+[Back Arrow] on your keyboard. Throw down a Merge SOP and connect the popnet1 and the Clean SOPs to it to merge the particle system and the creeping crack on the wall for the final network. This method gives you a degree of control, since you can edit the curve at any time. Take a look at Crack_on_Wall_final.hipnc for reference and bonus tweaks and additions.

Carlos Donis Lemus is a CG supervisor at EA, specialising in procedural workflows, methods, tools and pipelines


Posted on Monday, September 3rd, 2012 at 4:23 pm under Guides, Technique, Tutorials. You can subscribe to comments. You can leave a comment, or trackback from your own site.

Tags: ,

Share This Page