What do fire and water have in common? They are the bane of 3D animators everywhere. They are both very difficult to get right. A piece of software called RealFlow strives to make realistic water possible, but it is still expensive and time consuming. Most professional animation software has built in dynamic fluid simulation. They also have limitations. Maya, for example, can create impressive surface animation. It can even handle two different colour liquids mixing together. Impressive stuff. However, once the animation needs to extend beyond the surface, Maya fails. You can make a ripple in a pond. But, if you want a large splash, with particles of water leaving the surface, you have a lot of work to do. In fact, surface animation has become fairly simple. It’s easy to manipulate the geometry of an object. However, a large splash requires that object to split into many hundreds of smaller objects. There is no industry standard for making a splash. Every time I have seen a splash in an animated film, the animators seem to use a unique approach. Splashes are designed on a instance to instance basis. It’s very possible everyone is using RealFlow and simply adjusting the simulation quality to fit into their production timeline or artistic style. In any case, water is hard to make. Also, this post isn’t about water. It’s about fire.
There is a great article HERE (uh oh, the link died) about fire in video games. It has a bunch of pictures that show just how differently fire can be represented. From well-animated textures to red water, fire has always been in video games. The recent Uncharted 3 has one of the most impressive displays of fire I have ever seen. Fire is a very complicated thing to animate. It’s technically a fluid. Combustion emits gas. Fire is that gas glowing red hot. That sounds weird and may not be entirely true, but that’s exactly what it looks like. Heat rises. Extreme heat rises very fast. Fire is a chaotic dance of glowing gas that leaps into the air. Let’s look at some real fire:
I hope you didn’t watch the whole video. There are a few things worth noting about this video. Fire is very yellow. It’s white in the center and orange on the edges. I suppose it depends on what you’re burning but you’ll rarely see that high contrast of bright yellow and red in the same flame. In fact, the fire in that video is more white than red.
Fire moves very fast. This is one aspect that most animations seem to get wrong. Sure, there are some slower moving flames at the bottom, but most of the flames only last one frame.
In my last post I mentioned that the animated noise approach could work well with fire. That is exactly what I am going to try. I threw a few modules together with that principle in mind and I ended up with this:
It looks like I’m off to a good start. Although, when comparing this with the video above, we realize that the fire is too red and too slow. It also doesn’t seem to dance chaotically like it should. This is the texture:
The three outputs of the linear module (x,y, and z) are connected to the noise module. However, on the way there, I have added time to their values. The linear module moves the fire. Adding time to the equation doesn’t increase the effect of the linear module, it just changes it. The main problem with this is the fire doesn’t quite move chaotically enough. I will add a jitter module to fix that.
That looks a little better. Perhaps the flames could flicker faster. The colouring is also better. Here are the changes I made to the texture:
I added a jitter module and modified it with time, just like the noise. This new jitter module allows me to define how chaotic the movement is. The reduced colour contrast was a pleasant side effect. There is still one major problem. This fire isn’t 3D. As far as the texture is concerned this IS a 3D environment. Because if this, it was very easy to copy and paste all the modules into a 3D procedural material without any problems. The module setup is exactly the same as the image above. I have applied the material to a cylinder.
That worked surprisingly well. Obviously the fire is too cylindrically shaped, and it seems to be too solid. It almost looks more like flowing lava than fire. The colours are still too exaggerated. I had to think about the solution for a while. I eventually came up with this:
This is a massive improvement. It took LOTS of tweaking and rendering to get this right. Gaseous materials take fairly long to render, around 14 seconds per frame. That may not seem very long, but the video above has 300 frames. It also took six tries to get it looking right. Unfortunately, with materials you don’t know what it will look like until you render a decent amount of frames. In total, I rendered something like 1500 frames. That is 5.8 hours of rendering just to get a simple fire. The material looks a lot crazier this time around.
Let me explain what’s going on here. The orange noise module is only affecting the colour. The dark blue noise module determines the general shape of the flames. The light blue noise module adds a lot of smaller flames. The two, yellow, linear modules alter the size and the direction the fire is moving. The two, red, jitter modules further alter the shape of the flames. They control how much the flames bend left or right. The modules in the green circle prevent the material from touching the edges of the object. And finally, I have added time to everything that needed animating.
AOI File: Fire.zip