SlideShare a Scribd company logo
Dynamic Global Illumination
Wolfgang Engel
Confetti Special Effects Inc., Carlsbad
Paris Master Class
Agenda
• Requirement for Real-Time GI
• Ambient Cubes
• Diffuse Cube Mapping
• Screen-Space Ambient Occlusion
• Screen-Space Global Illumination
• Reflective Shadow Maps
• Splatting Indirect Illumination (SII)
Agenda
Agenda
Agenda
Requirement for Real-Time GI
• Pre-calculated lighting disadvantages
– hard to mimic a 24 hour cycle
– storing those light or radiosity maps on disk or even
the DVD / Blu-ray required a lot of memory
– streaming the light or radiosity maps from disk or
hard-drive through hardware to the GPU consumes
valuable memory bandwidth
– geometry with light maps or radiosity maps is not
destructible anymore (this is a reason to avoid any
solution with pre-computed maps)
– while the environment is lit nicely, it is hard to light
characters in a consistent way with this environment
Requirement for Real-Time GI
• Following Next-gen Game requirements:
– As less as possible pre-calculated
– As less as possible memory consumption
-> as much as possible is calculated on the fly
– 24 hour sun movement
– Destructible Geometry 
Ambient Cube
• Ambient Cube (as used in Half-Life 2)
(http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf)
->Interpolate between six color values
• Six colors are stored spatially in level
data:
– Represent ambient light flowing through
that volume in space
– Application looks this up for each model
to determine the six ambient colors to
use for a given model
• HL2: local lights that aren’t important
enough to go directly into the vertex
shader are also added to the ambient
cube
Diffuse Cube Mapping
• [Brennan]
• Steps
– Render environment into a cube map or use static
map
– Blur it
– Fetch it by indexing with the vertex normal
• Vertex normal is used to index the cube map with the
intention that it returns the total amount of light
scattered from this direction
Diffuse Cube Mapping
Original
Blurred
Screen-Space Ambient Occlusion
Screen-Space Ambient Occlusion
• See for the original approach [Kajalin]
• Requires only Depth Buffer in original approach
• Uses a sphere-like sampling kernel
Screen-Space Ambient Occlusion
• Computes the amount of solid geometry around a
point
• The ratio between solid and empty space
approximates the amount of occlusion
P
1
P
2
P
3
P1 is located on a flat plane -> 0.5
P2 is located in the corner -> 0.75
P3 is located on the edge -> 0.25
Screen-Space Ambient Occlusion
• A very simplified version of the source code comes
down to:
// very simplified version …
float fPixelDepth = Depth.Sample( DepthSampler, IN.tex.xy ).r;
for ( int i = 0; i < 8; i++ )
{
float fSampleDepth = Depth.Sample(DepthSampler, vRotatedKernel.xy).r;
float fDelta = max( fSampleDepth - fPixelDepth, 0 );
fOcclusion += fDelta;
}
Screen-Space Ambient Occlusion
• Designing a SSAO Kernel
– Distance attenuation
-> not necessary if the density of the samples is higher closer to the
center of the kernel
– Noise is necessary because even 16 taps spread out are not enough
– Running on a quarter-sized render target will make large kernels like
16-tap possible
Screen-Space Ambient Occlusion
Screen-Space Global Illumination
Screen-Space Global Illumination
• Every pixel in the G-Buffer is considered a secondary
light source -> point lights
• The normal is considered the light direction
• Radiant intensity emitted at point p in direction ω
Φp– the flux defines the brightness of the pixel light
np – normal at point p spatial emission
Screen-Space Global Illumination
• Irradiance at surface point p with normal n due to
pixel light p is thus
Φp– the flux defines the brightness of the pixel light
np – normal at point p spatial emission
• Evaluating indirect irradiance at a surface point x with
normal x
PTarget
PSampling
V
NormalSampling
NormalTarget
Screen-Space Global Illumination
• PSampling contribution to Ptarget(Outgoing cosinus)
ISampling = NSampling.-V
• Ptarget contribution (Incoming cosinus)
Itarget = NTarget.V
• Attenuation:
A = 1.0 / D2
• Result
Result = Isampling * Itarget * A * ColorScreenSpaceRT
Screen-Space Global Illumination
• Issues
– All the issues from SSAO
– Does not consider occlusion for the indirect light sources
-> color changes based on viewing angle
-> Different with reflective shadow maps …
Reflective Shadow Maps
• Extended shadow map [Dachsbacher] - Multiple-Render Target (MRT)
that holds
– Depth Buffer
– Normal
– World space position
– Flux
• Each pixel in the MRT is considered a secondary light source; considered
local point lights
-> called pixel lights
• Radiant intensity emitted at point p in direction ω
Φp– the flux defines the brightness of the pixel light
np – normal at point p spatial emission
• Irradiance at surface point p with normal n due to
pixel light p is thus
Φp– the flux defines the brightness of the pixel light
np – normal at point p spatial emission
• Evaluating indirect irradiance at a surface point x
with normal x
• Does not consider occlusion for the indirect light
sources -> color changes based on viewing angle
Reflective Shadow Maps
Reflective Shadow Maps
• Challenge: a typical RSM is 512x512 -> evaluation of
all those too expensive
• Importance Sampling -> evaluate about 400 samples
How to pick the sampling points:
1. Uniformly distributed random numbers are applied to polar coordinates
2. Then they compensate for the varying density by weighting the achieved samples
ξ1- uniformly distributed random number
ξ2- uniformly distributed random number
• Precompute sampling pattern and
re-use it for all indirect light computations
• Still too expensive -> Screen-Space interpolation
Reflective Shadow Maps
• Screen-Space Interpolation
1. pass – compute the indirect illumination for a low-resolution image in screen-space
2. pass – render full-res + check if we can interpolate from the four surrounding low-
res samples
• A low-res sample is regarded as suitable for interpolation if
– the sample’s normal is similar to the pixel’s normal,
– and if its world space location is close to the pixel’s location
• Each samples contribution is weighted by the factors used for bi-linear interpolation
– If not all samples of the four samples are used -> normalization
– If all three or four samples are considered as suitable -> interpolate between those
Reflective Shadow Maps
• How to pick important pixel lights
1. Not visible in shadow map: x is not directly illuminated -> not visible in shadow map
2. Normals point away: x-1 and x-2 are relatively close, but since their normal points away from x they do not contribute
3. Same floor: x1 is very close but lies on the same floor -> won’t contribute
4. 1 – 3 not applicable: x2 will contribute
5. What is important: distance between x and a pixel light xp in the shadow map is a reasonable approximation for their distance in world space
-> if the depth values with respect to the light source differ significantly, the world space distance is much bigger and we thus overestimate the
influence
-> important indirect lights will always be close, and these must also be close in the shadow map
Splatting Indirect Illumination
•Build on RSM
•Instead of iterating over all image pixels and gathering
indirect light from RSM
-> Selects a subset of RSM pixels == pixel lights and
distributes their light to the image pixels, using a splat
in screen-space
-> Deferred lighting idea re-visited
Splatting Indirect Illumination
• Stores
– Flux – N.L * Color
– Normal – just world-space normal
– Position – offset in neg. direction of normal
– Gloss value – gloss value is instead of specular component
• in Reflective Shadow map
Splatting Indirect Illumination
•How to create a Reflective Shadow Map:
RESULT_RSM psCreateRSM( FRAGMENT_RSM fragment )
{
RESULT_RSM result;
float3 worldSpacePos = fragment.wsPos.xyz;
float3 lightVector = normalize( lightPosition - worldSpacePos );
float3 normal = normalize( fragment.normal );
// compute flux
float4 flux = materialColor * saturate( dot( normal.xyz, lightVector ) );
// we squeeze everything into two floats quadrupels, as vertex texture fetches are expensive!
float squeezedFlux = encodeFlux( flux.xyz );
float phongExponent = 1.0f;
float3 mainLightDirection = normal;
if ( dot( mainLightDirection, lightVector ) < 0.0f ) normal *= -1.0f;
result.color[ 0 ] = float4( mainLightDirection, squeezedFlux );
// we move position a little bit back in the direction of the normal
// this is done to avoid rendering problems along common boundaries of walls -> illumination integral has a
// singularity there
result.color[ 1 ] = float4( worldSpacePos - normal * 0.2f, phongExponent );
return result;
}
Splatting Indirect Illumination
• How do we fetch the RSM?
• Splat position: pre-calculated distribution of sample
points in light space
-> 3D poisson disk distribution
Left - Sample points in light space / Right – Splats in main view
Splatting Indirect Illumination
Pseudo code
1.Fetch pre-calculated distribution of sample points in
light space in a texture
2.Calculate size of ellipsoid bounding volume in screen-
space (see article for code)
Splatting Indirect Illumination
3.Reduce size of splat based on
– Size of the bounding volume
– Distance camera <-> pixel light
Splatting Indirect Illumination
• Going back to the original Reflective Shadow Map
algorithm:
• Irradiance at surface point p with normal n due to
pixel light p is thus
Φp – the flux defines the brightness of the pixel light
np – normal at point p spatial emission
• Evaluating indirect irradiance at a surface point x
with normal x
PTarget
PSampling
V
NormalSampling
NormalTarget
Splatting Indirect Illumination
• PSampling contribution to Ptarget(Outgoing cosinus)
ISampling = NSampling.-V
• Ptarget contribution (Incoming cosinus)
Itarget = NTarget.V
• Attenuation:
A = 1.0 / (D2
* Scale + Bias)
• Result
Result = Isampling * Itarget * A * ColorScreenSpaceRT
Splatting Indirect Illumination
• Glossiness based on outgoing cosinus
float Gloss = pow(NSampling.-V, phongExp)
Splatting Indirect Illumination
• Let’s single-step through the splatting pixel shader
float4 psSI( FRAGMENT_SI fragment ) : COLOR
{
float4 result;
// get surface info for this pixel
float4 wsPos = tex2Dproj( DSSample0, fragment.pos2D );
float4 normal = tex2Dproj( DSSample1, fragment.pos2D ) * 2.0f - 1.0f;
// decode world space position (8 bit render target!)
wsPos = ( wsPos - 0.5f ) * WSSIZE;
// compute lighting
float l2, lR, cosThetaI, cosThetaJ, Fij, phongExp;
// lightPos comes from the RSM read in the vertex shader
// lightPos – pixel light
// wsPos – fragment position
float3 R = fragment.lightPos - wsPos.xyz; // R = vector from fragment to pixel light
l2 = dot( R, R ); // squared length of R (needed again later)
R *= rsqrt( l2 ); // normalize R
lR = ( 1.0f / ( distBias + l2 * INV_WS_SIZE2_PI * 2 ) ); // distance attenuation (there's a global scene scaling factor "...WS_SIZE...")
Splatting Indirect Illumination
// lightDir comes from RSM read in vertex shader
// this is the world space normal stored in the RSM of the pixel light == direction of the pixel light
cosThetaI = saturate( dot( fragment.lightDir, -R ) ); // outgoing cosine
phongExp = fragment.lightDir.w;
// with a phong like energy attenuation and widening of the high intensity region
if ( phongExp > 1.0f )
cosThetaI = pow( cosThetaI, phongExp * l2 );
// compare world-space normal at fragment that gets rendered with R
cosThetaJ = saturate( dot( normal, R ) ); // incoming cosine
Fij = cosThetaI * cosThetaJ * lR; // putting everything together
#ifdef SMOOTH_FADEOUT
// screen-space position of center of splat
float3 t1 = fragment.center2D.xyz / fragment.center2D.w;
// screen-space position of the pixel we are currently shading
float3 t2 = fragment.pos2D.xyz / fragment.pos2D.w;
// lightFlux.w holds fade out value based on distance between camera and the pixel light position
// xy is based on screen-space and z is based on the distance between the camera and the pixel position
float fadeOutFactor = saturate( 2 - 6.667 * length( t1.xy - t2.xy ) / fragment.lightFlux.w );
Fij *= fadeOutFactor;
#endif
result = fragment.lightFlux * Fij; // transfer energy!
return result;
}
Green arrow – R
Orange arrow – normal fragment
Blue arrow – pixel light direction
Splatting Indirect Illumination
• SII importance Sampling
-> doesn’t seem to work on modern hardware
-> ignore it for now
Conclusion
• Screen-Space Global Illumination
– allows to generate the impression of color bleeding with the
lowest possible amount of memory
– does not require any transform
– ”fits” into a PostFX pipeline
– has all the issues of SSAO + false colors
• Reflective Shadow Maps + SII
– higher quality than SSGI
– “fits” into a Deferred Lighting engine and any Cascaded Shadow
Map approach
– requires one or more additional G-Buffers from the point of
view of the light
– more expensive
References
• [Brennan] Chris Brennan, “Diffuse Cube Mapping”, ShaderX, pp. 287 - 289
• [Dachsbacher] Carsten Dachsbacher, Marc Stamminger, “Reflective Shadow Maps”,
http://www.vis.uni-stuttgart.de/~dachsbcn/download/rsm.pdf
http://www.vis.uni-stuttgart.de/~dachsbcn/publications.html
• [DachsbacherSii] Carsten Dachsbacher, Marc Stamminger, “Splatting Indirect Illumination”,
http://www.vis.uni-stuttgart.de/~dachsbcn/download/sii.pdf
• [Kajalin] Vladimir Kajalin, “Screen-Space Ambient Occlusion”, pp. 413 – 424, ShaderX7
• [Loos] Bradford James Loos, Peter-Pike Sloan, “VolumetricObscurance”,
http://www.cs.utah.edu/~loos/publications/vo/vo.pdf
• [Nichols] Greg Nichols, Chris Wyman, “Multiresolution Splatting for Indirect Illumination”,
http://www.cs.uiowa.edu/~cwyman/publications/files/techreports/UICS-TR-08-04.pdf
• [Ritschel] Tobias Ritschel, “Imperfect Shadow Maps for Efficient Computation of Indirect
Illumination”, http://www.uni-koblenz.de/~ritschel/
• [Zink] Jason Zink, “Screen Space Ambient Occlusion”,
http://wiki.gamedev.net/index.php/D3DBook:Screen_Space_Ambient_Occlusion

