The Complete Houdini: Cloth Simulation Using Vellum (10/x) (Patreon)
Videos
-
clip01.mp4 -
clip02.mp4 -
clip03.mp4 -
clip04.mp4 -
clip05.mp4 -
clip06.mp4 -
clip07.mp4 -
clip08.mp4 -
clip09.mp4
Downloads
Content
Continuing our Houdini journey, it’s time to explore the world of Vellum!
The traditional definition of the word “vellum” is animal skin parchment used for writing. In Houdini it’s a term that covers simulations of fabric, grains, hair and more using Position Based Dynamics (PBD). PBD is mathematical method used to calculate the physical relationships between points in 3D space. PDB can govern the interactions between points and their connections to each other, as well as the effects of external forces like gravity and wind. This allows us to simulate a huge range of real-world phenomenon, including tearing, surface tension, self-collisions and much, much more.
For this article we’ll create a scene of a flag waving and tearing in the wind using Vellum’s cloth tools.
We’ll draw on all the Houdini knowledge we’ve gained thus far, including making use of some rigid body simulations (RBD). Let’s get started!
General Concepts
Each Vellum simulation node tree culminates in a Vellum Solver. This node controls all aspects of the simulation environment including forces like gravity, simulation substeps, visualization and more. We can add our own custom forces and VEX modifications by diving inside the Vellum Solver, just as we did with the RBD Solver to control the inertia of our billiard ball simulation.
In order to prepare geometry for the Vellum Solver we’ll use Houdini’s preconfigured Vellum nodes. As we can see in the Tab menu there are setups for cloth, hair, grains and more.
Most are the same Vellum Constraints node under the hood, but with different options selected specific to each task. Note that “constraints” is a broad term referring to how the simulation constrains points to each other and within the environment. How much a piece of cloth can bend or stretch is controlled by constraints, how it tears is controlled by constraints, how it interacts with other objects is controlled by constraints, etc.
Let’s set up a simple cloth object to get a general sense of how this all works before we build our full scene. Add a Grid and attach a Remesh.
Note that it’s generally a good idea to use triangles for vellum simulations. Quads are fine too of course, but triangles tend to “bend” more cleanly. It’s common to simulate an object using triangulated topology, then transfer the motion of the final simulation to a high-resolution quad-based version with UVs.
Connect a Vellum Configure Cloth and a Vellum Solver.
That’s all there is to it! Press play and our cloth falls along with gravity.
Not very interesting though. Let’s add a collider and some wind. For the former, simply connect some other geometry to the Collision Geometry input.
We can use the Vellum Solver’s wind settings, but instead let’s add a POP Wind inside the solver itself.
This gives us more options for customization. Position the collider as desired and dial in the wind settings. Press play again and we’ve got a lot more action.
Note that working with simulations like this in Houdini comes down to trial and error. Over time you’ll get more familiar with how settings work and what effects they’ll produce, but even then it’s a lot of playing back, observing results, tweaking settings and trying again.
Also note that the playbar fills up with blue when there are cached frames.
Initial playback will be slow as Houdini needs to crunch the numbers on each frame. Once it has, that frame is temporarily saved for quicker access, until parameters are changed and it needs to be recalculated.
You can click the “brain” icon it turn off cooking of the scene.
This is helpful if you need to work on some other stuff and don’t care about seeing the simulation results while you do. For example, say you wanted to jump ahead to do something on frame 100. If you just click the timeline you might have to wait for 5 minutes while Houdini calculates the previous 99 frames when all you wanted to do was add a keyframe on frame 100. Click the brain icon again to reenable simulation.
Finally, the Esc key is your lifeline if something goes wrong and you get stuck calculating something for way too long. Esc ends whatever Houdini is currently working on and returns control of the interface to the user. Maybe you accidently set your remesh edge length to like 0.0000001 and Houdini is dutifully trying to make a few trillion polygons. Hammer Esc like your (CPU’s) life depends on it!
With these general thoughts out of the way, let’s dive into creating a full, complex scene based on Vellum cloth.
Flag Scene
The idea of this scene is we’ll have a cloth flag blowing in the wind until it tears. Here’s a partial list of the things we need to set up:
- Two Vellum cloth sims, one for the left edge of the flag and one for the flag itself.- The main flag will be attached to the left edge.- An RBD simulation for metal clips holding the flag to a pole.- The left edge of the flag will be attached to the clips.- Wind forces affecting the clips and two flag cloth flag pieces.- Custom fractures in the flag that will tear when the wind force increases.
There will be a few more considerations, but this will get us started!
To keep this article from being novel length I’ll speed over things we’ve already covered and focus on the important details. I’ll address many of the challenges that you’d likely encounter when creating a similar setup.
Geometry Creation
I created all the geometry using simple primitives and basic modeling. The pole will be completely static and consists of a few tubes and a sphere. I didn’t use booleans here since topology doesn’t matter and each part of the pole can exist as isolated meshes. Just resize and position the objects as needed and collect them into a Merge node. I added some bevels, auto UVs and normals as needed.
Next up are the metal clips and the collars connecting them to the pole. The collars are made of a tube/torus boolean. The clip is a torus that I edited using standard modelling tools to make the middle longer.
I positioned these as desired relative to the pole, connected them to another merge, then connected both the pole and the collars to the final merge that will collect everything in our scene. We’ll be applying an RBD simulation to the clips later on.
For the flag edge we’ll use a simple grid. I added two tube booleans to create holes where the clips fit through. I also added a torus to serve as a metal ring holding the hole in the fabric together. Here’s a detail of the top portion:
Finally, I added another grid for the main flag and positioned it right next to the flag edge.
To aid when rendering in Solaris I added Name nodes to every individual object in the scene. These names will show up in Solaris, making it easy to assign materials.
That’s our basic geometry setup done.
Clip Rigid Body Simulation
The clips will serve as the first point of attachment for both our flag edge and main flag, so we’ll simulate their movement first. We just want a little wiggle in the clips as they get buffeted around in the wind. To easily set this up we’ll use an RBD Configure with the collar set to inactive (it's stationary), RBD Constraints from Lines to attach the clips to the collars and an RBD Cone Twist Constraint Properties to allow the clips to rotate and move only in a range we set.
The Line Constraints work by drawing a line connecting the collar and the clip. This way we tell Houdini that the two objects are connected to each other in the simulation.
The endpoints of the lines don’t really matter as long as they are touching the appropriate objects. However, we’ll want to carefully position the hinge point as this is the exact spot the clip will rotate around.
The Cone Twist Constraint allows us to control the range of motion of the clip. The viewport guides clearly show the parameters as we adjust them.
Dive into the RBD Solver and add a POP Wind as we’ve been doing elsewhere. Dial in the wind so the clips flop around a bit in a way that looks realistic.
Keep in mind that we’ll be ignoring the reverse force that the flag would be applying to the clips in real life, so we want our clip motion to look like not only is it responding to wind on its own but is also being pulled around a bit by the flag.
Flag Edge Vellum Simulation
Next up we’ll simulate the fabric of the flag edge. Looking at real life flags, this fabric is often a bit stiffer than the main flag, so it makes sense to keep it as a separate piece.
Connect the Vellum nodes as shown:
The Vellum Attach Constraints node allows us to quickly connect the fabric to the motion of the clips. Connect the output of the RBD clip simulation to the Vellum Attach collider input and select the points or primitives on the flag edge that we want to connect to the clips. The viewport draws lines showing how our selected primitives connect to the clip geometry.
We’ll also add a POP Wind into the Vellum Solver and dial in the settings until it looks good.
(Note that I triangulated both pieces of cloth with a Remesh node so as to provide the best looking bending.)
I used different wind settings compared to the clips since what worked for the clips wouldn’t necessarily work for the fabric. After some trial and error I was happy with this:
To finish off the look I added a Vellum Post Process. This node includes a few convenience features for polishing up the look of a vellum simulation. I added a bit of Spatial Blur to smooth the result and turned on Extrude by Thickness to upgrade the cloth from a flat plane to something with a bit of thickness.
Main Flag Vellum Simulation
The main flag will have some tears in it, which we can set up using an Edge Fracture node. We can draw custom curves onto our geometry showing where were we want our tears.
We’ll then reference these fractures in a Vellum Stitch node and set a threshold after which the constraints release, causing tears. The viewport shows convenient previews of the stitch constraints.
Finally, just as we attached the edge to the clips, we’ll want to attach the main flag to the edge. Do this with another Vellum Attach node and select the entire left edge of the flag.
Note that Houdini uses a proximity-based method to find points on the “parent” geometry to attach to. This works really well and is a lifesaver when the objects don’t have anywhere close to the same point count, meaning it would be a huge pain to manually make the connections. Further note that I attached to the original 2D edge, not the extruded, post-processed version. Using the extruded one would lead to way too many competing points to attach to.
I keyframed the wind so that it blows enough to animate the flag but not break the constraints to start, then picks up in force and causes the tears to happen.
This is how things are shaping up! The clips wiggle around a bit in the wind, the flag edge reacts to its own wind force while staying connected to the clips and the main flag stays attached to the edge while rippling in the wind and eventually tearing when the keyframed wind picks up force.
Polishing the Results
There are a few problems here that prevent the final result from looking perfect.
First, we need to have the metal rings around the flag edge holes “stick” to the surface. This is easily addressed by adding a Point Deform node. The Mesh to Deform input connects to our rings, the Rest Point Lattice connects to the pre-simulation, 2D flag geometry, and the Deformed Point Lattice connects to the final flag simulation output.
This actually works surprisingly well out of the box.
Technically, the torus is deforming within itself to match the motion of the fabric, which it would be too stiff to do in real life. You could “pack” the rings so that they are treated as one object and that also works well. In this case the deformation is hardly visible so it works fine just to leave it as is.
The next problem is that the main flag is drifting away from its attachment to the edge.
This happens when there is a particularly large move between frames. It might be solvable using more simulation substeps, but that slows everything down and the rest of the sim doesn’t need it.
A quick and dirty solution is simply to Fuse the main flag to the nearest points on the pre-vellum-post-process flag edge. Select your source and target points and set the Snap Radius to a value that catches all the points you want to fuse without going too far afield.
This looks great, although because it is fusing on every frame anew it sometimes picks a different point than the previous frame when things have moved around a lot. Up close this is somewhat noticeable, but from a distance it doesn’t matter. If you needed excellent closeup fidelity then you could run two different fuse operations: one for the majority of edge points that never stray far, and one that specifically attaches a couple trouble points without relying on search radius.
It's a good idea to File Cache as much as possible so Houdini doesn’t have to constantly recook things that we aren’t editing any more. All of the geometry can be cached to disk once we’re happy with how it looks. This means Houdini won’t have to occasionally redo all the remeshing, booleans and so on, speeding up our work a lot.
Last but not least, I cached the entire scene to disk for quick playback and easy export to Solaris or any other rendering app.
Rendering
I used Solaris to put together a very quick rendered demo. It was a simple matter of assigning materials to each object, making sure motion blur was enabled, and adding an environment light. I made a visit to Substance Painter to create a texture for the flag.
And there you have it!
Final Thoughts
In this article we covered everything you need to know to get started creating realistic cloth simulations using Houdini’s Vellum toolkit. These general principles will serve you well creating your own scenes and branching out into other aspects of Vellum, including simulating hair, fluid and grains. Don’t be afraid to experiment and above all, have fun!