Houdini - RBD Fracture and Sim Animated / Deforming Object
The effect: Pieces break apart according to a bunch of paths, on an object that is moving/deforming.
In parts, we have to:
(1) Fracture the sphere according to some paths.
(2) Have the pieces start out as part of the keyframed animation e.g. as part of the spinning globe, and then switch over to being simulated by the RBD Solver when some “trigger” happens.
@active
and @deforming
We learned previously, the RBD Solver looks for the attribute i@active
on the pieces to determine whether they are “reactive” in a sim.
Another attribute – i@deforming
– determines whether the solver updates the collision geometry on every cook. This defaults to 0
.
So to achieve (2) we need to tell the Solver:
-
Condition 1: The pieces start with
@active == 0
but@deforming == 1
Which is to say, do not sim these pieces, but they are deforming e.g. the pieces are animated and moving around, so (re)read the geo on every cook. -
Condition 2: Later,
@active == 1
and@deforming == 0
Which is to say, start simming these pieces, and ignore any animated deforms, essentially “handing off” the pieces to the will of the Solver.
Setup
Fracturing By Density (Green)
Everything starts with Find Shortest Path
, which gives us four lines that traverse the sphere.
What we want is to concentrate the fracturing along those paths. So we need a Scatter that has a whole lot of points near those paths, and not so many everwhere else.
Remembering that we can “scatter by density”, we now need some way to indicate density, which means we need a volume, specifically a volume with higher densities near the curves e.g. “density by distance”.
Which gets us this Voronoi Fracture with more cracks along the paths:
Propogating @active with points (Blue)
Using the same paths earlier, we scatter one point on each path and move them along using Attribute Interpolate.
As they come near the pieces of the fractured globe, we transfer and persist i@active = 1
onto those pieces, making them “active”, which the DOP Network will later pick up.
DOP Network
The Geometry Wrangle contains:
i@active = point(0, "active", @ptnum);
i@deforming = 1 - i@active; // E.g. deforming, unless active
We have to set these inside DOPs because the geo is instantiated only once on creation, only @P
is (re)read every cook due to @deforming == 1
. Other attributes that change outside of the DOP network after the creation frame are ignored.