More Related Content

What's hot

Real-time lightmap baking
Real-time lightmap bakingReal-time lightmap baking
Real-time lightmap baking
Rosario Leonardi
 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Tiago Sousa
 
Lighting the City of Glass
Lighting the City of GlassLighting the City of Glass
Lighting the City of Glass
Electronic Arts / DICE
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
Colin Barré-Brisebois
 
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time RenderingDD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
Electronic Arts / DICE
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
Pope Kim
 
Advancements in-tiled-rendering
Advancements in-tiled-renderingAdvancements in-tiled-rendering
Advancements in-tiled-rendering
mistercteam
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Electronic Arts / DICE
 
Physically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in FrostbitePhysically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in Frostbite
Electronic Arts / DICE
 
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...JP Lee
 
Moving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based RenderingMoving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based Rendering
Electronic Arts / DICE
 
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time RaytracingSIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
Electronic Arts / DICE
 
Precomputed Voxelized-Shadows for Large-scale Scene and Many lights
Precomputed Voxelized-Shadows for Large-scale Scene and Many lightsPrecomputed Voxelized-Shadows for Large-scale Scene and Many lights
Precomputed Voxelized-Shadows for Large-scale Scene and Many lights
Seongdae Kim
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
Electronic Arts / DICE
 
Deferred shading
Deferred shadingDeferred shading
Deferred shadingFrank Chao
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizationspjcozzi
 
Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3
Electronic Arts / DICE
 
