Learn about simulating liquid colliding with rigid geometry.
- [Instructor] The last component to nearly any Bifrost fluid simulation is collisions. And they're easy to add. You simply select the collider object and then the Bifrost liquid container node or the liquid shape node. I can easily select the collider object here in the viewport and then I need to select either the liquid container node or the shape node. And I can do that from the Outliner. Hold down Control and select bifrostLiquidContainer1, go into the menus and choose Bifrost Fluids, add Collider.
And now we have a new node in the Outliner, bifrostColliderProps1. Let's rename that. Double-click it and rename it bifrostColliderRoom. Let's open up its shape node. Select colliderProps1 and in its properties we need to change the Conversion Mode from Solid to Shell. And that's the correct type of Conversion Mode for this type of object, which is a polygon shell. The room is not made out of walls of solid boxes.
If we set the Thickness Units down here to Voxels then the Thickness value here will need to be at least 1. We can achieve the same gap, the same distance between the collider and the fluid, as we currently have. We know that the Master Voxel Size is 0.033, we set that earlier in the bifrostLiquidPropertiesContainer node. So here's our Master Voxel Size. Back in our colliderProps we can achieve this same result of 1 Voxel thick gap by setting Thickness Units to World Space and then putting in a Thickness value here, which is 0.033, or 3.3 centimeters.
And now we're achieving the same result as we had before, but we have the ability now to change either the Thickness or the Master Voxel Size independently of one another. Okay, let's take a look. Press play in the timeline and the fluid will start to accumulate on the floor after it reaches about 15 frames into the shot. And it'll take a while to get there. You may have to wait for a minute or two for the scene to calculate all of those frames.
I'm going to stop it at about frame 20 by holding down the esc key. And once again, you may need to hold down that key for a while. I recommend, if you want to know when Maya is finished calculating that you also open up the Windows Task Manager or the Macintosh Activity Monitor, so you can monitor your CPU usage. But when the Maya interface is restored back to us we can create another Collision node. So let's rewind and select the colliderDoor object, and that's the one that's displayed here in orange.
Got colliderDoor selected. And then once again hold down Control and select the bifrostLiquidContainer node from the Outliner, go to Bifrost Fluids, add Collider. Now we have bifrostColliderProps1 down here once again. Double-click it and rename it bifrostColliderDoor. Open up its shape node, select the shape node colliderProps2, and in its attributes we once again have the Conversion Mode.
This is a solid object and we can leave it at Solid here. We can also choose Solid Robust, which is a little better algorithm. We'll choose Solid Robust. And now we can choose the Thickness Units in Voxels or scene units. Once again, I'm going to use World Space with a Thickness of 0.033, or 3.3 centimeters to correspond to the width of one Voxel. But again, because we're using World Space units we can adjust the Master Voxel Size and the Thickness of collisions independently.
We could also use a negative value for the Thickness here in order to cause the fluid to penetrate into the collider. That's something we couldn't do in Shell mode. We've established all the conditions for our first Bifrost simulation and we're ready to build a Playblast. This might take a while. We want to set up the display just the way we want it and then run the Playblast for quite a while. It might take an hour or more. I'll go over to the Channel Box, which I've got in a tab over here.
I want to hide the things that I don't want to render in the Playblast, such as the emitter, collider_room, and collider_door_layers. I want to enable display of the real geometry, which are the room_layer and the door_layer. And I can dolly back here in the perspective view. I'm just displaying a shaded mode right now, but I could turn on lighting if I wanted to, but just to analyze the flow a little bit more easily I'm going to use a shaded mode. We're ready now to check our work a Playblast.
But before we do there's one more very important optimization we need to make, and that is to set the global start time for the simulation. Right now the particles are appearing on frame one and they're going to build up inside this chamber here and it will take a long time to calculate each one of those frames. The door's not going to open until around frame 100. And in order to avoid all of that unnecessary calculation and also to have more control over the behavior of the fluid let's change the start time for the global solver node.
In the Outliner select bifrostLiquidContainer1 and in the Channel Box or the attribute editor we can change the Start Frame. So the Start Frame for the global solver to 96. So with a Start Frame of 96 on the global solver if we press play, then we see our particles disappear and when we get to frame 95 it start to slow down and now our particles are coming forward. All right, so I'll stop that.
Hold down the Escape key if you need to, and then rewind. Now we're ready to make our Playblast. In the perspective view I'm going to hide these lights. Go to the Show menu and turn off Lights, here it is. We can maximize that view. Tap the spacebar and also frame it up with the Resolution gate. I've got the panel toolbar hidden up here. I can reenable that with ctrl + shift + m. I just want to know what's been rendered, so I'll make sure the Resolution gate is enabled, and frame the view accordingly.
It looks pretty good. I don't want to capture the entire area outside the Resolution gate, so for the Playblast proper I'll turn the Resolution gate back off again. And go into the Windows menu and choose Playblast Options. In the Playblast Options I'm just going to set this up for disk output. I don't want to view the file after it's rendered, I don't want to display ornaments, I will save out to an avi file with no compression at full Quality.
The Display size, or rather the render size for the Playblast will be From my Render Settings at full Scale. And, of course, I'm going to save out to a file and let's rename it here. I've got 01_10_collide, we'll just put the word finished at the end of that, and press the Enter key. With all of our Playblast options set up we can go ahead and click the Playblast button and it's going to take a while to calculate. It's got to simulate all of those fluid particles.
And when you're tired of waiting you can hold down the esc key, but you can't just press the esc key. Maya will only see your keystroke for a split second between frames. You need to be holding the Escape key down at the moment between when one frame finishes and another begins. And you need to do this through two complete frame calculations. When you see a warning in the script editor that the Playblast was interrupted continue holding the Escape key down. When Maya sees one Escape key stroke it cancels the Playblast, but the simulation is still running.
The second Escape key cancels the Bifrost simulation itself. But again, Bifrost must finish the current frame. So you need to hold the Escape key down through the calculation of two complete frames and the simulation will finally stop. And this could take several minutes and you may need to put a paperweight on the Escape key, walk away, and have a cup of coffee. I've already built that Playblast, so let's take a look at it. We can see that indeed collisions are occurring. Some of the fluid particles are flying through the walls, because of their excessive velocity, but we can correct that using the time step adaptivity settings later.
That's how to add collisions to a Bifrost fluid simulation and it concludes our chapter on the basics of simulating a liquid.
- Bifröst basics
- Analyzing the node structure
- Emitting from a polygon mesh
- Colliding with a polygon mesh
- Adding velocity, friction, and drag with motion fields
- Optimizing space and time accuracy
- Caching simulations
- Meshing and exporting liquids
- Render-time meshing in Arnold
- Applying channel data to Arnold shaders
- Generating foam from a liquid
- Rendering and shading foam in Arnold