Last post was all about Pyro and FLIP preparation for the explosion.
I’m going to go off on a bit of a tangent, and talk about the bubbling fluid sim at the start of the animation!
16.5 to the rescue
Houdini 16.5 came out just as I was starting to build this scene, and they added air incompressibility to FLIP.
I’d been doing some experiments trying to make bubbling mud in a separate scene:
As you can probably tell, I didn’t have a great deal of luck 😉
Fluid spawning setup
The network starts with importing the glass sections of the grenades.
There are three outputs: The geometry to spawn fluid from, a volume used for collision and volumes for fluid sinks.
The fluid spawn and collision is pretty straightforward, I’m using the Peak SOP to shrink the glass down, then the Fluid Source SOP to output an SDF for the collision:
^ The collision volume is pretty 🙂
The sink volumes are a little more interesting.
The Copy SOP is copying onto some points I’ve spawned.
The points are scattered on the bottom part of the glass:
The geometry that is getting copied onto those points is a sphere that scales up and down over a certain frame range.
In the Copy SOP I’m stamping the copy id for each point, and the sphere is scaled using an attribute wrangle:
float lifeSpan = 220; float maxScale = 0.9; float minScale = 0.4; float randParticle = @copyID+(rand(@copyID)*.3); float bubbleLife = 0.06; float zeroToOneTime = (@Frame%lifeSpan)/lifeSpan; float distanceFromTimePoint = abs(zeroToOneTime - randParticle); float dftpZeroOne = fit(distanceFromTimePoint, 0, bubbleLife, 0, 1); float scale = cos(dftpZeroOne * ($PI/2)); if (scale > 0) scale += minScale; @P *= scale * maxScale;
This ended up being far more complicated than it needed to be, I was randomly adding to it until I got something I liked 🙂
I could strip most of the lifespan stuff out entirely: I was originally using that so that each point could spawn spheres multiple times, but that ended up being too aggressive.
Anyway, for each point, there is a range of frames within the lifespan where the sphere is scaled up and down.
With a low lifespan, this is what I’m getting:
The spheres get converted to a sink volume, and is used to allow fluid to escape the sim.
Where the fluid escapes, bubbles are created!
This is another case where I used the shelf tools for sink volumes in another scene, had a look at what it produced, then recreated it here.
I really recommend doing that sort of thing, it can really help with iteration time when your scenes get complicated!
Fluid sim and trim
The flip solver is pretty straightforward!
The collision volumes are imported as source volumes, and passed in to velocity and post solve sourcing (again, I worked this setup out with shelf tools).
Air incompressibility is just a checkbox option:
That’s it for the sim, on to the surfacing network:
I had some issues when solving on lower settings, where I’d get a lot of fluid leaking out of the container.
To solve this, I’m importing the glass into this network, then converting to a VDB:
Right under that, I use an attribute wrangle to copy “surface” from the VDB to the points, and I use that surface value to delete any outside points.
Here’s a mockup example (since my final sim only had very minor leaking), where I’ve manually moved a bunch of points outside the glass, and I’m colouring them with the surface value:
Now time to surface the fluid.
Usually I would just use the Particle Fluid Surface SOP to do this, but I tried a number of approaches with it, and I was always either losing the internal bubbles, or not getting the desired results, so I built the surface with some of the nodes that the Particle Fluid Surface SOP uses internally.
First of all, VDB from Particles, here is a cutaway of that:
The surface is pretty rough, though!
I smooth it out with a VDB Smooth SDF:
I didn’t want to smooth out the interior any further, but the exterior is still too rough.
Similar to how I was deleting points before, I use the glass to create another VDB, and I use that as the mask for a second VDB smooth:
And that result, I was happy with!
You might have noticed by now that I’ve only been simulating one grenade in the fluid bubble sim.
I figured that since I was using heavy depth of field, I could get away with using the same fluid sim for all of the grenades, and just copy it onto each grenade:
To make the duplication less obvious, I simulated the fluid sim a bit over 60 frames more than I needed, and I used a time shift on the 2nd and 3rd grenade to offset the simulation, so the same bubbles aren’t coming up at exactly the same time.
The copy node stamps the GrenadeID, which the timeshift node uses:
And now we have bubbling grenade water sims!
(Re-meshed in this shot, because the render mesh is 1 million polygons :))
Still to come in this series of posts: Mantra rendering setup, lighting, materials, fun with scorching and wetting walls!