Overview

How to setup simple simulation

General Concepts

Simulation

The simulation workflow

Burning simulation
Cooling
Pressure decay
Vorticity confinement

External objects

Rigid bodies
Particles
Space warps

Simulating liquids

Buoyancy,inertia and density

Buoyancy
Inertia
Density

Rendering

Rendering Mechanism
Channels, diagrams and gradients
Physical vs. detached shading
The effects channel
Special rendering modes (Geometry mode)

Pure geometry mode
Heat haze mode
Solid mode

Adding fine details

Texture modulation
Displacement

Surface driven VS Volumetric displacement

Overview

Phoenix FD is a fluid dynamics simulator that is intended to create a wide range of effects related to burning, explosions, smokes etc.

 

The working process in Phoenix can be divided in two main parts: simulation and rendering. The result of the simulation is sequence of files, containing per-cell quantities called "channels" (temperature, velocity etc.) and these files are used afterwards in the rendering.


The simulation is done in background mode and the UI of the 3ds max remains active. You can change the parameters (except few initial core parameters) during the simulation and see how this affects it. The rendering is also enabled and the user is not obligated to wait the end of simulation to see a single frame.

 

 

How to setup simple simulation

The minimal set needed for simplest simulation includes 3 objects: simulator, source helper and some geometry.

 


At this stage the setup is ready to be started, just go to "Simulation" rollout of the simulator and press start.

General concepts

Simulation


The simulation is performed in a box (called grid) divided into small cells, containing the fluid's properties at their coordinates (temperature,velocity etc...). The minimal set of the simulation core includes velocity and temperature as fluid properties and depending on the core settings, one or more additional channels can be added and will be dragged along the fluid. These additional channels are:

 


The UVW channel does not affect the simulation, it's just a helper channel that can be used in the rendering for texture mapping or directly as RGB value (see the multicolor sample scene). The default initialization of the UVW channel is with the local coordinates of the voxel, however the user can specify its own initialization by map or via MAXScript.

 

The simulation workflow


The core recalculates the grid content repeating three main actions:

 


Depending on the core settings one or more additional operations can be included in the process. These operations are:

 

 

Burning simulation


The burning process requires Fuel and Smoke additional channels (they will be included automatically).
Like in the real world, the burning process converts the fuel into smoke and produces some heat, that expands the fluid. There is no separate channel for the oxygen, however it is taken in 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 will the ignition propagate.
For user's convenience the second parameter is just called "Propagation", without any visible connection with the inflation/expansion rate, but the advanced users should keep in mind that the real meaning of the parameter is inflation/expansion rate.


Cooling


The cooling reduces the temperature due to the IR emission, it should not be mixed with the cooling caused by the convection . The real cooling is very complicated process similar to the Global illumination in the rendering, so here a simplified formula is used.


Pressure decay


In the real atmosphere the higher we are the lower the pressure is. For small scale simulations the effect is negligible, but for large scale simulations (like nuclear explosion) it plays a very important role, because the fluid inflates when moved at position with lower pressure.

 

Pressure decay - Off
Pressure decay - On

 


Vorticity confinement


The vorticity confinement keeps the small turbulences alive. Why we need such kind of correction? The fluid transport (advection) moves the grid content from cell to cell according the velocity. In the common case the movement of given point is not integer count of cells and this causes the content of the cell to be mixed with the content of the neighboring cells during the advection. As a result the fine details in the velocity tend to disappear and we should amplify them to make the fluid more turbulent.

 

External objects


There are three types of external objects that can interact directly with the simulator:

 


In every simulation step all the nodes in the scene are enumerated and processed whether they belong to one of the above mentioned groups and have permission to interact with the simulator.

 

Rigid bodies


All geometry objects in the scene are considered to be rigid bodies. They can affect the simulation in three different ways:

 


The Phoenix also can be used as Rigid body, in this case the effects channel is used to determine the surface.

 

Particles


The particles can interact directly with the simulation only as sources, depending on the source helper mode (inject or brush). The velocity of the injected fluid is the velocity of the particle, that allows the fluid to be involved in the particles' motion.

 

Space warps


The space warps change the velocity of the fluid in two different ways:

 


