This page provides a step-by-step guide to creating a gasoline explosion simulation in Phoenix FD for Maya.
This tutorial shows how to create a fiery explosion with an accelerant like gasoline in Phoenix FD for Maya. Using both its toolbar preset, and then again manually, step-by-step you'll learn the ins and outs of this simulation type.
By the end of this tutorial, you will be able to create your own gas explosion simulation and know the basics of editing a number of primary settings for the sim.
If you haven't already watched or read the previous QuickStart on Basic Liquids, you might want to check that out before completing this one.
To follow this tutorial, you need the Phoenix FD for Maya plugin installed. This page is a companion to go along with the QuickStart video posted on our YouTube channel and available here:
To download the files used in this tutorial, please click the button below.
We will begin by using the quick preset, then move on to setting up the simulation manually.
Gasoline Explosion Preset
Starting in a blank scene, create a sphere that will be the source of the simulation. Set its Radius to 24.
With the sphere still selected, click the Gasoline Explosion preset from the Phoenix FD shelf. This creates the simulation container with the sphere as the source.
Click the Start Simulation icon and Phoenix will begin simulating the gasoline explosion.
When there are enough frames to clearly view the simulation result, stop the simulation using the Stop icon. A nicely detailed explosion is produced.
Manual Fire Setup
To get a deeper look at the workflow, let’s take a look at setting up this simulation manually. With the simulator selected, click the Clear simulator cache icon in the shelf to delete the cache from the scene.
Select the Simulator and Fire Source node and delete them, leaving just the sphere in the scene.
In the Phoenix shelf, click on the Create Phoenix FD Fluid Simulator icon and click-drag to create the volume's width and depth around the sphere. Then click-drag again to define its height.
Select the Simulator and in the Attribute Editor, open the Grid section and change Units to meter so our simulation will be a large-scale explosion. This makes the sphere 24 meters or about 72 feet wide.
It's important that the simulation object is set to the proper real-world scale so that the simulation is correct for that situation.
Set the Units Scale to 1.0 to keep from scaling the sim any further. The sim should be about 190x148x100 meters which is pretty big, but it is the right size for the type of simulation.
Move the sphere to be more centered at the bottom of the volume.
Now that the simulator volume is set up, we need to define a source next. Click the Create Fire/Smoke Source icon in the shelf and place it off to one side in the scene.
Select the sphere and then shift-select the Fire Source and click Add Selected Objects in the Attribute Editor. This specifies the sphere as an emitter for the explosion.
The Source node controls several simulation settings. With it selected, navigate to the Attribute Editor and turn off the Temperature and Smoke options and turn on Fuel.
The Discharge attribute controls the speed of the discharged fluid, so increasing this value will discharge more fluid into the sim. Since we are creating an explosion, we’ll need to discharge a large amount of fluid over a short amount of time. To do so, we will animate the Discharge. Go to Frame 1 and set Discharge to 2200 and set a keyframe. Go to the next frame, and keyframe Discharge to 0.0.
Key set at Frame 1
Key set at Frame 2
Select the Simulator and in the Attribute Editor, go to the Fuel rollout and turn on Enable Burning.
In the Grid rollout, notice the Total Cells count is over 353 million. Increase the Cell Size to 1.5 to reduce the overall resolution of the sim to speed it up. This gives us just about 840,000 Total Cells.
Expand the Fuel rollout. The Ignition Temperature is the temperature at which our fuel ignites and burns. Phoenix FD uses 300 Kelvin as the default temperature in a sim, so if you set a value slightly below that, such as 290 the fuel will ignite inside the volume. Start the sim again, and the explosion will begin to simulate.
The explosion is not looking quite right yet. The blast is clipping at the edges of the simulator volume, and the preview quality very low.
To fix the preview quality, expand the Preview rollout and scroll down to the bottom of the section. Expand the GPU Shade Preview sub-section and check Enabled.
Go back up to the Grid settings, and change Adaptive Grid to Temperature/Liquid. This automatically expands the grid volume depending on the fluid temperature meeting the specified Threshold. Set the Threshold to 800 and start the sim.
If you experience clipping of your smoke, set adaptive to Smoke with a Threshold of 0.02.
The grid now expands as needed, thus preventing the clipping from earlier. However, the simulation is currently expanding in all directions. We can limit the expansion so that the explosion can interact with the bottom of the volume where there might be a ground plane.
Stop the sim, and go back to the first frame. Set your Container Walls to a Y axis of Jammed(-). This allows the explosion to react to the bottom of the volume (which represents the ground).
Simming again will show improved results, but the effect is too uniform.
Expand the Dynamics settings and scroll down to the Conservation section. Increasing the Quality attribute allows the sim to spread out a bit more and to swirl better. Set the value to 80. The higher the value, the more simulation time is needed, so be careful not to set it too high.
Turn on Uniform Density so the sim will ignore the mass of the fluid. This is useful for smoke and explosions. Next, reduce the Steps Per Frame to speed up the sim time.
Start the sim and notice the sim uniformity breaks up a bit. It's a start, but not quite enough yet.
Next, we will add noise to the sim. Select the Source object, and in the Fluid Discharge rollout, increase the Noise value to 10. Sim again and the explosion’s shape will break more.
The result currently has a lot of smoke. Let's reduce that a bit to give the simulation a fiery appearance. In the Fuel rollout, reduce the Smoke Amount to 0.4 to allow for more burning for a brighter fire. Increase the Smoke Threshold to 1.0 to reduce the amount of fuel that becomes smoke.
Lastly, lower the Propagation value to 2 to reduce how fast the fuel propagates through the sim.
Start the simulation again, and you'll notice better results. Currently, the effect is too explosive.
Now, reduce the Energy to 5 to decrease the explosiveness. Decrease the Fuel Depletion to 0.8 to lower the rate at which the fuel burns up.
Stop and restart the sim and you'll see the result better resembles a large explosion.
Now that we have achieved the general effect, let's increase the resolution to get a higher quality result. In the Grid rollout, set the Cell Size to 0.75 and resim the explosion. Note the increased simulation time per frame.
Next, we will focus on improving how the simulation is rendered. Expand the Rendering rollout and then expand the Fire sub-section. Notice there are three options for the Fire Opacity Mode that will control part of the look. Choose Use Own Opacity.
The graph here controls just the opacity of the fire. Double click to add a new point to the curve. Drag a point down to reduce the opacity of the fire, revealing more of the internal fire content, making the fire look brighter. Drag a point up to increase the opacity to hide more of the internal structure. Click the Expand button to view a larger version of the graph in a separate window. Add several new points and create a curve in a wave-shape as seen in the graph below. This will add more visual interest to the explosion.
However, this thinned out our smoke. Expand the Smoke Opacity settings and set the Simple Smoke Opacity value to 0.9. This will produce thicker smoke in areas of the sim.
Expand the Smoke Color settings. Set the Constant Color to a darker gray to produce deeper, darker smoke.
Reduce the External Scatter Multiplier to 0.5 so that the light inside the smoke scatters less, and you should notice a slight darkening of the smoke.
The fire in the simulation is fairly bright. In the Fire rollout, set the Opacity Multiplier to 0.3 and the fire gets even brighter.
If you lower the Physically Based value, to something like 0.7, more red and orange colors are added to the fire. The slider balances between how much of the fire intensity comes from the color gradient plus the fire multiplier versus how much is calculated using the physically-based black body shader.
Increasing the Fire Multiplier to 5.0 creates more fire inside the explosion.
Next, let's adjust how quickly areas of the explosion cool off. Expand the Dynamics rollout, and increase the Cooling value to 0.3. This change will affect the simulation behavior, so we will need to simulate the explosion again.
In the Grid settings, lower the resolution of the sim by increasing the Cell Size to 1.5 to speed up the simulation. Restart the simulation.
Simulate enough to see the new changes. Enable V-Ray in Render Settings, and then render a frame.
With the render, it becomes clear that the Maya default lights are affecting the scene. In the Render Settings, go to the Overrides tab and under the Lighting rollout, turn off Default lights.
Render again, and notice that the smoke is lit only by the fire itself.
Let's add a ground plane next. Navigate to the Create menu and select V-Ray > Create V-RayPlane. Move it down slightly so that it is below the volume grid. Render again and we have a ground lit by the explosion. Currently, it is lighting the plane a bit too much.
To reduce the bright lighting cast from the explosion, select the Simulator, and in the Rendering settings, expand the Fire Lights sub-rollout. Reduce the Light Power on Scene value to 0.4.
Go the Grid section and set the Cell Size back down to 0.75 to increase the sim resolution, and restart the simulation to see this explosion resolve with a higher quality.
Here is a look at the final simulation in the viewport:
Applying the Sim setup to a Real-world Example
Open the file Barrels_start.ma provided in the Assets section above. It includes three metal barrels in the scene lit by a sunlight, and a rendering camera called camera1. Select the first barrel on the far left and select the Gasoline Explosion preset in the shelf. Set the Cell Size to 3.0 for a faster sim speed.
Start the sim and our barrel explodes!
Let’s get the other barrels to explode as well. Stop the sim, and take a look in the perspective view. Select the source locator object and press Ctrl+D to duplicate it and move it over a little so it's not overlapping the original. Select the barrel on the far right, shift-select the duplicated source and click Add Selected Objects to this new source.
Source 2 Attribute Editor
Now if we start the sim, both the barrels start exploding at exactly the same time. We will offset the second barrel to make it look as if the first explosion sets off this second explosion.
Select the second source, set a keyframe on the Discharge to 0.0 at Frame 5. Then at Frame 6, set Discharge to 3000 and keyframe. At frame 7, key the Discharge back to 0.0 again. Run the sim, and you can see that the first explosion sets off the second explosion.
Now we'll add the third barrel to the explosion. Stop the sim. Duplicate the second source with Ctrl+D and go to Frame 1. Select the middle barrel and shift-select the third source and click Add Selected Objects.
Notice that the Discharge for the third barrel is already set at 0.0 because we duplicated it, and the keys don’t transfer over with a simple Duplicate in Maya.
Go to frame 40 and key the Discharge for the third Source at 0.0, At Frame 41 key it at 3000 and then at Frame 42, set Discharge back to 0.0. Start the sim and you can see, as the first two explosions begin to cool off there is a third explosion that heats things up again.
Render a frame, and see what we have at this point.
Select the Simulation, and set the Cell Size back to 1.5 and restart the simulation for a more detailed sim.
And here's what the final rendered scene looks like: