Page History
This page contains information on how Phoenix simulations work internally. Steps for setting up a simulation can be found on the Getting Started with Chaos Phoenix FD page.
How does Phoenix's fluid solver work?
...
Phoenix's fluid simulation calculates how a fluid would evolve during a period of time. While you might be familiar with the term fluid as meaning "liquid", in physics the term fluid refers to both liquids and gases. When this documentation refers to a fluid, it means liquid or fire/smoke. The simulation runs in sequential steps, and at each step the fluid is calculated a little further in time ahead of the previous step. This way each new step depends on the previous step, and a new step cannot start before the last one has already finished. This is one of the biggest differences between distributed rendering and distributed simulations - e.g. if you want to simulate 100 frames, you can not run frames 1-50 on one machine and frames 51-100 on another machine simultaneously.
...
While the simulation runs, it's in the background, and the user interface of 3ds Max remains active. You can change many simulation parameters (except for a few initial core parameters) during the simulation and see how they affect it. Rendering is also enabled during simulation, so you don't have to wait until the end of the simulation to render images and see how the simulation looks and fits into the scene.
Particle vs. Grid-Based Simulation
...
There are two main approaches used in simulation systems:
...
A third hybrid method between particle and grid simulations are the FLIP simulations, which Phoenix uses for liquids. FLIP simulations take the best from both worlds and produce much realistic liquid effects quickly. FLIP liquid simulations were first added in Phoenix 3.0. Before that, liquid were simulated using the grid solver. In Phoenix 3, you can still open and simulate older scenes saved from Phoenix 2 using the old grid liquid solver. Note that Phoenix uses pure particle simulation for the secondary particle systems such as Foam, Splash, WetMap and Mist as these are simpler and don't suffer from issues that liquids in pure particle or grid simulations have, such as having to maintain volume and not collapse on themselves if put in a large container.
Fire/Smoke vs. Liquid Simulation
...
Simulations performed by Phoenix FD can Phoenix can be roughly divided into two major categories:
...
These categories are for convenience only, and are not rigid. Once you've created a few basic simulations and have become more familiar with Phoenix FD, you will have a better grasp of how the tools work, and when creating an effect that is not strictly fire or liquid you'll know how to represent it most efficiently. For example, sparks or thin smoke might seem to fall into the "fire" category, but in practice these effects might be better served by particles and thus could use some of the tools designed for liquids.
Simulation and Rendering
...
The results from Phoenix simulations are saved to cache files. After that, Phoenix can read this cache data for quick viewport preview, or for rendering. Fire/smoke simulations usually produce grid voxels and can additionally produce particles that accompany and enrich the fire/smoke effect. Liquid simulations mainly produce particles and Phoenix can also automatically convert them to voxels when saving cache files during simulation.
...
Rendering reads the data from the cache files and converts the physical data such as Smoke, Tеmperature, Velocity, etc. into render data such as color and opacity. Note that the render settings can not be kept into the data cache files because they are different for each different renderer.
Simulation Channel Setup
...
Each simulation requires a simulator node to be present. This box-shaped container represents the grid in the scene, and the simulation takes place inside it. This object's parameters hold all the information about the simulation such as cache content, shading, and physical position in addition to parameters needed to run the simulation such as the start frame and steps per frame.
...
An additional benefit of using channels is that you can perform a resimulation with all the channel data from the previously created simulation.
Anchor | ||||
---|---|---|---|---|
|
...
As already explained, at each simulation step, Phoenix FD reads Phoenix reads the scene and calculates the fluid Advection and Conservation. Depending on the core settings, one or more additional operations can be included in the process. These operations are:
Fancy Bullets | ||
---|---|---|
| ||
Anchor | ||||
---|---|---|---|---|
|
...
The burning process requires Fuel and Smoke as additional channels (they will be included automatically). As in the real world, the burning process converts the fuel into smoke and produces some heat which expands the fluid. There is no separate channel for oxygen, however it is taken into consideration using the smoke and the fuel to be calculated. The relation is oxygen=1-fuel-smoke. The energy of the fuel controls how much heat will be produced and the inflation/expansion rate controls how fast the ignition will propagate.
For convenience the second parameter is just called Propagation, but advanced users should keep in mind that the real meaning of the parameter is inflation/expansion rate.
Anchor | ||||
---|---|---|---|---|
|
...
The cooling reduces the temperature due to the IR emission. It should not be confused with the cooling caused by convection. Cooling is a very complicated process, similar to calculating Global illumination in rendering. As a result, a simplified cooling formula is used.
Anchor | ||||
---|---|---|---|---|
|
...
The vorticity confinement keeps the small turbulences alive. It's natural for grid fire/smoke fluid solvers to lose fine details both in the density and in the velocity of simulations. Vorticity Confinement is a method for bringing these small details back and making the fluid more turbulent. However, classic vorticity tends to overcompensate and tear the fluid up too much, breaking the large-scale rolling of smoke and fire. In such cases, Phoenix's Massive Vorticity comes in handy - it does not allow the fluid to go wild and completely lose its shape and works well for both quick and slow moving fluids.
Anchor | ||||
---|---|---|---|---|
|
...
By default, the grid and particles in a simulation interact with scene objects. For example, in a liquid simulation, the liquid will bounce off or flow around any geometry it encounters.
There are three types of external objects that can interact directly with the simulator:
Fancy Bullets | ||
---|---|---|
| ||
In every simulation step, all the nodes in the scene are enumerated and processed whether or not they belong to one of the above mentioned groups and have permission to interact with the simulator.
Anchor | ||||
---|---|---|---|---|
|
...
All geometry objects in the scene are considered to be rigid bodies. They can affect the simulation in three different ways:
...
Another Phoenix simulator can also be used as Rigid body. In this case, the Surface Channel is used to determine the surface.
Anchor | ||||
---|---|---|---|---|
|
...
The particles can interact directly with the simulation only as sources, depending on the Emit Mode (Inject or Brush) of the Fire Source | PhoenixFDSource. The velocity of the injected fluid is the velocity of the particle, which allows the fluid to be involved in the particles' motion.
Anchor | ||||
---|---|---|---|---|
|
...
Forces create a region or "field" around them which can change the velocity of the fluid in two different ways:
...
Fluid Buoyancy and Density
In nature, buoyancy and density are strongly connected. However, for more flexibility, the Phoenix FD simulator Phoenix simulator considers them to be independent of each other.
Buoyancy
In nature, the buoyancy is the difference between the local density and the environment density. This determines the local result from the forces applied over the whole fluid. In Phoenix FD, the buoyancy is determined by the temperature, the fuel and the smoke. The buoyancy is used when the embedded gravity is applied or when a Gravity field is used. The temperature determines the buoyancy just as with real gasses. The temperature above environment temperature means positive buoyancy, where the environment temperature is 300 Kelvins (23 degrees Celsius). The smoke and fuel determine the buoyancy using their coefficients of buoyancy as given in the simulator. The total buoyancy is the sum of these three parts.
Density
In a fire/smoke simulation, the conservation process uses the density to determine how large the change in the velocity of each cell is going to be. If the Uniform Density option in the Dynamics rollout is disabled, Phoenix FD uses the temperature to determine the density; the higher the temperature, the lower the density is. Unlike the buoyancy, the density is not affected by the amount of smoke and fuel in the voxel.
Example: Uniform Density Parameter
How does density affect the simulation from the non-physical point of view? In this example, we have two jets of gases: a cold one and a hot one. When directed into a collision course, the cold jet will prevail over the hot jet due to its higher density.
Section | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Adding Fine Details
...
There are two direct methods that can be used to add fine details in the shading. In order to enhance the realism of the movement of small details in the fluid, V-Ray comes with a Particle Texture called Particle Texture | PhoenixFDParticleTexture. When used in combination with a particle system driven by a Phoenix Simulator, the particle texture is capable of properly animating the small details along the fluid surface.
...
Fancy Bullets | ||
---|---|---|
| ||
|
Surface Driven vs. Volumetric Displacement
...
Displacement in Phoenix FD works Phoenix works by shifting the point of sampling with an offset, the direction of which is determined by the gradient of the effects channel while the distance is determined by the brightness of a given map. There are two different modes used to sample the aforementioned map, switched by a checkbox in the rendering rollout. If the checkbox is NOT checked, the map is sampled at the point of shading, and we call this "volumetric displacement". If the checkbox is checked, the coordinates are first projected over the surface as determined by the effects channel. The point of projection is then used as map coordinates. We call this "surface driven displacement." Surface driven displacement is slower and requires some initial calculations, but it keeps the topology of the iso-surfaces. Volumetric displacement is faster, but tends to produce island-like formations if the displacement value is too big. Beside performance, volumetric displacement has one more important advantage: it does not require the distinct surface of the effects channel. Therefore, it will work fine in scenes where surface-driven displacement produces flickering.
...
Example: Surface Driven vs Volumetric Displacement
Section | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Fire Opacity Modes
...
There is a well-defined connection between the transparency and the emissive light in the real world. As an example, for smoke (diffuse light), the connection is pretty clear and everyone has intuitive sense of how it works. For the emissive light, however, most of the people will give the wrong answer when asked, "Is a smokeless fire fully transparent?" The common, yet wrong, answer is, "Yes it is. If there is no smoke, the flame is fully transparent and will cast no shadows." However, the correct answer is "No, the fully transparent gases cannot emit any light, even if they are hot enough." This is why acetylene flame is less bright than a candle, despite its higher temperature. It just produces less smoke. However, this way of shading can seem strange and inconvenient, because there is no clearly separated control over the smoke and flame. Be careful when trying to achieve denser smoke, because the result can be an undesired brighter flame.
For this reason, Phoenix FD provides different modes of shading: physical and detached. This is controlled by the Fire Opacity Mode parameter in the Fire rollout. In Fully Visible mode, the emissive part is fully independent of the transparency and you are not obligated to keep in mind the aforementioned connection. In Use Smoke Opacity mode, the smoke's alpha controls the Fire's opacity. There is also the Use Own Opacity mode where the fire has a separate opacity curve that can be adjusted independently from that of the smoke.
Foam and Splashes
...
The PhoenixFD Phoenix solution for creating foam and splashes is particle based and is achieved by two relatively separate features - a foam/splashes particle simulator and a foam/splashes particle shader. The particle simulator is embedded in the PhoenixFD Phoenix Simulator node and exports its content via PhoenixFDPGroup nodes, supporting position, velocity, size and id channels. The particle shader is designed as a separate component: Particle Shader. This component can render PhoenixFDPGroup and any standard particle system that exports position, size and velocity channels.
Anchor | ||||
---|---|---|---|---|
|
...
The Particle Shader node can render the particle systems in several different ways - as separate bubbles/droplets, as points, as mist, or as fog. In fog mode, the bounding box of all particles is calculated and a grid based shader is constructed using the bounding box and the fog resolution parameter. This mode is most suitable for surface foams, when the grid height is relatively large and the particle count is huge. The other mode (particle-based shading) is more complicated and interesting; it allows us to achieve a larger variety of effects. One reasonable question about this mode is why we need it, when one can render each particle as geometry with the proper material instead. There are several advantages, but the most important one is the ability to convert the scattering into diffuse color, which gives the natural bright appearance of the foam and the splashes. Another important advantage is cellular mode, which allows shading of close-up foam.
There are three different modes of shading for spherical particles - bubbles, cellular, and splashes. In each mode, a particle is represented as a sphere with a radius equal to its size and with certain optical properties. The "bubble" and "cellular" modes are intended for foam rendering and have the same optical properties of the surface. They differ in the geometry representation only - bubble mode uses simple spheres, whereas cellular mode builds polyhedron-like cells, similar to real foam. The cell walls are not flat, but slightly curved, which provides a more realistic appearance.
...
Example: Rendering of Foam and Splashes
Section | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Resimulation
...
In order to perform resimulation, the base simulation must be processed first, and its Velocity channel must be exported. Then, to enable the resimulation, the Enable option in the Resimulation rollout must be checked. While this option is enabled, the simulator works in resimulation mode (i.e. all simulator functionality is now related to the resimulation).
...
Fancy Bullets | ||
---|---|---|
| ||
|
Particle System Nodes
...
The cache file can contain multiple particle systems, for example foam particles and splash particles, each of them with its own channel set. The particles are represented in the scene by hidden objects named in a specific manner. For example, the object representing the liquid particles of the simulator PhoenixFDLiquid01 is called PG [Liquid] of system [PhoenixFDLiquid01]. These objects obey the Maya standards for particle systems, allowing their content to be accessed by 3rd party software.
Render Channels, Diagrams and Gradients
...
After the simulation, cache files containing the exported physical channels are produced. In the real world, the connection between the physical quantities and the visual appearance is well-defined. However, for more flexibility in Phoenix FD , the user is allowed to choose how the render elements depend on the physics. For example, in the real world, the temperature determines the emissive color; however, in Phoenix FD, the velocity can be set to determine the emissive color instead of the temperature. The physical channel used to determine any given render element is called a source, and the dependence between the physical quantity and the render element is determined by tables called palettes. For the rendering of the volumetric content, three render elements are calculated for each point: emissive color, diffuse color, and opacity (alpha). To calculate each of them, the shader performs the following steps:
...
The control over the above mentioned process is arranged in Fire, Smoke Color, and Smoke Opacity rollouts where the user can choose the source and the palette for each channel. For the emissive color, both a diagram and a gradient are used, because–as opposed to the diffuse color–it can be outside the range 0-1. When this happens, the gradient will appear saturated. For each render element, the user is also allowed to select a texture map as the source channel. In this case, the palette is skipped and the sampled color is used directly.
Anchor | ||||
---|---|---|---|---|
|
...
There are several particle types that the PhoenixFD Simulator exports:
...
The simulation of the particles is very different for each type. The simplest one is the "drag". This type of particle simulation generates particles that are just dragged with the fluid. The second type (by complexity) is the splashes type. The splashes are just left in free fall until they hit some object or the water surface. The free fall is not the simplest one, it is affected by the movement of the air (do not forget that Phoenix simulates the air too, not just the liquid!) and the air-splashes interaction is controlled by the air friction parameter. The most complicated type is foam. The foam particles interact not only with the fluid, but with each other as well. This interaction produces a repulsive force when the particles are too close, and an attractive force when they are not, ensuring the foam's consolidation. This process is the most expensive one and is controlled by the B2B interaction parameter. When only surface foam is needed, the aforementioned process can be switched off by setting the parameter to zero.
Notes
...
Fancy Bullets | ||
---|---|---|
| ||
|
...