This page provides a tutorial on creating a river simulation with Phoenix FD in 3ds Max.
Requires Phoenix FD 3.12.00 Official Release and V-Ray Next Official Release for 3ds Max 2015+. If you notice a major difference between the results shown here and the behaviour of your setup, please send an email to firstname.lastname@example.org
The instructions on this page guide you through the process of using Phoenix FD to create a simulation of a river flowing down a hill.
The Download button below provides you with an archive containing the scene file.
Scale is crucial for the behavior of any simulation. The real-world size of the Simulator in units is important for the simulation dynamics. Large-scale simulations appear to move more slowly, while mid-to-small scale simulations have lots of vigorous movement. When you create your Simulator, you must check the Grid rollout where the real-world extents of the Simulator are shown. If the size of the Simulator in the scene cannot be changed, you can cheat the solver into working as if the scale is larger or smaller by changing the Scene Scale option in the Grid rollout.
The Phoenix FD solver is not affected by how you choose to view the Display Unit Scale - it is just a matter of convenience.
Go to Customize -> Units Setup and set Display Unit Scale to Metric Centimeters.
Also, set the System Units such that 1 Unit equals 1 Centimeter.
The final scene consists of the following elements:
- A Phoenix FD Liquid Simulator tilted to follow the orientation of the scene geometry. Initial FIll Up under the Dynamics roll-out is enabled so waiting for the Liquid Source to fill the entire river bed geometry is not required.
- Scene geometry: geometry for the river bed, stones and vegetation.
- A Phoenix FD Liquid Source emitting from manually specified faces at the top of the river bed geometry.
- Two Phoenix FD Particle Shaders used for the Splash and Foam particles. The Splash particles are rendered as Points while the Foam is rendered as Bubbles.
- A V-Ray Sun&Sky setup for lighting the scene.
- A V-Ray Physical Camera for rendering.
Set the Time Configuration → Animation Length to 250 so that the Time Slider goes from 0 to 250.
Import the riverBed.abc, riverRocks.abc and riverRoots.abc files to your scene by going to File → Import → Import...
We use the riverBed and riverRocks as collision geometry for the Phoenix FD Liquid simulation while the riverRoots are only used during rendering.
Create a Phoenix FD Liquid Simulator and set the Grid → Cell Size to 1.953cm.
Set the Grid → Size X/Y/Z to 1109 / 334 / 167 respectively.
For this example, the Simulator is placed at the following coordinates:
Translate X/Y/Z: [ -3.817, -14.156, 258.781 ]
Rotate X/Y/Z: [ 0, 7.221, 0 ]
The simulation bounding box should now be wrapped around the riverBed geometry and slightly tilted to follow the direction of the stream.
We do this for the slight performance boost - keeping the Simulator straight provides no benefit - the simulation will be exactly the same but run faster when the bounding box is tilted and its vertical size (Grid → Size Z) reduced.
Add the riverRoots geometry to the Simulator → Scene Interaction → Include/Exclude List using the Add button.
This will tell the Phoenix FD that the riverRoots geometry is to be ignored during the simulation.
Using open geometry or geometry with no thickness (such as the poly planes used for the riverRoots' leaves in this example) can give you unpredictable simulation results. Making sure that your geometry is clean is crucial for a smooth workflow. Phoenix FD (and many simulation packages in general) use a volumetric representation of your mesh for the simulation. The process of creating this volumetric representation is called voxelization. The algorithms responsible for voxelizing the geometry can fail when using open (with holes) or planar (no thickness) geometry.
Create a Phoenix FD Liquid Source and add the riverBed geometry to the Emitter Nodes list using the Add button.
Set the Outgoing Velocity to 100cm.
Here's a preview of the simulation in its current state.
The entire riverBed geometry is emitting liquid into the Simulator. Instead, we want liquid to be emitted into the simulation only at the very start of the river.
We can accomplish this by giving the Phoenix FD Liquid Source a set of faces specified by us to use for the emission. The Polygon ID parameter at the bottom of the options panel for the Source can be used for this.
Select the riverBed geometry and assign an Edit Mesh modifier.
Go into Face Selection mode.
Select the faces at the very start of the stream and assign to them a Polygon ID of 2.
Select the Phoenix FD Liquid Source and set the Polygon ID parameter to 2.
The Source will now only emit from faces that share this ID.
Here's a preview of the simulation in its current state.
One major issue at the moment is the fact that it takes about 250 frames for the river bed to fill up with water. This can become a major issue when running high-res simulations and tweaking individual parameters for the Foam, Splashes, etc.
There are two ways to address this:
- Run the simulation for 200 or so frames and use the Simulation roll-out → Load & Start button to start a new simulation from the last frame of the one before.
- Enable Dynamics → Initial Fill Up to fill the Liquid Simulator with water on the first frame of the simulation.
We go with the second approach.
Enable Dynamics → Initial Fill Up and set the level to 40 (% of the simulator bounding box height).
Here's a preview of the simulation in its current state.
Before we take care of the Foam / Splash particles, we take a quick look at Wetting in the next step.
For a realistic interaction between the scene geometry and the liquid, Phoenix FD provides you with the option to simulate the effect of Wetting.
Wetting is handled by a set of secondary WetMap Particles which are calculated along with the Liquid, Foam, Splashes, etc.
WetMap particles are created where the Liquid particles interact with the scene geometry.
You can use the WetMap Particles through a Phoenix FD Particle Texture to generate a Black&White Texture Map which can be used as a mask for a Blend Material.
The preview of WetMap Particles can be Enabled/Disabled from the Phoenix FD Simulator → Preview roll-out → Particle Preview options.
To enable the simulation of WetMap Particles, enable Wetting from the Simulator → Dynamics roll-out.
Wetting is a simulation, not a render-time option - changing any of the values below requires a re-run of the simulation.
Run the simulation for 30 or so frames.
Phoenix FD Simulator → Dynamics→ Initial Fill Up is Disabled for clarity. The only source of liquid is the polygons on the riverBed geometry.
Assign a V-Ray Blend Material to the riverBed geometry.
Plug two V-Ray materials to the Base and Coat 1 inputs of the Blend material. Set the Diffuse colors of those V-Ray materials to Red and Yellow respectively.
Finally, plug a Phoenix FD Particle Texture to the Blend 1 input of the Blend material. Click the None button below the Source Particle System option and select the Phoenix FD Simulator. When prompted to pick a particle system, select the Particles [ WetMap ] of [ PhoenixFDLiquid001 ] entry in the list.
Finally, set the Particle Area Radius to 5cm. This option controls the size of the white dots generated by each WetMap particle.
Particle Area Radius: 2.0
Particle Area Radius: 5.0
Splash and Foam
We are now ready to start setting up the Splash and Foam parameters for the Phoenix FD Simulator.
Open the Splash/Mist roll-out and select the Enable checkbox.
Choose Yes when asked if you'd like a Phoenix FD Particle Shader generated for the Splash particles. This will automatically set up the link between the splash particle group, the Particle Shader, and the Liquid Simulator.
Set the Splash to Mist option 0 to completely disable the generation of Mist. Mist particles are produced by the splitting the Splash particles as they fly through the air.
Set the Foam on Hit → Foam Amount option to 0.8.
In this tutorial, the Foam is generated by the Splash particles. Splash particles, on the other hand, are born when the liquid surface is turbulent. Therefore, when the liquid collides with the river stones and starts twisting around them, Splash particles will be born which will produce Foam for you.
We don't use directly give birth to Foam particles using the Foam roll-out → Foam Amount option because it relies on the Speed of the liquid. Since the river is flowing down at a relatively constant rate, this will produce Foam all over the place rather than in those specific areas where the liquid flow is disturbed.
If you'd like to learn more about the different secondary particle effects and how they interact with the simulation, you can check the FLIP Particles Life Cycle diagram.
Here's a preview of the Splash particles on their own:
In the next step, we enable the simulation of Foam.
Open the Liquid Simulator → Foam roll-out and select the Enable checkbox.
Set the Foam Amount to 0. As discussed earlier, Foam particles should only be born by the Splash particles in this setup.
Set the Lifespan → Half Life to 6 seconds. After some trial and error, we decided on this value. This may be changed for your scene if you are following along with a different setup.
Set the Size to 0.6cm. The size of the liquid particles will affect how they interact with each-other when the B2B Interaction (Bubble-To-Bubble) is enabled (i.e. the value is greater than 0). Smaller Size will produce smaller clusters of particles and vice-versa.
Set the B2B Interaction to 50. The Bubble-To-Bubble interaction helps the Foam particles stick together rather than behaving like individual points in space.
Set the Patterns → Strength to 0.5 and the Patterns → Radius to 10cm. Those two options are entirely an artistic choice - please check the Example Videos in the Liquid Simulator's Foam roll-out documentation for a more intuitive understanding of those controls.
Here's a preview of the Foam particles on their own:
At the moment, the Foam looks a bit chaotic. Once we reduce the Cell Size for the final simulation, the Foam particles will start clumping and producing interesting detail under the influence of the Patterns settings.
If you'd like to render the simulation with Motion Blur, enable the Velocity Channel Export from the Output roll-out for both the Grid and the Particle Systems.
Reduce the Grid → Cell Size to ~2cm for the final simulation and hit Simulation → Start.
Consider setting the Preview → Read Cache for Preview option to Disable During Sim. Reading the cache files and showing their contents in the Viewport becomes progressively slower the heavier a simulation becomes.
Here's a preview of the final simulation:
We focus on the water material for the liquid, the Phoenix FD Particle Shader settings and an example V-Ray Blend Material setup using a Wetmap for the river stones.
Let's start by adding a V-Ray Sun&Sky system and a V-Ray Physical Camera so the lighting setup is taken care of from the get-go.
Add a V-Ray Physical Camera by going to Create → Cameras → VRay → VRayPhysicalCamera.
Here are the exact transformations:
Target Translate X/Y/Z: [ -14.3, 98.18, 566.646 ]
Camera Translate X/Y/Z: [ 434.102, 1014.203, 2463.551 ]
Sensor&Lens → Focal length (mm) is set to 43.2 and Color&Exposure → Exposure is disabled.
Add a V-Ray Sun&Sky using the sun icon in the V-Ray toolbar. When prompted to choose whether a VRay Sky should be automatically created, select Yes. This will automatically set up the environment for you.
The exact transformations for the V-Ray Sun and its target are:
Target Translate X/Y/Z : [ -31.599, 0, 475.086 ]
Sun Translate X/Y/Z: [ -2005.817, -1133.8, 2986.125 ]
The Invisible toggle is enabled and the Intensity Multiplier reduced to 0.02.
Here's a rendered image of the River Bed, River Stones and River Roots geometry.
The Phoenix FD Simulator and the two Particle Shaders for the Foam and Splashes are hidden to speed up the look-dev process.
Wetmap Setup for the River Stones
Assign a V-Ray Material to the riverStones geometry and plug a Phoenix FD Particle Texture in the Diffuse slot.
Click the 'None' button under Source Particle System and select the Particles [ WetMap ] of [ PhoenixFDLiquid001 ] node in the Scene Explorer.
Set the Particle Area Radius to 5cm to avoid noise artifacts in the generated black&white texture.
Hit render - only the stones which interact with the liquid should now render white.
Even if the Phoenix FD Simulator is hidden, the Particle Texture can access the WetMap particle group and use it at render time.
Create a V-Ray Blend Material and assign it to the riverStones geometry.
Plug the Phoenix FD Particle Texture you just created into the Blend1 slot and unplug it from the V-Ray Material's Diffuse slot.
Rename the V-Ray material to mat_dry or something along those lines and pipe it into the Base slot of the Blend material.
Add a second V-Ray material, rename it to mat_wet and plug it into the Coat1 slot of the Blend material.
Here's how this works:
- The Phoenix FD Particle Texture generates a black&white map (i.e. a mask).
- The Blend parameter of the VRay Blend material expects a mask used to specify whether to use the Base material, or any of the Coat materials, or a blend between them).
- When you plug the Phoenix FD Particle Texture in the Coat slot, the Blend material will use the Base material for the black areas of the texture and the Coat material for the white areas.
- As can be seen from the image above, those correspond to the dry and the wet areas of the scene. All that is left to do is tweak the materials to get the desired appearance. For this example, the Reflect color of mat_wet is set to RGB [ 255, 255, 255 ] with a Glossiness of 0.65 so the wet stones are shiny.
Here's a rendered image of all the materials from the example scene that ships with the tutorial files.
The exact same setup is used to drive the V-Ray Blend material using a Phoenix FD Particle Texture reading the WetMap particle group of the Simulator.
The textures used to generate this image are also provided.
Unhide the Phoenix FD Simulator and assign a new V-Ray material to it. Rename the material to mat_water.
Set the Reflect and Refract colors to RGB [ 255, 255, 255 ] and the IOR (Index of Refraction) to 1.33. This is the physically-accurate IOR of water - you can use a search engine to look up the IOR of other materials in case your setup is different.
Set the Fog color to RGB [ 246, 251, 251 ] with a Fog multiplier of 0.2. We use the Fog color to tint the water. In the real world, water is tinted because of the microscopic particulates it carries which refract the incoming light. Using the Fog options is an efficient way to emulate this without significantly increasing the render time.
Foam and Splash Rendering
Here are the settings for the Phoenix FD Particle Shader used for the Splash particles:
Mode is set to Points, with a Size Multiplier of 2.0 to give the particles more volume. Feel free to experiment with the other Modes as well but keep in my this may increase your render times.
To speed up Bucket rendering, the Light Cache Speedup is set to 0.99.
For the Phoenix FD Particle Shader used for the Foam, the following settings are used:
The Mode is set to Bubbles, with a Light Cache Speedup of 0.99.
Under the Particle Shader → Cellular/Bubbles/Splash roll-out, the Refractive Index for the bubbles is set to 1.3.
V-Ray Frame Buffer Color Corrections
Optionally, you may want to add the following color corrections:
Exposure is enabled and the following settings are applied:
White Balance is also enabled and the Temperature set to 6350.
Final image of all scene elements combined.