It's Getting Hot in Here!
In our last update, Chris talked about lava in all its different forms, and how it might be used in
Underworld Ascendant. Well, where there is lava there is inevitably fire, so this week Jeff would like to discuss how fire will work in the Stygian Abyss:
WATCH THE WORLD BURN
“
Some men just want to watch the world burn.” -Alfred (Michael Caine),
The Dark Knight
Last week Producer Chris waxed eloquent on how flowing lava is a major part of our thinking for the environment of
Underworld Ascendant. Lava does more than flow, however, it also burns.
Other things burn too, like fireballs.
We want the world of UA to react as much as possible like the real world to such events, which means making anything that should be able to catch on fire, actually able to catch on fire. There are two parts to this. One is the logical level… how do things catch on fire and how does that fire burn other things. That gets into a general damage system, which is something I’ll write about more in the future. The second part, though is making burning things
look like they are burning. I put some time in on that this week and have had some promising results.
To understand why this is tricky, you need to understand how game engines typically simulate fire. The basic technique for fire is called a “particle system” and was invented by the Lucasfilm Computer Group (which later became the CG arm of ILM) for the movie “Star Trek: The Wrath of Kahn”. It was fairly primitive by today’s standards, but no one had done anything like it before.
You can view a little documentary about it
HERE.
Particle systems have become more sophisticated over the years, but the technique is still basically the same. A particle system is an optimized render of a whole bunch of little tiny polygons or “particles”. Each particle is obeying a set of very simple physics rules to move it every frame. Anything that moves like a fluid is well represented by a particle system. Smoke, fire and fog are all things that particles represent well. The NVidia examples of water and fluid Chris shared last week are also particle systems, just made up of a lot more particles packed a lot more densely.
A good looking fire typically has orange and red particles for the flame itself as well as grey particles to simulate the smoke. Here is a particle system simulating the flame of a torch from a scene Will is working on right now:
Particle systems use controlled randomness in order to simulate the unpredictability of the motion of particles in nature. One place that randomness is used is in deciding where a new particle starts out. Your typical particle system uses a simple geometric shape like a box, cone or sphere and starts the particle at some random place inside it. We call this shape the “emitter”. Will’s torch, for instance, uses a cone emitter.
In most games, burning things have to have particle systems specifically set up for them when the level is built. Like Will’s torch above, the emitter is specifically chosen, sized and positioned to produce a good looking flame that you believe is coming from the torch. Even moving things, like a fireball, have the particle system carefully configured for size and shape and only the position changes during game play. In the Underworld however, where anything that can burn might burn, it would take a great deal of time and effort to set up individual particle systems custom configured to look good for every object. Instead, this week I wrote some code that can make any 3D object look like it is burning without having a custom tailored particle effect.
To make an object seem to burn, I need to create fire particles at the surface of that object. The surface of any object is defined by one or more meshes of triangles, so those meshes become my emitters. The process for creating each particle goes like this:
1. Randomly choose one of the burning object’s meshes.
2. From that mesh, randomly choose one of its triangles.
3. Randomly choose a point somewhere on that triangle.
4. Tell the particle system to create a particle there.
The end result, as you can see in the little movie below, is flame (or any other particle effect) that seems to come from the surfaces of the object. The randomness makes it dance around, coming from different parts of the object moment to moment, much as a real fire would.
PLAY
With this technology plus the damage system, players will be able to start fires with their fire spells, burn bridges with lava, set creatures ablaze, and generally torch the underworld. Will they use it to solve problems, or create new ones for themselves in the process? That, will be up to them.
Jeffrey Kesselman, Lead Engineer