Framework 3 (Last updated: February 6, 2017)Framework 2 (Last updated: October 8, 2006)Framework (Last updated: October 8, 2006)Libraries (Last updated: September 16, 2004)Really old framework (Last updated: September 16, 2004)
Wednesday, April 7, 2004 | Permalink
Fire2.zip (623 KB)
This demo shows off a set of interesting (though hardly revolutionary) techniques. The fire is created with a standard particle system. However, instead of having just one texture for all particles I'm using an animated texture. The particles will change over time from the bottom of the fire to the top. The problem with that is that if that's done with normal 2D textures, then you need many draw calls to draw all particles that need different textures. To solve that I'm using a 3D texture containing all slices. This way the whole particle system can be drawn with just one draw call, but I also get interpolation between the different slices through the texture filtering, which gives smoother animation. In addition to that, I have added rotation to the particles, which makes the fire look more natural. To further improve the fire I have ensured that the fire shapes around the wood. This is done with some collision detection and some code to let the particles assemble again after being spread by the wood. The result looks pretty good.
Also included is a simple wood shader, which doesn't need a lot of comments, and a simple terrain shader. The terrain shader mixes a grass and a dirt texture according to a 3D noise. This way you can make seemingly infinite non-repeating patterns, though in this demo the terrain is quite small so this aspect isn't very visible. In the shader it's easy to modify how smooth the transition from grass to dirt is, and if you want more dirt than grass etc.
You will need a Radeon 9500+ or GFFX to run it.