Many games, even on current "next-gen" hardware, render particles using camera facing quads. In this technical piece
, veteran coder Mike Krazanowski (Tomb Raider: Anniversary
) suggests a neat alternative solution using pixel shaders and a little bit of math.
Though rendering particles using camera facing quads has been a practice employed in games for many years, Krazanowski's method uses shader technology to more physically represent these volumetric particles:
"This method will give a more accurate visual representation of the simulated volumes as well as potentially decreasing the necessary number of particles, which in turn will help to improve render performance.
It should first be stated that the method defined in this article is limited to particles that represent volumes of sub-particles. It is also noted that the analysis that is to follow assumes a uniform density of the particles. There are methods that would allow the user to define more complex density functions, but that will not be covered here.
Many games have tried to represent environmental effects such as dust, mist, gases, energy volumes etc. using the same method for years. Essentially they define how much a particle obscures the rendered environment behind it using the alpha channel in the texture."
Shaders have served as a significant advancement for the software developer's ability to define the functions used to render a scene in the hardware:
"Even on cheap consumer graphics hardware, the software developer can define almost any function imaginable (usually only limited by available registers and functions made available to the shading language).
Using pixel shaders, render-to-texture technology and a little bit of math, I claim that we can more correctly simulate the volumes that the particles were intended to represent.
The problem with current methods of rendering particles to represent volumes is that, like most geometry in games, they are not volumes. They are camera facing planes rendered with the intention to never show their depth."
You can now read the full feature
on volumetric particle rendering using the pixel shader, Krazanowski's alternative to rendering particles with camera facing quads (no registration required, please feel free to link to this feature from other websites).