Tuesday 15 August 2017

Shattering an animated object. Eg. flying saucer smashing into something

Say you want to make a moving object smash into bits. Eg. A flying saucer that's been hand animated, which then needs to break apart dynamically.
As usual this isn't going to be straightforward :)

Shatter and pack geometry as usual, only what we need to do is ensure the points are not active. You can be double sure by laying down a point wrangle and setting i@active=0;

In your DOP network, make sure the RBD is not an active rbd as initial state. Set it to deforming static object. This should be done in the drop down menu. Now if you hit play, the object should not simulate at all & only follow it's given animation. "Overwrite Attributes" is NOT ticked.

We will use a sop solver & a point wrangle within to set the active value to 1. I've found using an activating shape like a box to set points into a group (using the bounding option) works best for this. eg. the saucer rbd points don't become active until they pass through said box. The attribute "deforming" (an integer) must be set to 0 once the "active" value switches to 1. This is so it no longer animates, or as Houdini refers to it, "deforms".
We use a sop solver so that the active value stays at 1 and doesn't reset to 0 once it passes through the activating shape. What we also need to do is use this sop solver in conjunction with the Bullet solver. This is done with a multi-solver.

Things I've found that are a bit problematic are glue constraints... Will look into this.
Update on glue - 

Houdini 16.0.504.2 has a weird thing... The Constraint Network's "Overwrite with SOP" attribute's default value is supposed to only import the SOP on the first frame...but it seems to behave as if it's always importing it. As a result, set it to 0 (zero), so that the animation of the object is ignored. This seems to make the glue constraints work properly.

https://drive.google.com/file/d/0B2eKYZ42BvalZnFaY0NZMkhwb3M/view?usp=sharing

Monday 17 July 2017

pyro - "custom wind volumes"

Sometimes you want to have pyro behave a certain way in a certain area. Eg.  the smoke should go from left to right, then suddenly shoot upwards after a few seconds.

Instead of fiddling with the advection or velocity updates, it's a bit simpler to create a separate pyro source that only emits velocity.
Simply create a source as you normally do, but remove it's density & temperature. Remember to scale these to zero in the DOP area too!

Friday 23 June 2017

latticing VDBs/volumes

Bring in your VDB however you need to.
Plug it into a VolumeVOP and create an addpoint node. Plug P into the ptvalue input.
Next create a setattrib node and plug your addpoint's ptnum output into the setattrib's i1. Plug your density into the value node and name the parameter "density". Jump back out of the VOP.

This will have made a volume grid of points that represent your VDB, each containing the corresponding density value. The number of points created is dependent on the resolution of your VDB, although I guess you could duplicate points and hope that they interpolate nicely?

Next, add a Timeshift node after the VOP and freeze your volume at the point you think it occupies the most space. Eg. if it's a trail of cigarette smoke, it's last frame. Create a Bound node for this.
This is now the lattice you can transform and deform.
Then make a Lattice node and plug your Volume VOP into the first input, the output of the Bound into the 2nd and then finally whatever your transform/deforms are into the 3rd.

So far, we've transformed a bunch of points, that hold our density values.. Now we have to recreate our volume..


Connect a Bound node to your deformed points. We're making an empty volume that encompasses the limits of your deformed sequence. Add an Iso Offset to this, set the Output Type to Fog Volume, Mode to Ray Intersect and name it Density. You control the effective resolution with the sampling. Next let's copy the density back into your empty volume.

Make a volume VOP, plug the Iso Offset into the first input & the lattice into the second. Jump in and make a Point Cloud Open node. Connect the P to the P and the OpInput2 into the File input.
Create a Point Cloud Filter and set it's signature to Float Channel and label the Channel "density". Plug the Point Cloud Open's handle into the Point Cloud Filter's handle input. Finally plug the value into the volumevopoutput's Density..

Your blank volume now has a deformed version of the original's density!
Sit back, relax and pretend you're resimming now.

Tuesday 20 June 2017

Pyro UPRES

Setup a Pyro as you would normally..This will be your low res sim. In a Geo sop somewhere, make a DopIO node and choose the pyro preset to make sure you're importing all the required fields from the low res sim. You could file cache this out..

Then..make a new Dop network. Inside this, create a smoke object and plug it into a Gas Upres node.
Point the Gas Upres node's Initial Data/Low Res Sop Path to a DopIO node you made earlier. Alternatively if you've cached it out to VDBs or bgeo.sc's you can switch the source to "file" and point it to that cache.


I've found that putting a copy of your low res sim's Source Volume helps a lot. Plug that into the last input of the Gas Upres. Switch it's Velocity setting to COPY, since you'll want to copy it from the lowres sim.

You might have to play with the smoke object's initial size settings, so that it encompasses your entire sim size. Oh - and change the division size to your desire resolution..we are upres-ing after all.

Mess around with extra dissipation or turbulence in the Gas Upres node...

That should be it.

Monday 19 June 2017

Pyro.. without shelf tools

Setting up Pyro manually...


  • You'll need to plug your emitter geometry into a Fluid Source node. You might want to turn off empty interior. As always, label with a null. OUT_SOURCE. Add a scalar volume and label it temperature. Your pyro won't react properly to buoyancy otherwise. THANKS HOUDINI.
  • It's a good idea to create two bounding boxes - one for the source, one for the padding. Make the padding way bigger than the source, freeze the time so it doesn't jump around in the simulation. You don't have to freeze the source bounding box as the solver only takes the first frame anyway. Label them with nulls, with something like OUT_BOUND and OUT_PAD.

  • Inside a dopnetwork -
  • You need a Source Volume node. use your OUT_SOURCE as your volume path. Initialise it to Source Smoke. Set the Velocity to Add. Otherwise it will just keep overriding the velocity.
  • You need a Smoke object. You might as well link the Division Size to the same parameter in the Fluid Source you created earlier. For the size and centre parameter boxes, use these respective expressions with the relevant paths and axis variations - 
bbox("../../geo1/OUT_BOUND",D_XSIZE)
centroid("../../geo1/OUT_BOUND",D_X)

  • In the Creation tab, you'll probably want to tick ON Solve on Creation Frame. This gives the system some density on frame 1, so it won't immediately shrink and implode on itself.
  • Next you need a Gas Resize Fluid Dynamic node. This just keeps track of the size of the simulation. Tick ON Clamp To Maximum, set it to From Object and point it toward OUT_PAD. Nice and easy, no expressions required. You still might have to faff with the padding values in the Bounds tab....
  • Lastly, but not least - you need a Pyro Solver node. Plug the Smoke Object into the first input, the resize into the second and the Source Volume into the last.
That should all work! The Solver contains most of the turbulence/shaping controls for the simulation.
You now have a basic pyro setup without using shelf tools. YAY.

Monday 12 June 2017

random rotation with POPs

To get random rotation with POP particles, add a point wrangle at SOP level with a more specific version of the following code-

v@w=rand(x-value,y-value,z-value);

Then in the dop network, add a POP-torque node and set the amount to zero, so that it takes the initial "w" value. "w" is angular velocity..all according to keikaku.

Thursday 8 June 2017

installing QLIB...what to stick in your houdini.env file

#QLIB
QLIB=C:/Users/threedee/Documents/houdini16.0/qLib-dev
QOTL=$QLIB/otls
HOUDINI_GALLERY_PATH = &;$QLIB/gallery
HOUDINI_OTLSCAN_PATH = &;$QLIB/otls/base;$QLIB/otls/future;$QLIB/otls/experimental
HOUDINI_TOOLBAR_PATH = &;$QLIB/toolbar