Executable Bloat - How it happens and how we can fight it
Executable Bloat - How it happens and how we can fight itExecutable Bloat - How it happens and how we can fight it
Executable Bloat - How it happens and how we can fight itElectronic Arts / DICE
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Johan Andersson
 
The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2
Guerrilla
 

What's hot (20)

Real-time lightmap baking
Real-time lightmap bakingReal-time lightmap baking
Real-time lightmap baking
 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)
 
Lighting the City of Glass
Lighting the City of GlassLighting the City of Glass
Lighting the City of Glass
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
 
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time RenderingDD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
Advancements in-tiled-rendering
Advancements in-tiled-renderingAdvancements in-tiled-rendering
Advancements in-tiled-rendering
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 
Physically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in FrostbitePhysically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in Frostbite
 
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
 
Moving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based RenderingMoving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based Rendering
 
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time RaytracingSIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
SIGGRAPH 2018 - Full Rays Ahead! From Raster to Real-Time Raytracing
 
Precomputed Voxelized-Shadows for Large-scale Scene and Many lights
Precomputed Voxelized-Shadows for Large-scale Scene and Many lightsPrecomputed Voxelized-Shadows for Large-scale Scene and Many lights
Precomputed Voxelized-Shadows for Large-scale Scene and Many lights
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
 
Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3
 