All the space warps in are supported. Warning! The space warps in 3ds Max do not support multi threading and this makes them slower than the included standard gravity.

 

Simulating liquids

 

The liquids are simulated in the same solver as the gasses, using one extra stage included in the pipeline, called "condensation". Like in nature, the condensation process concentrates vapours until they reach a "packed" state. There is no dedicated "liquid" channel in Phoenix FD, one of the usual channels (temperature, fuel, smoke) has to be selected to play this role. In Phoenix FD as "liquid" is considered value of 1 for the channel, and value of 0 is considered as "air". The values between 0 and 1 are considered "vapours". The first action that the user has to do is to select which channel will be considered liquid. If the temperature is selected as liquid channel, it looses its usual meaning and should be set also to 0/1. The fuel and the smoke can be selected as liquid channel keeping their role in the burning, i.e. if the fuel is selected as liquid, it will burn. The liquid simulation needs relatively high values of the conservation, especially when the liquid is placed in a vessel. It is hightly recomended to use forward transfer type of advection, especially when the liquid is flowing in curved groves and channels. The rendering of the liquids requires VRay and is carried out in solid mode. The recomended surface level is 0.5, but can be changed slightly for avoiding some artifacts.

 

Buoyancy,inertia and density

 

In the real world, these three values are strongly connected, but for more flexibility the Phoenix FD simulator considers them to be independent.

 

Buoyancy


In the real world the buoyancy is the difference between the local density and the environment density, and 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 some space warps are used. The temperature determines the buoyancy like in the real gasses - the temperature above environment temperature means positive buoyancy, where the environment temperature is 300K . The smoke and fuel determine the buoyancy using their coefficients of buoyancy given in the simulator. The total buoyancy is the sum of these three parts.

 

Inertia


The inertia gives the connection between forces and acceleration. In the real world the inertia is fully determined by the density of the fluid, but in Phoenix FD it is determined by the buoyancy multiplied by Forces mass multiplier parameter. If this parameter is 0, the inertia will be 1 regardless of the buoyancy, if the parameter is 1 the buoyancy and inertia are connected like in the real world.

 

Density


As we said in simulation workflow chapter, the core performs action called conservation over the velocity of each cell. The conservation process uses the density to determine how big to be the change in the velocity of each cell.If the uniform density option is off, Phoenix FD uses the temperature to determine the density - the bigger is the temperature is, the lower is the density. Unlike the buoyancy, the density is not affected by the smoke and fuel. This is designed in this way with two reasons in mind:

 


How does the density affect the simulation from the non physical point of view? For example if we have two jets of gasses, a cold one and a hot one, and we direct them in collision course, the cold jet will prevail over the hot one, because the biggest density.

 

Uniform density - On
Uniform density - Off

 

Rendering

 

Rendering Mechanism

 

Phoenix FD uses the standard 3ds Max atmosphere mechanism for rendering, except when working in the special rendering modes, . For this reason a special Phoenix atmosphere is registered immediately after the creation of the first Phoenix FD object, and this atmosphere takes care to shade the instances sorted by distance for correct blending. The sorting by distance gives good blending when the objects are not overlapped, however if they are overlapped is recommended to use geometry mode instead the standard atmosphere mode.

 

Channels, diagrams and gradients


After the simulation we have cache files containing the exported physical channels. 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 given render element is called 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 Colors and transparency dialog 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 opposite to the diffuse color, it can be outside the range 0..1 and the gradient will appear saturated in this case. For each render element the user is also allowed to select a texture map as source channel, in this case the palette is skipped and the sampled color is used directly.

 

Physical vs. detached shading


There is a well defined connection between the transparency and the emissive light in the real world. For the smokes (diffuse light) the connection is pretty clear and every one has intuitive sense of how it works, but for the emissive light most of the people will give wrong answer if you ask them "is the smokeless fire fully transparent?". The answer in the most cases will be "yes it is, if there is no smoke the flame is fully transparent and will cast no shadows". Actually the correct answer is "no, the fully transparent gases CAN NOT emit any light, even if they are hot enough" and this is the reason why the acetylene flame has less brightness than usual candle, despite the higher temperature, it just produces less smoke. The default shading of Phoenix FD is accorded to the physical laws and the transparency diagram affects both the emissive and the diffuse components. However, sometimes this way of shading can appear weird and inconvenient, because there is no clearly separated control over the smoke and flame, and the user should be careful when trying to achieve denser smoke, because the result can be an undesired brighter flame. For this reason Phoenix FD provides detached shading mode, in which the emissive part is fully independent on the transparency and the user is not obligated to keep in mind the above mentioned connection. The detached mode is turned on from the ignore alpha option in the emissive rollout.

 

