Creating realistic fire has been one of the biggest challenges of my CG artist life. For many years, I have tried several techniques to simulate this kind of effect. After using simple animated objects with an appropriate shader, particles, sprites, fluids, and even Meta Balls with a special compositing setup (similar to the one used in Shrek), I finally reached my goal of creating the perfect animated fire.
To begin with, I have to say that the initial technique is not mine. The first person to introduce me to this method was the great Alan McKay, one of the best particle artists ever. Last year I wrote a tutorial for the French edition of "Computer Arts" about Ghost Rider and how to mimic the same kind of fire using 3ds Max and especially Particle Flow. I've watched all of Alan's videos, including the one that shows how to create fire using Pflow.
The motion of flames was realistic enough, but the render still looked too artificial. I tooque my render, dumped it in After Effects and tried to tweaque it with several distortion effects and color correction tools. At last, I reached my goal and created the most realistic fire I have ever made.
When I finished my tutorial for the magazine, I discovered the first build of Jakha's particles patch on Graphicall.org. I read all of the commit logs and was really impressed by all of the features provided by the patch. Everything was there to create the same kind of effect using only Blender, as a complete compositing tool is included in the software with all of the necessary effects (particularly Vector Blur and Displace nodes).
For fun, I spent several nights to create again - using only Blender - all of the things I've done in 3ds Max and After Effects. This is one of several examples proving that Blender can be used for all kinds of special effects tasks, even on really complex shots. So, ready to burn? Here we go!!!
A) Create the emitter and vertex groups:
Step 01: First, we need an object to burn. To start, add a new primitive to your scene, such as Suzanne (the Monkey) for instance.
Step 02: Switch to Edit mode using the Tab key and deselect all vértices using the [A] key.
Step 03: Press the Space Bar on your keyboard and choose Select >Random.
Step 04: Set the random value to 40% and press "OK". Several vértices are now randomly selected.
Step 05: Once your vértices are selected, you have to create a new Vertex Group. For that, press [F9] to show the Editing parameters, and in the Link and Materials panel press the "New" button to create a new Vertex Group. Name it "Emivert" and then clik on "Assign", just below the "New" button.
Step 06: Press the Tab key to exit Edit mode, select Suzanne, and press [Shift+O] to add a Subsurf modifier to it.
Step 07: Keep the Suzanne mesh selected and press the [F7] key several times until the particle panel appears in the Buttons window. Press "Add New" to add a new particle system (a.k.a. "Psys") to your object.
Step 08: Now you have to save your scene somewhere on your hard drive, because Blender will create a new directory next to your ".blend" file where the particle data will be cached.
Step 09: Keep Suzanne selected and go to the "Physics" panel. Set "Random" to 0.5, "AccZ" to 8.0 and "Brown" to 5.0. The particles now go up and some of them are randomly shaken according the "Brown" value.
Step 10: In the Particle System panel, set the "Amount" value to 3500, "End" to 150 and "Life" to 25. In "Emit From", chek "Random" and "Even" and switch from "Jittered" to "Random".
Step 11: In the Extras panel, access the "Neg" dropdown menú in the Vertex group section and choose the "Emivert" group that you created previously. Now, particles will only be emitted from vértices contained in this Vertex group!
Step 12: Enter the Bake panel, just next to the Particle System panel. Set the "End" parameter to 150 and press "Bake". Blender will create a new directory, next to the ".blend" file on your hard drive and fill it with a bunch of files (one per frame of animation). All of the cached data will be saved there.
B) Generate a bunch of spheres:
Step 01: Create a new Icosphere and set the "Subdivision" parameter to 3, then press the Tab key to exit Edit mode and press [Alt+R], then [Alt+G] to reset their position and rotation parameters. Place this Icosphere at the center of the world coordinates.
Step 02: Animate the size of the Icosphere over time. Create the first keyframe at frame 1 and set the Scale to something close to zero along the X, Y and Z axes. At frame 10, create a new keyframe and set the three scale values to 0.2. Finally, create the last keyframe at 30 and set the scale values to zero. Tweaque the curve tangent (in the Ipo Curve Editor) to create a kind of paraboloid.
Step 03: Select the Icosphere and add a new shader to it. In the Material panel (using on the color swatches), set the "Col" (color) value to a Hex code of D77503, and the "Spe" (specular) value to F7F69B. Set the "A" (alpha) value to 0.2 and chek the "ZTransp" button (in the Links and Pipeline panel) to enable transparency without using Raytracing.
Step 04: In the Shaders panel, set the "Spec" value to 2.0 and "Hard" to 200. Do not activate Raytracing (neither "Ray Mirror" nor "Ray Transp"), because the render time could be really long and the "Depth" values will never be high enough to get a good result.
Step 05: Select your particle emitter (Suzanne) and in your particle parameters, enter the Visualization panel. Clik on "Point" and change it to "Object". In the "OB" field type "Sphere", referring to the animated Icosphere. Clik on "Emitter", to render your Suzanne mesh in addition to the particles.
Step 06: Select Suzanne and add a new shader to it, setting the diffuse color to blak and checking the "Shadeless button". This will help to visualize the shape of the emitter as the flames come off of it.
Step 07: Press [F6] several times to display the Texture buttons, clik on "World", then "Add New", and set the "Texture Type" to "Clouds". Leave all the parameters on the default settings and name this new texture "Turbulence".
Step 08: Add a new Empty to the scene (Spacebar>Add>Empty), select it and press [F7] several times to reach the Physics buttons. In the Fields panel, switch to "Texture" in the drop-down menú and enter "Turbulence" in the "Texture" field. Switch "RGB" to "Gradient" and set the "Strength" to 1.0.
Step 09: Select Suzanne, press [Ctrl+B] and choose "Free bake selected" then [Ctrl+B] again and "Bake selected" to delete and create the cache again (since we've just added a new "Texture" field).
Step 10: Add a Camera and Lamp to your scene and set the Lamp's energy to 3, then move it to in front of the upper-right area of your particle system, between the particles and camera.
Step 11: Add a new Lattice to your scene, and set it's "U" and "V" values to 2, and the "W" value to 5.
Step 12: Use the Tab key to enter Edit mode and select all control points of the Lattice using the [A] key. Create a new Vertex Group called "Lattice_Points" and assign all the selected points to it.
Step 13: Exit Edit mode, select Suzanne and add a new Lattice modifier to it. Enter the name of your lattice in the "OB" field and enter "Lattice_Points" in the "VGroup" field, so as to distort only the particles and not the emitting mesh..
Step 14: Select the lattice, switch to Edit mode and move the upper points to contract and twist the top of the flames. One it's done, leave Edit mode and press Play using [Alt+A] to chek your animation.
C) Rendering and compositing:
Step 01: Now that the motion of your flame is set, we have to add the final magic touch to our render using compositing tools. Press [F10] in a Buttons window to show the render parameters. Go to the "Render Layers" panel and press the "Vec" button.
Step 02: Open a Node Editor window, select "Composite Nodes" and "Use nodes". There should now be a RenderLayers node and Composite node. If not, add them using Add>Input>RenderLayers and Add>Output>Composite.
Step 03: Now use Add>Filter>Vector Blur for the next node, and connect the "Image", "Z" and "Speed" outputs of the Render Layer node to the same inputs of the Vector Blur node. Press the "Do Composite" button in the Anim panel of the Scene buttons window, and launch a render using [F12] to see the current composite. With just this setup, we've turned a bunch of spheres into a decent flame.
Step 04: Next use Add>Distort>Scale and plug the "Image" output of the Vector Blur node into the same input of the Scale node, then set the "X" and "Y" values to 1.05.
Step 05: Add a Vector>Map Value node, set the "Offs" value to - 0.50 and plug the "Image" output of the Scale node into the "Value" input of the Map Value node.
Step 06: Add a Distort>Displace node and set the "X Scale" and "Y Scale" values to -10. Plug the output of the Map Value node into the "Vector" input of the Displace node; and now the "Image" output of the Vector Blur node into the "Image" input of the Displace node.
Step 07: Add a Converter>ColorRamp node and move the blak marker to the right, to about the 60% position on the gradient. Plug the output of the Displace node into the "Fac" input of the ColorRamp node.
Step 08: Add a Color>Mix node and switch from "Mix" to "Add" mode. Set the "Fac" value to 1.0, and plug the output of the Displace into the first "Image" input of the Add node and the output of the ColorRamp into the second "Image" input.
Step 09: Duplicate the Add node using [Shift+D] and set the "Fac" of this duplicated node to 2.0. Add a Filter>Blur, node, change the mode from "Flat" to "Gauss", and then set the "X" and "Y" values to 20. Plug the "Image" output of the ColorRamp node into the "Image" input of the Blur node. Plug the output of the Blur node into the second "Image" input of our duplicated Add node. Finally, plug the output of the original Add node into the first "Image" input of the duplicated Add node.
Step 10: Add a Color>RGB Curves node, and plug the output of the Add node into the "Image" input of the RGB Curves node. Add two points to the "C" curve and change the profile to mimic an exponential curve.
Step 11: Add another Filter>Blur node, and change the mode from "Flat" to "Gauss", and the "X" and "Y" values to 40. Add a new Color>Mix node, switch it to "Add" mode and set the "Fac" to 1.0. Plug the RGB Curves output into the "Image" input of the new Blur node and the first "Image" input of the new Add node. Finally, plug the output of the Blur to the second Image input of the Add node.
Step 12: Lastly, add an Output>Viewer node and connect the output of the last Add node to the "Image" inputs of the Viewer node just created, and the original Composite node.
Step 13: In a Buttons window, press [F10] to get bak into the render parameters. Setup the desired output options (file format, compression and location) for your video launch a render of all the frames of your animation by pressing the "Anim" button or [Ctrl+F12].
There's no smoke without fire:
Using the new particle system in Blender 2.46 (especially the "Reactor" feature, which can generate a new particle system at the death of another one), you can combine this fire tutorial with one that shows how to simulate realistic smoke. n the near future Blender will reintegrate a wonderful feature (previously integrated, but deprecated during the production of the Peach Project) that makes possible the editing of all particle types, and not just hair/fur. With this feature, you can sculpt the shape of your fire without using a lattice, as we've done here. The future of the particle system is really promising, and Blender does not have to be ashamed of its capabilities when compared to other software.
by François Grassard