#flipcode

#flipcode
Welcome to the chatterbox... 
#flipcode forumspace!

Browsing Gallery

Real-time GPU based fire simulation


 




fire (1) gpu (1)



 
Capisce (231)Physically Based Simulation and Visualization of Fire in Real-Time using the GPU - 2006-09-26 10:55:12
Registered: 2006-09-17
Posts: 2

This is a screenshot from my master's thesis project which I did in cooperation with Geir Storli. The title of the project was "Physically Based Simulation and Visualization of Fire in Real-Time using the GPU".

The fire is simulated using a fluid simulation coupled to a combustion model. We model a velocity field representing the flow of fuel gas, exhaust gas, and temperature. The velocity field is stored in the RGB-channels of a 32-bit per component floating point texture on the GPU. Likewise, the fuel gas, exhaust gas, and temperature fields are stored in respectively the RGB-channels of another texture. The textures are updated by fragment programs on the GPU using the FBO (Frame Buffer Object) extension. To perform the fluid simulation we use the stable fluids approach, which is very suitable for implementation on the GPU.

For symmetrical fire effects where there is not much sideways motion we have implemented volumetric extrusion, which simulates a set of independent 2D slices and uses cylindrical interpolation to define a full 3D volume. We have also implemented a full 3D simulation using flat 3D textures (the 3D volume is divided into slices which are tiled in a single 2D texture).

In order to render the 3D volume data consisting of exhaust gas densities plus temperature, we use a particle system also fully implemented on the GPU. The particles are spawned at the base of the fire, and then set to follow the velocity field of the fire simulation. The intensity and opaqueness of the particles are based on a black-body radiation color table which is precomputed. The temperature is used to perform a lookup in the color table, and the resulting value is multiplied by the exhaust gas density. The particles are rendered as quads using a gray scale texture in order to add more low level detail. Particle positions, colors, and velocities are stored in floating point textures. VS 3.0 support is required to be able to read from the particle position and color textures in the vertex shader.

The dynamic illumination of the scene is implemented by placing a set of point lights in the fire volume and sampling their intensities using the same approach as for coloring the particles. The scene is then rendered using per-pixel lighting.

Thesis

Video footage

References:

Stable Fluids by Jos Stam

Interactive Simulation of Fire by Zeki Melek and John Keyser

Physically Based Modeling and Animation of Fire by Doc Quang Nguyen, Ronald Fedkiw, and Henrik Wann Jensen

Building a Million Particle System by Lutz Latta

Samuel Rødal (srodal at gmail.com)

Dirtysouthafrican (2)Re: Physically Based Simulation and Visualization of Fire in Real-Time using the - 2006-09-26 11:08:52
Avatar of user Dirtysouthafrican
Registered: unknown
Posts: 312

Looks pretty good, (better in the video). However the density fall-off is too gradual and the convection is too mesoscopic. This doesn't appear to be a problem in the 2D version (video), so maybe it's an issue with the volumetric rendering. There never seems a point where the flame becomes completely opaque (solid yellow/white), so I wonder if perhaps you're using a linear accumulation rather than exponential (I haven't read the paper). The 2D slices seem to exhibit the characteristic "tonguing" that one expects from real flames. The torch is awesome.

Capisce (231)Re: Real-time GPU based fire simulation - 2006-09-26 12:21:56
Registered: 2006-09-17
Posts: 2

The black-body radiation spectrum does have a high dynamic range actually, but we would need to render the particles to a floating point buffer and do some kind of tone mapping as a post-filter. I agree that we could still use more turbulence in the fire, but tweaking the large scale behavior of the fluid simulation is a bit hard :) The external wind forces really help increase the illusion of turbulence and flickering, as seen in the torch part of the video. Also, yes, 2D slices are not that ideal for chaotic fire due to the inherent limitations regarding symmetry.

Ono-Sendai (17)Re: Real-time GPU based fire simulation - 2006-10-04 01:47:58
Avatar of user Ono-Sendai
Registered: unknown
Posts: 530

Very nice, would love to see this in a game.

I also would like to see some explosions done with this simulation code.


 
You need to log in in order to reply to this topic.
generated:August 28, 2008, 12:12 am
Generated on August 28, 2008, 12:12 am



© 2007 Lionel Brits

This page validates as XHTML 1.1 RSS 2.0 posts


Theme © 2006 Lionel Brits