The effects channel


Some rendering techniques (like solid rendering, displacement, etc) require a separate channel to work with, and for this reason the effects channel is provided. Most of them use the effect channel to calculate an implicit surface from its content, using the following rule: all the points with value of the channel above given threshold will lie inside the surface and all the points with value below the threshold will lie outside the surface. The solid mode gives the best look over the whole concept , because it makes the surface visible.

 

Special rendering modes (Geometry mode)


Some special rendering modes are available under V-Ray, and all of them are based on geometry representation of the plug-in, unlike the usual rendering mode, that is based on standard 3ds Max atmosphere mechanism. This means that if you disable the Phoenix atmosphere from the environment dialog, the plug-in will continue to render, because for V-Ray it is a geometry object, not an atmosphere.


Pure geometry mode


In this mode the appearance of the content is exactly like in the atmosphere mode, except for the ability to blend several overlapping Phoenix FD objects.


Heat haze mode


This mode is used to achieve effects of mirage and heat haze. In this mode the ray traced in the volume changes its direction at each step according to the content of the effects channel. It looks like this mode is similar to pure geometry mode, but is not. The shading is more similar to those of geometry with V-Ray refractive material, than the shading of atmosphere mode or pure geometry mode. Similar to the shading of refractive materials, the alpha is set to 1 for the rays intersecting the simulator's grid.


Solid mode


This mode produces a solid object with sharp surface, determined by the effects channel, and can be shaded using any material. The mode is demonstrated in the freezing flame and burning liquid example scenes, and is also useful as a helper when the displacement is arranged.

 

 

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 Phoenix FD comes with the Phoenix Particle Texture. When used in combination with a PF system, driven by a Phoenix Simulator, the Phoenix particle texture is capable of properly animating the small details along the fluid surface.


Texture modulation


This is the common way used in the fluid systems to add fine details. In the colors and transparency dialog you can see a checkbox titled "Modulate" near the texture slots for each render element. If this box is checked the corresponding render element will be multiplied by the value of the texture map, except the case when as source channel is selected texture.


Displacement


This technique is more sophisticated than the texture modulation and produces significantly better result. The idea of the displacement is similar to the usual geometry displacement, where the surface is moved along its own normal at a distance determined by a texture map. The nearest point of surface specified by the effects channel determines the direction for the displacement. There are three levels of displacement, the first two are coarse and the last one is fine. The coarse displacement changes the content of the grid directly, and the new content is passed to the next displacement level. The fine displacement works in a different way, changing the point where the grid is sampled. The whole coarse displacement is done in a pre-render phase, however the fine displacement is calculated during the rendering, except for some precalculated data.

 

The following examples were created using solid mode with displacement

 


No displacement
One level of coarse displacement
Two levels of coarse displacement
Two levels of coarse displacement and one level of fine displacement

Surface driven VS Volumetric displacement

The displacement in Phoenix FD works by shifting the point of sampling with an offset, the direction of which is determined by the gradient of the effects channel and the distance is determined by the brightness of a given map. There are two different modes used to sample the above mentioned map, swithed by a chackbox in the rendering rollout. If the checkbox is NOT checked, the map is sampled in the point of shading, and we will call this "volumetric displacement". If the checkbox is checked, the coordinates are first projected over the surface determined by the effects channel, and the point of projection is used as map coordinates, and we will call this "surface driven displacement". The surface driven displacement is slower and requires some initial calculations, but it keeps the topology of the iso-surfaces. The volumetric displacement is faster, but tends to produce island-like formations, if the displacement value is too big. Beside the performance, the volumetric displacement has one more important advantage - it does not require distinct surface of the effects channel. This means, it will work fine in scenes where the surface driven displacement produces flickering.

Surface driven displacement Volumetric displacement. *Note the small islands floating above the original surface