Executable Bloat - How it happens and how we can fight it
Executable Bloat - How it happens and how we can fight itExecutable Bloat - How it happens and how we can fight it
Executable Bloat - How it happens and how we can fight it
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
 
The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2
 

Similar to Paris Master Class 2011 - 07 Dynamic Global Illumination

Massive Point Light Soft Shadows
Massive Point Light Soft ShadowsMassive Point Light Soft Shadows
Massive Point Light Soft Shadows
Wolfgang Engel
 
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
Mark Kilgard
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
Benjamin Glatzel
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
ozlael ozlael
 
Interactive Refractions And Caustics Using Image Space Techniques
Interactive Refractions And Caustics Using Image Space TechniquesInteractive Refractions And Caustics Using Image Space Techniques
Interactive Refractions And Caustics Using Image Space Techniques
codevania
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramas
Wael Badawy
 
Ray tracing
Ray tracingRay tracing
Ray tracing
Yogesh jatin Gupta
 
Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
stevemcauley
 
A modern Post-Processing Pipeline
A modern Post-Processing PipelineA modern Post-Processing Pipeline
A modern Post-Processing Pipeline
Wolfgang Engel
 
A new Post-Processing Pipeline
A new Post-Processing PipelineA new Post-Processing Pipeline
A new Post-Processing Pipeline
Wolfgang Engel
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
KKARUNKARTHIK
 
illuminationmodelsshading-200501081735 (1).pdf
illuminationmodelsshading-200501081735 (1).pdfilluminationmodelsshading-200501081735 (1).pdf
illuminationmodelsshading-200501081735 (1).pdf
SayantanMajhi2
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
鍾誠 陳鍾誠
 
Paris Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow MapsParis Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow Maps
Wolfgang Engel
 
Graphics Lecture 7
Graphics Lecture 7Graphics Lecture 7
Graphics Lecture 7
Saiful Islam
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Caustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic PatternsCaustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic Patterns
Budianto Tandianus
 
3 D texturing
 3 D texturing 3 D texturing
3 D texturing
krishn verma
 
visible surface detection in 3D objects for viewing
visible surface detection in 3D objects for viewingvisible surface detection in 3D objects for viewing
visible surface detection in 3D objects for viewing
srinivasan779644
 
Green Custard Friday Talk 17: Ray Tracing
Green Custard Friday Talk 17: Ray TracingGreen Custard Friday Talk 17: Ray Tracing
Green Custard Friday Talk 17: Ray Tracing
Green Custard
 

Similar to Paris Master Class 2011 - 07 Dynamic Global Illumination (20)

