This document discusses techniques for rendering large particle systems at high frame rates using off-screen rendering targets. It describes rendering particles to a lower resolution off-screen target to reduce the fill rate and memory usage compared to rendering at full screen resolution. It also discusses using the off-screen depth buffer to occlude particles behind solid objects, and methods for anti-aliasing such as depth sampling and edge detection to composite the low-resolution particles back at full resolution without appearing blocky.
2. Large particle system
● mushroom cloud, smoke, fire, explosio
n ...
●
Many polygons
●
Fill rate
●
Frame rate
3. Motivation
● Off-screen Render Target
● Fraction of the Frame Buffer size
4. Low-Resolution
● Image of smoke and fog have only low fr
equencies
● Small number of samples without loss of
visual quality
●
Bad to high frequencies
5. Off-Screen Rendering
● Particles are rendered to an Off-Screen.
● Not require a same size of Frame Buffer.
● Not require a particular ratio of size.
● Trade-off
7. Off-Screen Depth Testing
● 1. Render all solid objects(a)
● 2. Downsample the resulting Depth Buffer
● 3. Render the particles to Off-screen RT,
testing against the small depth buffer(b)
● 4. Composite the particle RT back onto t
he main Frame Buffer(c)
9. Acquiring Depth
● MRT
- All targets must have equal bit depths
- not compatible with MSAA
● Single RT in a separate pass
● Alpha channel of an RGBA target
- Use RGBA16 cause precision problem
- Memory footprint
- Can’t MSAA on GeForce 7
14. Maximum of Depth Samples
● Sample a spread of four depth values fro
m the full-resolution depth
● Take the maximum one.
● Four samples fully cover the high-res.
● Shrinking the object silhouettes
15. Depth Testing and Soft Particles
● The Depth Test Implemented in the PS
float4 particlePS(VS_OUT vIn): COLOR
{
float myDepth = vIn.depth;
float sceneDepth = tex2D(depthSampler, vIn.screenUV).x;
if (myDepth > sceneDepth)
discard;
// Compute color, etc.
...
}
16. Depth Testing and Soft Particles
● Access to Depth, useful to Soft Particle
● saturate(( Z object - Z particle) * scale)
17. Depth Testing and Soft Particles
● Soft Particles Are better than
float4 particlePS(VS_OUT vIn): COLOR
{
float myDepth = vIn.depth;
float sceneDepth = tex2D(depthSampler, vIn.screenUV).x;
float zFade = saturate(scale * (myDepth - sceneDepth));
// Compute (r,g,b,a), etc.
...
return float4(r,g,b, a * zFade);
}
26. Composing with Stenciling
● Edge-detection selects pixels blocky
● Rendering the particles at the full Frame-
buffer resolution only where edges occur.
28. Avoid Stencil Writes,
Creating a Mask
● Stencil buffer mask areas of FrameBuffer
float4 composePS(VS_OUT2 vIn): COLOR {
float4 edge = tex2D(edgesSampler, vIn.UV0.xy);
if (edge.r == 0.0)
{
float4 col = tex2D(particlesRTSampler, vIn.UV1.xy);
return rgba;
}
else
{
// Where we have an edge, abort to cause no stencil write.
discard;
}
}