Contents
A More Accurate Volumetric Particle Rendering Method Using the Pixel Shader
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Lead World Designer
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
 
Designing Games Is About Matching Personalities [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  A More Accurate Volumetric Particle Rendering Method Using the Pixel Shader
by Mike Krazanowski
7 comments
Share RSS
 
 
June 11, 2008 Article Start Previous Page 4 of 4
 

As a consequence of this, we may be able to increase resolution in the transparency calculation by normalizing the alpha channel in the particle texture and globally modulate it with the VolumeAlpha value.

This also allows us to globally change the transparency of all the particles.

The alpha channel now defines the deviation ratio from the mirror plane to the extents. The particle extents from the camera in real world coordinates is defined as ParticleDepth -/+ DeviationExtent. The actual particle volume boundary is defined as ParticleDepth -/+ TextureAlpha * DeviationExtent.

With these tools we are now able to define a more accurate representation of the occluding properties of particles with objects behind, within and in front of the particle.

I will calculate the actual alpha value based on the previous derivation.

FarParticleDepth = ParticleDepth + TextureAlpha * DeviationExtent * 0.5;
NearParticleDepth = ParticleDepth - TextureAlpha * DeviationExtent * 0.5;

The average density calculation:
// Get the Environment Depth in terms of the volume, values we are interested
// in are in the range 0 to DeviationExtent.
Alpha = (EnvironmentDepth – ParticleDepth)/(DeviationExtent);
// Clamp the value to 0..1
Alpha = VolumeAlpha * Clamp( Alpha, 0.0, 1.0 );
// Get resultant pixel
OutputColour = Alpha * ParticleColour + (1.0 – Alpha) * SourceColour;

The density extent calculation:
// Get the Environment Depth in terms of the volume, values we are interested
// in are in the range 0 to DeviationExtent.
Range = (EnvironmentDepth – ParticleDepth)/(DeviationExtent);
// Scale this range based on the alpha value defined for the pixel
Range = Range * (1.0/ParticleAlpha);
// Normalize the value to -1..1
Alpha = Clamp( Range, -1.0, 1.0 ) * 0.5 + 0.5;
Alpha = Alpha * VolumeAlpha;
// Get resultant pixel
OutputColour = Alpha * ParticleColour + (1.0 – Alpha) * SourceColour;

These algorithms will perform the simple interpolation method as has been performed in hardware for years for cases when no collision occurs. For cases when the particle's volume does collide with environmental geometry, this algorithm will ramp the particle's contribution to the background contribution based on the amount of the volume obscured by the background.

Fig 3. A screen grab from the chrome dragon engine using the average density method. (Using the exact same art as in Fig 1.)

Fig 4. A screen grab from the chrome dragon engine using the density extent method. (Using the exact same art as in Fig 1.)

One thing to keep in mind when implementing this particle rendering method is that you are rendering a representation of a volume and that the depth of the volume is most likely related to the other dimensions of the particle. It is probably appropriate that some function relating particle size to depth be defined on a per-particle basis.

An additional note about the density extent method is that the volumes will use the alpha channel to define the extents of the volume on a per-pixel basis. Unfortunately most art defining particles to simulate volumes use a gradient method from the center of the texture, which will define the volume roughly as a wedge shape.

As you can see in Fig 1, many of the particles seem to have a kind of soft-aliased look to them with the unmodified art. For this approach to have visual merit, the source art may need to have the alpha component of the texture defined with true volumetric properties.

This approach can be extended to:

  1. Encode a deviation from the mirror plane into one of the channels of the texture. This allows the author to define an alternate depth median, by specifying the mirror point as a deviation from the original particle plane.
  2. Encode volume normal information into the other 3 channels of the texture and pass in the volume colour as uniform for the whole particle. This allows some real-time lighting information to be rendered as part of this shader.

Current particle rendering methods for volumetric particles in games are flawed, its acceptance will die out quickly and it is fixable using shaders in current generation hardware.

What is more, the proposed modification to existing rendering methods require few changes from the art department, adds a small amount of registers to the shader, adds a small number of shader instructions, and may not require significant changes to the existing rendering engine in your game.

Most importantly, the rendered particles will better represent the intended vision the artist while allowing for the number of particles to be decreased in the process.

Bibliography

Spherical Billboards for Rendering Volumetric Data - ShaderX 5 - Thomas Umenhoffer, Laslo Szirmay-Kalos and Gabor Szijarto

Volumetric Post-Processing - Game Programming Gems 5 - Dominic Filion, Artificial Mind & Movement, and Sylvain Boissé, Motorola

OpenGL Shading Language (Orange Book) - Randi J. Rost

[EDITOR'S NOTE: This article was independently written and commissioned by Gamasutra's editors, since it was deemed of value to the community. Its publishing has been made possible by Intel, as a platform and vendor-agnostic part of Intel's Visual Computing microsite.]

 
Article Start Previous Page 4 of 4
 
Comments

Ronald Mexico
profile image
Very interesting. Nice work.

Anonymous
profile image
Not sure what method UBI used, but GRAW 2 took care of this issue. Pretty amazingly realistic smoke in that game. No plane seams on the ground at all. They even made mention of their new particle tech in a pre-release, PR video.

Anonymous
profile image
How is this different from the DX10 soft particle sample?

Josiah Manson
profile image
What happens when particle volumes intersect? Do the particles act independently and double up the density, or do they somehow preserve uniform density. I think that uniform density may be achieved by having the particles write to the depth buffer.

Aaron Casillas
profile image
Great article!

I'm also interesting in learning more about "Baked" particle animations like the ones found in WOW. Is there a package out there that allows the particles system to be baked in?

Karsten Schwenk
profile image
Nice article, but I think variants of this method have been used for some time now.

My implementation uses the extinction factor to calculate the alpha value, which is a bit more physically based, and optionally also does a short ray-marching (for shadowing and non-homogeneous media). I called them 'thick particles'.

Unfortunately, from my experience, the default soft particles are usually preferable. At least in scenarios where the improved physical correctness isn't needed - and that includes almost all applications in games. Simply because they essentially do the same thing but are cheaper to render and easier to tweak for artists.

Space Games
profile image
I remember in older games like Call of Duty the smoke would just be ridiculous, going through walls and just not really conforming to what it should be doing. Recent games seem to be a lot better in that regard, including the newer Activision stuff. Interesting article either way. :)


none
 
Comment:
 


Submit Comment