Cameron Fischer
Advanced Computer Graphics
This paper presents an alternative algorithm for simulating the visual effects of fog or smoke in such a way as to allow for efficient simulation of the density's motion. The algorithm creates a volumetric fog effect by interpreting a variable number of points that are responsive to their environment. The idea is that a large number of points would not be necessary to produce appealing results.
Fog in graphics rendering can be accomplished through a variety of techniques. The OpenGL libraries include functionality that allows someone to create linear or quadratic interpolation of a fragment's color and the fog color based on the Z value of the fragment. This allows for a very cheap and easy fog that in many cases is good enough.
Smoke and fog simulations have been performed before through the use of the Navier-Stokes equations [1]. These simulations work well for incompressible fluids such as water and other liquids. An interesting smoke simulation and rendering involves the use Euler equations as an alternative to the Navier-Stokes equations to calculate across a large number of cells [2]. The smoke was approximated by considering densities within these cells and the rendering is done by photon scattering based on a probability derived from these densities. A more interesting fog effect can be created through the use of volumetric fog. This is a slightly more expensive technique that can fog interpolations for given regions. Particle systems can be used to produce very realistic smoke, fog, or cloud simulations.
I wanted to pursue a volumetric smoke, cloud, and fog simulation that combines particles and ray tracing in order to produce visually pleasing results with fewer particles. By reducing the number of particles, effective simulation of the particle's motion through a simulation could be calculated more quickly and respond more to external effects such as wind or impassable bodies. The simulation of these particles could be done in real time. Although the rendering of the particles can be substituted with voxels for the simulation, a full simulation would involve the use of ray tracing and could not be used in real time. To determine the distance between the point and the ray, we consider the origin of the ray, the direction of the ray, and the origin of the point.
To demonstrate the technique.
I created a few scenes where anywhere from 20 to 200 voxels were used for computing.
The movement simulation of these voxels was set up so they would all start at the same location.
They would all take on the same general direction with slight variations.
Then they would all also have a random life from 8 to 16 steps for smoke to 64 to 128 steps for fog.
A simplistic collision detection and response system was set up that involved the same ray tracing functions that the renderer used.
The following shows a voxel interpretation of a foggy scene as well as its rendered counter part using the distance product algorithm.
The focus of this paper was on the rendering of the fog from a limited number of points. The code in the source has a very limited and stripped down features regarding the interaction of the particles with their environment. However, it should be enough to get the particles in relatively good locations for rendering. Along with the source code, there are a number of shell scripts that have certain premade scenarios ready to go.
This paper demonstrated a different technique for generation fog and smoke simulations within ray traced environments. The techniques are greatly simplified from using the Navier-Stokes equations with a cell-based environment yet still provides pleasing results. The physical environment created by this algorithm is easy to simulate in real time using more complicated physics simulations that are more responsive to the environment. These simulations are less expensive due to the decreased amount of particles that are required to create an effective scene. The rendering system integrates well with any other ray tracing environment while avoiding some of the artifacts that voxel-based rendering would have with such few particles. These avoided artifacts involve an effect that occurs when textured points or voxels are near other geometry. If the voxels intersect the geometry, then a noticeable crease will appear where the fog texture disappears into the wall.
I do not believe that this technique is very effective for simulating clouds. Although a cloud effect could easily be created using these algorithms, this would be far to elaborate for the quality of clouds you would get. However, for smoke and fog, I believe that this algorithm would work nicely in combination with other systems.
This algorithm could easily be extended to factor in features such as photon scattering. This would allow for the fog or smoke to be more responsive to any light sources. The fog would have shades more reflective of the amount of light cast upon it and smoke could be self-shaded. Also, the shadow casting could be altered to take fog into consideration. This would allow for smoke and fog to cast shadows onto the ground and to effect the lighting of everything within the fog.