Massive Point Light Soft Shadows
Massive Point Light Soft ShadowsMassive Point Light Soft Shadows
Massive Point Light Soft Shadows
 
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Interactive Refractions And Caustics Using Image Space Techniques
Interactive Refractions And Caustics Using Image Space TechniquesInteractive Refractions And Caustics Using Image Space Techniques
Interactive Refractions And Caustics Using Image Space Techniques
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramas
 
Ray tracing
Ray tracingRay tracing
Ray tracing
 
Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
 
A modern Post-Processing Pipeline
A modern Post-Processing PipelineA modern Post-Processing Pipeline
A modern Post-Processing Pipeline
 
A new Post-Processing Pipeline
A new Post-Processing PipelineA new Post-Processing Pipeline
A new Post-Processing Pipeline
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
illuminationmodelsshading-200501081735 (1).pdf
illuminationmodelsshading-200501081735 (1).pdfilluminationmodelsshading-200501081735 (1).pdf
illuminationmodelsshading-200501081735 (1).pdf
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
 
Paris Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow MapsParis Master Class 2011 - 04 Shadow Maps
Paris Master Class 2011 - 04 Shadow Maps
 
Graphics Lecture 7
Graphics Lecture 7Graphics Lecture 7
Graphics Lecture 7
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Illumination Models & Shading
 
Caustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic PatternsCaustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic Patterns
 
3 D texturing
 3 D texturing 3 D texturing
3 D texturing
 
visible surface detection in 3D objects for viewing
visible surface detection in 3D objects for viewingvisible surface detection in 3D objects for viewing
visible surface detection in 3D objects for viewing
 
Green Custard Friday Talk 17: Ray Tracing
Green Custard Friday Talk 17: Ray TracingGreen Custard Friday Talk 17: Ray Tracing
Green Custard Friday Talk 17: Ray Tracing
 

More from Wolfgang Engel

Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility buffer
Wolfgang Engel
 
Light and Shadows
Light and ShadowsLight and Shadows
Light and Shadows
Wolfgang Engel
 
Paris Master Class 2011 - 06 Gpu Particle System
Paris Master Class 2011 - 06 Gpu Particle SystemParis Master Class 2011 - 06 Gpu Particle System
Paris Master Class 2011 - 06 Gpu Particle System
Wolfgang Engel
 
Paris Master Class 2011 - 05 Post-Processing Pipeline
Paris Master Class 2011 - 05 Post-Processing PipelineParis Master Class 2011 - 05 Post-Processing Pipeline
Paris Master Class 2011 - 05 Post-Processing Pipeline
Wolfgang Engel
 
Paris Master Class 2011 - 03 Order Independent Transparency
Paris Master Class 2011 - 03 Order Independent TransparencyParis Master Class 2011 - 03 Order Independent Transparency
Paris Master Class 2011 - 03 Order Independent Transparency
Wolfgang Engel
 
Paris Master Class 2011 - 02 Screen Space Material System
Paris Master Class 2011 - 02 Screen Space Material SystemParis Master Class 2011 - 02 Screen Space Material System
Paris Master Class 2011 - 02 Screen Space Material System
Wolfgang Engel
 
Paris Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAAParis Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAA
Wolfgang Engel
 
Paris Master Class 2011 - 00 Paris Master Class
Paris Master Class 2011 - 00 Paris Master ClassParis Master Class 2011 - 00 Paris Master Class
Paris Master Class 2011 - 00 Paris Master Class
Wolfgang Engel
 

More from Wolfgang Engel (9)

Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility buffer
 
Light and Shadows
Light and ShadowsLight and Shadows
Light and Shadows
 
Paris Master Class 2011 - 06 Gpu Particle System
Paris Master Class 2011 - 06 Gpu Particle SystemParis Master Class 2011 - 06 Gpu Particle System
Paris Master Class 2011 - 06 Gpu Particle System
 
Paris Master Class 2011 - 05 Post-Processing Pipeline
Paris Master Class 2011 - 05 Post-Processing PipelineParis Master Class 2011 - 05 Post-Processing Pipeline
Paris Master Class 2011 - 05 Post-Processing Pipeline
 
Paris Master Class 2011 - 03 Order Independent Transparency
Paris Master Class 2011 - 03 Order Independent TransparencyParis Master Class 2011 - 03 Order Independent Transparency
Paris Master Class 2011 - 03 Order Independent Transparency
 
Paris Master Class 2011 - 02 Screen Space Material System
Paris Master Class 2011 - 02 Screen Space Material SystemParis Master Class 2011 - 02 Screen Space Material System
Paris Master Class 2011 - 02 Screen Space Material System
 
Paris Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAAParis Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAA
 
Paris Master Class 2011 - 00 Paris Master Class
Paris Master Class 2011 - 00 Paris Master ClassParis Master Class 2011 - 00 Paris Master Class
Paris Master Class 2011 - 00 Paris Master Class
 
Hair in Tomb Raider
Hair in Tomb RaiderHair in Tomb Raider
Hair in Tomb Raider
 

Recently uploaded

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 

Recently uploaded (20)

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 

Paris Master Class 2011 - 07 Dynamic Global Illumination

  • 1. Dynamic Global Illumination Wolfgang Engel Confetti Special Effects Inc., Carlsbad Paris Master Class
  • 2. Agenda • Requirement for Real-Time GI • Ambient Cubes • Diffuse Cube Mapping • Screen-Space Ambient Occlusion • Screen-Space Global Illumination • Reflective Shadow Maps • Splatting Indirect Illumination (SII)
  • 6. Requirement for Real-Time GI • Pre-calculated lighting disadvantages – hard to mimic a 24 hour cycle – storing those light or radiosity maps on disk or even the DVD / Blu-ray required a lot of memory – streaming the light or radiosity maps from disk or hard-drive through hardware to the GPU consumes valuable memory bandwidth – geometry with light maps or radiosity maps is not destructible anymore (this is a reason to avoid any solution with pre-computed maps) – while the environment is lit nicely, it is hard to light characters in a consistent way with this environment
  • 7. Requirement for Real-Time GI • Following Next-gen Game requirements: – As less as possible pre-calculated – As less as possible memory consumption -> as much as possible is calculated on the fly – 24 hour sun movement – Destructible Geometry 
  • 8. Ambient Cube • Ambient Cube (as used in Half-Life 2) (http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf) ->Interpolate between six color values • Six colors are stored spatially in level data: – Represent ambient light flowing through that volume in space – Application looks this up for each model to determine the six ambient colors to use for a given model • HL2: local lights that aren’t important enough to go directly into the vertex shader are also added to the ambient cube
  • 9. Diffuse Cube Mapping • [Brennan] • Steps – Render environment into a cube map or use static map – Blur it – Fetch it by indexing with the vertex normal • Vertex normal is used to index the cube map with the intention that it returns the total amount of light scattered from this direction
  • 12. Screen-Space Ambient Occlusion • See for the original approach [Kajalin] • Requires only Depth Buffer in original approach • Uses a sphere-like sampling kernel
  • 13. Screen-Space Ambient Occlusion • Computes the amount of solid geometry around a point • The ratio between solid and empty space approximates the amount of occlusion P 1 P 2 P 3 P1 is located on a flat plane -> 0.5 P2 is located in the corner -> 0.75 P3 is located on the edge -> 0.25
  • 14. Screen-Space Ambient Occlusion • A very simplified version of the source code comes down to: // very simplified version … float fPixelDepth = Depth.Sample( DepthSampler, IN.tex.xy ).r; for ( int i = 0; i < 8; i++ ) { float fSampleDepth = Depth.Sample(DepthSampler, vRotatedKernel.xy).r; float fDelta = max( fSampleDepth - fPixelDepth, 0 ); fOcclusion += fDelta; }
  • 15. Screen-Space Ambient Occlusion • Designing a SSAO Kernel – Distance attenuation -> not necessary if the density of the samples is higher closer to the center of the kernel – Noise is necessary because even 16 taps spread out are not enough – Running on a quarter-sized render target will make large kernels like 16-tap possible
  • 18. Screen-Space Global Illumination • Every pixel in the G-Buffer is considered a secondary light source -> point lights • The normal is considered the light direction • Radiant intensity emitted at point p in direction ω Φp– the flux defines the brightness of the pixel light np – normal at point p spatial emission
  • 19. Screen-Space Global Illumination • Irradiance at surface point p with normal n due to pixel light p is thus Φp– the flux defines the brightness of the pixel light np – normal at point p spatial emission • Evaluating indirect irradiance at a surface point x with normal x PTarget PSampling V NormalSampling NormalTarget
  • 20. Screen-Space Global Illumination • PSampling contribution to Ptarget(Outgoing cosinus) ISampling = NSampling.-V • Ptarget contribution (Incoming cosinus) Itarget = NTarget.V • Attenuation: A = 1.0 / D2 • Result Result = Isampling * Itarget * A * ColorScreenSpaceRT
  • 21. Screen-Space Global Illumination • Issues – All the issues from SSAO – Does not consider occlusion for the indirect light sources -> color changes based on viewing angle -> Different with reflective shadow maps …
  • 22. Reflective Shadow Maps • Extended shadow map [Dachsbacher] - Multiple-Render Target (MRT) that holds – Depth Buffer – Normal – World space position – Flux • Each pixel in the MRT is considered a secondary light source; considered local point lights -> called pixel lights • Radiant intensity emitted at point p in direction ω Φp– the flux defines the brightness of the pixel light np – normal at point p spatial emission
  • 23. • Irradiance at surface point p with normal n due to pixel light p is thus Φp– the flux defines the brightness of the pixel light np – normal at point p spatial emission • Evaluating indirect irradiance at a surface point x with normal x • Does not consider occlusion for the indirect light sources -> color changes based on viewing angle Reflective Shadow Maps
  • 24. Reflective Shadow Maps • Challenge: a typical RSM is 512x512 -> evaluation of all those too expensive • Importance Sampling -> evaluate about 400 samples How to pick the sampling points: 1. Uniformly distributed random numbers are applied to polar coordinates 2. Then they compensate for the varying density by weighting the achieved samples ξ1- uniformly distributed random number ξ2- uniformly distributed random number • Precompute sampling pattern and re-use it for all indirect light computations • Still too expensive -> Screen-Space interpolation
  • 25. Reflective Shadow Maps • Screen-Space Interpolation 1. pass – compute the indirect illumination for a low-resolution image in screen-space 2. pass – render full-res + check if we can interpolate from the four surrounding low- res samples • A low-res sample is regarded as suitable for interpolation if – the sample’s normal is similar to the pixel’s normal, – and if its world space location is close to the pixel’s location • Each samples contribution is weighted by the factors used for bi-linear interpolation – If not all samples of the four samples are used -> normalization – If all three or four samples are considered as suitable -> interpolate between those
  • 26. Reflective Shadow Maps • How to pick important pixel lights 1. Not visible in shadow map: x is not directly illuminated -> not visible in shadow map 2. Normals point away: x-1 and x-2 are relatively close, but since their normal points away from x they do not contribute 3. Same floor: x1 is very close but lies on the same floor -> won’t contribute 4. 1 – 3 not applicable: x2 will contribute 5. What is important: distance between x and a pixel light xp in the shadow map is a reasonable approximation for their distance in world space -> if the depth values with respect to the light source differ significantly, the world space distance is much bigger and we thus overestimate the influence -> important indirect lights will always be close, and these must also be close in the shadow map
  • 27. Splatting Indirect Illumination •Build on RSM •Instead of iterating over all image pixels and gathering indirect light from RSM -> Selects a subset of RSM pixels == pixel lights and distributes their light to the image pixels, using a splat in screen-space -> Deferred lighting idea re-visited
  • 28. Splatting Indirect Illumination • Stores – Flux – N.L * Color – Normal – just world-space normal – Position – offset in neg. direction of normal – Gloss value – gloss value is instead of specular component • in Reflective Shadow map
  • 29. Splatting Indirect Illumination •How to create a Reflective Shadow Map: RESULT_RSM psCreateRSM( FRAGMENT_RSM fragment ) { RESULT_RSM result; float3 worldSpacePos = fragment.wsPos.xyz; float3 lightVector = normalize( lightPosition - worldSpacePos ); float3 normal = normalize( fragment.normal ); // compute flux float4 flux = materialColor * saturate( dot( normal.xyz, lightVector ) ); // we squeeze everything into two floats quadrupels, as vertex texture fetches are expensive! float squeezedFlux = encodeFlux( flux.xyz ); float phongExponent = 1.0f; float3 mainLightDirection = normal; if ( dot( mainLightDirection, lightVector ) < 0.0f ) normal *= -1.0f; result.color[ 0 ] = float4( mainLightDirection, squeezedFlux ); // we move position a little bit back in the direction of the normal // this is done to avoid rendering problems along common boundaries of walls -> illumination integral has a // singularity there result.color[ 1 ] = float4( worldSpacePos - normal * 0.2f, phongExponent ); return result; }
  • 30. Splatting Indirect Illumination • How do we fetch the RSM? • Splat position: pre-calculated distribution of sample points in light space -> 3D poisson disk distribution Left - Sample points in light space / Right – Splats in main view
  • 31. Splatting Indirect Illumination Pseudo code 1.Fetch pre-calculated distribution of sample points in light space in a texture 2.Calculate size of ellipsoid bounding volume in screen- space (see article for code)
  • 32. Splatting Indirect Illumination 3.Reduce size of splat based on – Size of the bounding volume – Distance camera <-> pixel light
  • 33. Splatting Indirect Illumination • Going back to the original Reflective Shadow Map algorithm: • Irradiance at surface point p with normal n due to pixel light p is thus Φp – the flux defines the brightness of the pixel light np – normal at point p spatial emission • Evaluating indirect irradiance at a surface point x with normal x PTarget PSampling V NormalSampling NormalTarget
  • 34. Splatting Indirect Illumination • PSampling contribution to Ptarget(Outgoing cosinus) ISampling = NSampling.-V • Ptarget contribution (Incoming cosinus) Itarget = NTarget.V • Attenuation: A = 1.0 / (D2 * Scale + Bias) • Result Result = Isampling * Itarget * A * ColorScreenSpaceRT
  • 35. Splatting Indirect Illumination • Glossiness based on outgoing cosinus float Gloss = pow(NSampling.-V, phongExp)
  • 36. Splatting Indirect Illumination • Let’s single-step through the splatting pixel shader float4 psSI( FRAGMENT_SI fragment ) : COLOR { float4 result; // get surface info for this pixel float4 wsPos = tex2Dproj( DSSample0, fragment.pos2D ); float4 normal = tex2Dproj( DSSample1, fragment.pos2D ) * 2.0f - 1.0f; // decode world space position (8 bit render target!) wsPos = ( wsPos - 0.5f ) * WSSIZE; // compute lighting float l2, lR, cosThetaI, cosThetaJ, Fij, phongExp; // lightPos comes from the RSM read in the vertex shader // lightPos – pixel light // wsPos – fragment position float3 R = fragment.lightPos - wsPos.xyz; // R = vector from fragment to pixel light l2 = dot( R, R ); // squared length of R (needed again later) R *= rsqrt( l2 ); // normalize R lR = ( 1.0f / ( distBias + l2 * INV_WS_SIZE2_PI * 2 ) ); // distance attenuation (there's a global scene scaling factor "...WS_SIZE...")
  • 37. Splatting Indirect Illumination // lightDir comes from RSM read in vertex shader // this is the world space normal stored in the RSM of the pixel light == direction of the pixel light cosThetaI = saturate( dot( fragment.lightDir, -R ) ); // outgoing cosine phongExp = fragment.lightDir.w; // with a phong like energy attenuation and widening of the high intensity region if ( phongExp > 1.0f ) cosThetaI = pow( cosThetaI, phongExp * l2 ); // compare world-space normal at fragment that gets rendered with R cosThetaJ = saturate( dot( normal, R ) ); // incoming cosine Fij = cosThetaI * cosThetaJ * lR; // putting everything together #ifdef SMOOTH_FADEOUT // screen-space position of center of splat float3 t1 = fragment.center2D.xyz / fragment.center2D.w; // screen-space position of the pixel we are currently shading float3 t2 = fragment.pos2D.xyz / fragment.pos2D.w; // lightFlux.w holds fade out value based on distance between camera and the pixel light position // xy is based on screen-space and z is based on the distance between the camera and the pixel position float fadeOutFactor = saturate( 2 - 6.667 * length( t1.xy - t2.xy ) / fragment.lightFlux.w ); Fij *= fadeOutFactor; #endif result = fragment.lightFlux * Fij; // transfer energy! return result; } Green arrow – R Orange arrow – normal fragment Blue arrow – pixel light direction
  • 38. Splatting Indirect Illumination • SII importance Sampling -> doesn’t seem to work on modern hardware -> ignore it for now
  • 39. Conclusion • Screen-Space Global Illumination – allows to generate the impression of color bleeding with the lowest possible amount of memory – does not require any transform – ”fits” into a PostFX pipeline – has all the issues of SSAO + false colors • Reflective Shadow Maps + SII – higher quality than SSGI – “fits” into a Deferred Lighting engine and any Cascaded Shadow Map approach – requires one or more additional G-Buffers from the point of view of the light – more expensive
  • 40. References • [Brennan] Chris Brennan, “Diffuse Cube Mapping”, ShaderX, pp. 287 - 289 • [Dachsbacher] Carsten Dachsbacher, Marc Stamminger, “Reflective Shadow Maps”, http://www.vis.uni-stuttgart.de/~dachsbcn/download/rsm.pdf http://www.vis.uni-stuttgart.de/~dachsbcn/publications.html • [DachsbacherSii] Carsten Dachsbacher, Marc Stamminger, “Splatting Indirect Illumination”, http://www.vis.uni-stuttgart.de/~dachsbcn/download/sii.pdf • [Kajalin] Vladimir Kajalin, “Screen-Space Ambient Occlusion”, pp. 413 – 424, ShaderX7 • [Loos] Bradford James Loos, Peter-Pike Sloan, “VolumetricObscurance”, http://www.cs.utah.edu/~loos/publications/vo/vo.pdf • [Nichols] Greg Nichols, Chris Wyman, “Multiresolution Splatting for Indirect Illumination”, http://www.cs.uiowa.edu/~cwyman/publications/files/techreports/UICS-TR-08-04.pdf • [Ritschel] Tobias Ritschel, “Imperfect Shadow Maps for Efficient Computation of Indirect Illumination”, http://www.uni-koblenz.de/~ritschel/ • [Zink] Jason Zink, “Screen Space Ambient Occlusion”, http://wiki.gamedev.net/index.php/D3DBook:Screen_Space_Ambient_Occlusion

Editor's Notes

  1. Instead of computing the amount of occlusion produced by geometry hits through ray-tracing, we approximate it by the amount of solid geometry around a point.
  2. Instead of computing the amount of occlusion produced by geometry hits through ray-tracing, we approximate it by the amount of solid geometry around a point.
  3. Instead of computing the amount of occlusion produced by geometry hits through ray-tracing, we approximate it by the amount of solid geometry around a point.
  4. Instead of computing the amount of occlusion produced by geometry hits through ray-tracing, we approximate it by the amount of solid geometry around a point.
  5. ω – greek small letter omega Φ – greek capital letter Phi
  6. ω – greek small letter omega
  7. ω – greek small letter omega Irradience - the amount of light or other radiant energy striking a given area of a surface; illumination