SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Deferred Lighting, MSAA
Wolfgang Engel
Confetti Special Effects Inc., Carlsbad
Paris Master Class
Deferred Lighting
Deferred Lighting
Agenda
• Rendering Many Lights History
• Light Pre-Pass (LPP)
• LPP Implementation
• Efficient Light rendering on DX 9, 10, 11
• Balance Quality / Performance
• MSAA Implementation on DX 10.0, 10.1, XBOX
360, 11
Z Pre-Pass
Rendering Many Lights History
• Forward / Z Pre-Pass rendering
– Re-render geometry for each light
-> lots of geometry throughput (still an option on
older hardware) -> DOOM III
– Write pixel shader with four or eight lights -> draw
lights per-object -> need to split up geometry
following light distribution
– Store light properties in textures and index into
this texture -> dependent texture look-up and
lights are not fully dynamic
Rendering Many Lights History
• Deferred Shading / Rendering
Split up rendering into a geometry pass and a
lighting pass -> makes lights independent from
geometry
• Geometry pass stores all material and light
properties
Killzone 2’s G-Buffer Layout (courtesy of Michal Valient)
Rendering Many Lights History
Deferred Shading / Rendering
Depth Buffer
Deferred
Lighting
Forward
Rendering
Switch off depth write
Specular /
Motion Vec
Normals
Albedo /
Shadow
Sort Back-To-Front
Render opaque objects Transparent objects
Rendering Many Lights History
• Advantages:
– Only one geometry pass for the main view (probably more
than a dozen for other views like shadows, reflections,
transparent objects etc.)
– Lights are blit and therefore only limited by memory
bandwidth
• Disadvantages:
– Memory bandwidth (reading four render targets for each
light)
– Recalculate full lighting equation for every light
– Limited material representation in G-Buffer
– MSAA difficult compared to Forward Renderer
Light Pre-Pass
• Light Pre-Pass / Deferred Lighting
Normals
Specular Power
Depth
Light Buffer
Frame Buffer
Render opaque Geometry sorted front-to-back
Blit Lights into Light Buffer (sorted front-to-back)
Render opaque Geometry sorted front-to-back
or
Blit ambient term and other lighting terms into final image
Color
Light Pre-Pass
• Version A (only opaque objects):
– Geometry pass: fill up normal and depth buffer
– Lighting pass: store light properties in light buffer
– 2. Geometry pass: fetch light buffer and apply
different material terms per surface by re-
constructing the lighting equation
Light Pre-Pass
• Version B (similar to S.T.A.L.K.E.R: Clear Skies
[Lobanchikov]):
– Geometry pass: fill up normal + spec. power and
depth buffer and a color buffer for the ambient
pass
– Lighting pass: store light properties in light buffer
– Ambient + Resolve (MSAA) pass: fetch light buffer
use its content as diffuse and specular content
and add the ambient term while resolving into the
main buffer
Light Pre-Pass
S.T.A.L.K.E.R: Clear Skies
Light Pre-Pass
• Light Properties that are stored in light buffer
• Light buffer layout
• Dred/green/blue is the light color
Light Pre-Pass
• Specular stored as luminance
• Reconstructed with diffuse chromacity
Light Pre-Pass
CryEngine 3: On the right the approx. specular term of the light buffer and on the left
a correct specular term with its own specular color (courtesy of Martin Mittring)
Light Pre-Pass
CryEngine 3: On the right the approx. specular term of the light buffer and on the left
the final image (courtesy of Martin Mittring)
Light Pre-Pass
• Advantage of Version A: offers more material
variety
• Version B faster: does not need to render
scene geometry a second time
Light Pre-Pass Implementation
• Memory Bandwidth Optimizations (DirectX 9)
– Depth-fail Stencil lights: render light volume in stencil and
then blit light [Hargreaves][Valient]
– Geometry lights: render bounding geometry -> never get
inside light -> avoid depth func change [Thibieroz04]
– Scissor lights: construct scissor rectangle from bounding
volume and set it [Placeres] (PS3: depth bound testing ~
scissor in 3D)
– Batched lights: sort lights by size, x and y position in
screenspace. Render close lights in batches of 4, 8, 16
DistancefromCamera
Light Pre-Pass Implementation
• Memory Bandwidth Optimizations (DirectX
10, 10.1, 11)
– Light bounds calculated in Geometry Shader
• GS bounding box: construct bounding box around light
in the geometry shader
• Render only light for what is in this box
• Check out implementation in the Deferred Lighting
example provided
– Implement lighting with the compute shader
Light Pre-Pass Implementation
Resistance 2TM
in-game screenshot; first row on the left is the depth buffer, on the right
is the normal buffer; in the second row is the diffuse light buffer and on the right is
the specular light buffer; in the last row is the final result.
Light Pre-Pass Implementation
UnchartedTM
in-game screenshot
Light Pre-Pass Implementation
BlurTM
in-game screenshot
Light Pre-Pass Implementation
• Balance Quality / Performance
– Stop rendering dynamic lights after a certain
range for example 40 meters and render glow
cards instead
– Use smaller light buffer for distant lights and scale
up
Light Zoning
• Deferred light source
w/o shadows tend to bleed:
– Shadows are expensive
• Problem: e.g. light shines on other side of wall
on the floor
-> have special light types that deal with the
problem like a 180 degree spotlight; artists
have to place this
• Solution 1: Advanced interzone lighting
analysis [Lengyel]
Light Zoning
• Solution 2 [Kaplanyan]: use artist-defined
clipping geometry: clip volumes
– Mask the stencil in addition to light volume
masking
– Very cheap providing fourfold stencil tagging
speed
MSAA
• MSAA Light Pre-Pass Version A
• MSAA Light Pre-Pass Version B
• Edge Detection to run per-sample
– Centroid Sampling trick
– Normal Sampling trick
MSAA
Multisample Anti-Aliasing (courtesy of Nicolas Thibieroz)
MSAA
• LPP Version A
1. Geometry pass: render into MSAA’ed normal and
depth buffer
2. Lighting pass (ideal world): render by reading each
sample in the MSAA’ed buffer and write into each
sample in the MSAA’ed light buffer
3. Second Geometry pass: render geometry into
MSAA’ed accumulation buffer by reading the
MSAA’ed light buffer, depth and normal buffer and
re-constructing the lighting equation
4. Resolve: into main buffer
MSAA
• LPP Version B
1. Geometry pass: render into MSAA’ed normal,
depth and color buffer
2. Lighting pass (ideal world): render by reading
each sample in the MSAA’ed buffer and write
into a sample in the MSAA’ed light buffer
3. Ambient pass: resolve light buffer and color
buffer into main buffer by adding the ambient
term
MSAA
• Lighting pass: MSAA lighting is required e.g.
one sample is covered by a green light and
three by a red light
• Per sample is expensive- > optimize by
detecting polygon edges
– Run screen-space edge detection filter with
normal and/or depth buffer
– Or use centroid sampling
• Edge Detection - Centroid Sampling
Sample location with MSAA commonly center of
pixel, except with centroid sampling -> sample
location within the primitive
Edge detection with centroid sampling (courtesy of Nicolas Thibieroz)
MSAA
MSAA
• Edge Detection - Centroid Sampling Trick II
– Sample without and with centroid sampling -> find
out if the second sample coordinate is offset
[Thieberoz]
– Check the fractional part of the position value if it
equals 0.5 -> no polygon edge [Persson]
MSAA
• Edge Detection - Centroid sampling Trick III:
Disclaimer:
– Probably only works with 2xMSAA
– PC Hardware might return the center point for
4xMSAA [Shishkovtsov]
MSAA
• Edge Detection – MSAA’ed Normal Buffer
• Normals in MSSA’ed buffer; e.g. 4 normals for
4xMSAA
– If directions are similar -> averaged length is close to
one
– If directions are different -> averaged length is
decreased
clip( abs(L-P)-epsilon )
L – sample normal buffer with linear sampling
P – sample normal buffer with point sampling
• Assumes normals are in buffer with x,y and z
value -> x and y alone wouldn’t work
[Pranckevičius]
MSAA
• Store result in stencil buffer
• Two shaders:
– run the per-sample shader only on edges
– rest -> run per-pixel shader
// if MSAA is used
for (int p = 0; p < 2; p++)
{
…
renderer->setDepthState(stencilTest, (p == 0)? 0x1 : 0x0);
renderer->setShader(lighting[p]);
…
}
MSAA
…
// shader that fills the G-Buffer
struct PsIn
{
centroid float4 position : SV_Position;
…
};
// find polygon edge with centroid sampling
Out.base.a = dot(abs(frac(In.position.xy) - 0.5), 1000.0);
// shader that resolves the color buffer with the edge data in alpha
// resolve color buffer and write out 1 into a non-MSAA’ed render target
return (base.a > 0.0);
// shader that creates the stencil buffer mask
clip(BackBuffer.Sample(filter, In.texCoord).a - 0.5);
…
MSAA
• SV_Position outputs the sample location -> center of the pixel
(without MSAA)
– top-left pixel (0.5, 0.5)
– bottom-right (width - 0.5, height - 0.5)
float2 screenPos = In.Pos.xy;
screenPos /= float2( m_FBWidth, m_FBHeight );
float4 outColor = g_txColor.Sample(g_SamplePoint, screenPos );
• Casting to int will return integer coordinates for the pixel given
round-towards-zero semantics -> true for any sample location
within the pixel
float2 screenPos = In.Pos.xy;
int3 iScreenPos = int3( int2(screenPos), 0 );
float4 outColor = g_txColor.Load( iScreenPos );
• Accessing samples requires
uint uSample : SV_SAMPLEINDEX; // Sample frequency
// Sample GBuffers
C = Color.Load( nScreenCoordinates, In.uSample);
MSAA
• DirectX 10.1, 11, XBOX 360: execute pixel shader
per sample
struct PsIn
{
…
uint uSample : SV_SAMPLEINDEX; // Sample frequency
};
float4 PSLightPass_EdgeSampleOnly(PsIn In) : SV_TARGET
{
// Sample GBuffers
C = Color.Load( nScreenCoordinates, In.uSample);
Norm = Normal.Load( nScreenCoordinates, In.uSample);
D = Depth.Load( nScreenCoordinates, In.uSample);
// extract data from GBuffers
//…
// do the lighting
return LightEquation(…);
}
MSAA
• DirectX 9:
– Can’t run shader at sample frequency or support
of mask
– no MSAA’ed depth buffer read and write
• DirectX 10
– Can write with a mask into samples and read from
samples -> shader runs per-pixel
– No MSAA’ed depth buffer read and write officially
(maybe if you ask your hardware support engineer
)
MSAA
• MSAA has best quality settings
• Might be quite expensive
• Morphological Anti-Aliasing
• http://www.iryoku.com/mlaa/
• Drawback: doesn’t work well on moving
objects
Homework
• Read the written version of my SIGGRAPH talk
• Read the overview on different Deferred
Lighting Approaches by Naty Hoffman:
http://www.realtimerendering.com/blog/deferred
• Read in Real-Time Rendering Section 7.9.2
Further Reading
• Fabio Policarpo et al., Deferred Shading
Tutorial,
http://www710.univ-lyon1.fr/~jciehl/Public/educ/
• NVIDIA SDK Deferred Shading Example:
http://developer.download.nvidia.com/SDK/9.5/S
-> Shows how to project a box around a point
light into clip space so that the surrounding
rectangular can be calculated
References
[Brennan] Chris Brennan, “Per-Pixel Fresnel Term”, Direct3D ShaderX – Vertex and Pixel
Shader Tips and Tricks, Wordware, 2002, ISBN 1-55622-041-3
[Engel] Wolfgang Engel, “Programming Vertex and Pixel Shaders,” pp. 123 – 127, Charles River Media, 2004, ISBN 1-58450-349-1
[Hargreaves] Shawn Hargreaves, “Deferred Shading”, http://www.talula.demon.co.uk/DeferredShading.pdf
[Hoffman] Naty Hoffman, “Deferred lighting approaches”,
http://www.realtimerendering.com/blog/deferred-lighting-approaches/#more-94
[Kaplanyan], Anton Kaplanyan, CryENGINE 3: reaching the speed of light, SIGGRAPH 2010,
http://www.crytek.com/cryengine/presentations/CryENGINE3-reaching-the-speed-of-light
[Lee] Mark Lee, “Resistance 2 Prelighting”, http://www.insomniacgames.com/tech/articles/0409/files/GDC09_Lee_Prelighting.pdf
[Lobanchikov] Igor A. Lobanchikov, “ GSC Game World‘s S.T.A.L.K.E.R : Clear Sky – a showcase for Direct3D 10.0/1”,
http://developer.amd.com/gpu_assets/01GDC09AD3DDStalkerClearSky210309.ppt
[Mittring] Martin Mittring, “A bit more Deferred – Cry Engine 3”, http://www.slideshare.net/guest11b095/a-bit-more-deferred-cry-engine3
[Moeller] Tomas Akenine-Moeller, Eric Haines, Naty Hoffman, “Real-Time
Rendering,” AK Peters, 2008, ISBN 978-1-56881-424-7, pp. 214 – 215
[Palestra] Christophe Balestra, Pål-Kristian Engstad, “The technology of Uncharted:
Drake’s Fortune”, http://www.naughtydog.com/corporate/press/GDC%202008/UnchartedTechGDC2008.pdf
[Persson] Emil Persson, “Deferred Shading 2”,
http://www.humus.name/index.php?page=3D
[Pettineo] Matt Pettineo, “Scintillating Snippets: Reconstructing Position From Depth”,
http://mynameismjp.wordpress.com/2009/03/10/reconstructing-position-from-depth/
[Placeres] Frank Puig Placeres, “Overcoming Deferred Shading Drawbacks,” pp. 115 – 130, ShaderX5
[Shishkovtsov] Oles Shishkovtsov, “Making some use out of hardware multisampling”; http://oles-rants.blogspot.com/2008/08/making-some-
use-out-of-hardware.html
[Pranckevičius ] Aras Pranckevičius, “Compact Normal Storage for small G-Buffers”, http://aras-p.info/texts/CompactNormalStorage.html
[Swoboda] Matt Swoboda, “Deferred Lighting and Post Processing on PLAYSTATION®3, http://research.scee.net/presentations
[Thibieroz04] Nick Thibieroz, “Deferred Shading with Multiple-Render-Targets”
pp. 251 – 269, ShaderX2 – Shader Programming Tips & Tricks with DirectX9
[Thibieroz] Nick Thibieroz, “Deferred Shading with Multisampling Anti-Aliasing in DirectX 10” , ShaderX7 – Advanced Rendering Techniques,
pp. ??? - ???
[Tovey] Steven J. Tovey, Stephen McAuley, “Parallelized Light Pre-Pass Rendering with
the Cell Broadband EngineTM
”, to appear in GPU Pro – Advanced Rendering Techniques,
AK Peters, March 2010.
[Valient07] Michael Valient, “Deferred Rendering in Killzone 2,” www.guerilla-games.com/publications/dr_kz2_rsx_dev07.pdf
References
[Thibieroz] Nick Thibieroz, “Deferred Shading with Multisampling Anti-Aliasing in DirectX 10” ,
ShaderX7 – Advanced Rendering Techniques, pp. 225- 245
[Tovey] Steven J. Tovey, Stephen McAuley, “Parallelized Light Pre-Pass Rendering with the Cell
Broadband EngineTM
”, to appear in GPU Pro – Advanced Rendering Techniques, AK Peters, March
2010.
[Valient07] Michael Valient, “Deferred Rendering in Killzone 2,” www.guerilla-
games.com/publications/dr_kz2_rsx_dev07.pdf

Weitere ähnliche Inhalte

Was ist angesagt?

Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shadersstevemcauley
 
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
 
High Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in FrostbiteHigh Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in FrostbiteElectronic Arts / DICE
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2ozlael ozlael
 
Deferred shading
Deferred shadingDeferred shading
Deferred shadingFrank Chao
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontElectronic Arts / DICE
 
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham Origins
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham OriginsGTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham Origins
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham OriginsColin Barré-Brisebois
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3guest11b095
 
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...Codemotion
 
Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsElectronic Arts / DICE
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsJohan Andersson
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...Colin Barré-Brisebois
 
Star Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingStar Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingumsl snfrzb
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Johan Andersson
 
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3Electronic Arts / DICE
 

Was ist angesagt? (20)

Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
 
Lighting you up in Battlefield 3
Lighting you up in Battlefield 3Lighting you up in Battlefield 3
Lighting you up in Battlefield 3
 
Light prepass
Light prepassLight prepass
Light prepass
 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)
 
High Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in FrostbiteHigh Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in Frostbite
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Lighting the City of Glass
Lighting the City of GlassLighting the City of Glass
Lighting the City of Glass
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
 
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham Origins
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham OriginsGTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham Origins
GTC 2014 - DirectX 11 Rendering and NVIDIA GameWorks in Batman: Arkham Origins
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
 
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...
An introduction to Realistic Ocean Rendering through FFT - Fabio Suriano - Co...
 
Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance Fields
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next Steps
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
 
Star Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processingStar Ocean 4 - Flexible Shader Managment and Post-processing
Star Ocean 4 - Flexible Shader Managment and Post-processing
 
A Real-time Radiosity Architecture
A Real-time Radiosity ArchitectureA Real-time Radiosity Architecture
A Real-time Radiosity Architecture
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
 
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
 

Andere mochten auch

Qauntum break
Qauntum breakQauntum break
Qauntum breakhalo4robo
 
Deferred rendering in Dying Light
Deferred rendering in Dying LightDeferred rendering in Dying Light
Deferred rendering in Dying LightMaciej Jamrozik
 
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1Ki Hyunwoo
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Graham Wihlidal
 
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 AndromedaElectronic Arts / DICE
 

Andere mochten auch (6)

Qauntum break
Qauntum breakQauntum break
Qauntum break
 
Deferred rendering in Dying Light
Deferred rendering in Dying LightDeferred rendering in Dying Light
Deferred rendering in Dying Light
 
Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3
 
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1
Unreal Summit 2016 Seoul Lighting the Planetary World of Project A1
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016
 
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
 

Ähnlich wie Paris Master Class 2011 - 01 Deferred Lighting, MSAA

The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2Guerrilla
 
Develop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiakDevelop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiakMatt Filer
 
A modern Post-Processing Pipeline
A modern Post-Processing PipelineA modern Post-Processing Pipeline
A modern Post-Processing PipelineWolfgang Engel
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space MarinePope Kim
 
The Next Generation of PhyreEngine
The Next Generation of PhyreEngineThe Next Generation of PhyreEngine
The Next Generation of PhyreEngineSlide_N
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Tiago Sousa
 
Extended Light Maps
Extended Light MapsExtended Light Maps
Extended Light Mapsstefan_b
 
Rendering basics
Rendering basicsRendering basics
Rendering basicsicedmaster
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologyTiago Sousa
 
Practical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT MethodsPractical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT MethodsNaughty Dog
 
Edge detection-based post-processing in Warlords of Draenor
Edge detection-based post-processing in Warlords of DraenorEdge detection-based post-processing in Warlords of Draenor
Edge detection-based post-processing in Warlords of DraenorGael Hofemeier
 
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...Unity Technologies
 
Deferred Lighting and Post Processing on PLAYSTATION®3
Deferred Lighting and Post Processing on PLAYSTATION®3Deferred Lighting and Post Processing on PLAYSTATION®3
Deferred Lighting and Post Processing on PLAYSTATION®3Slide_N
 
Enterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkEnterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkAlpine Data
 
Enterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkEnterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkSpark Summit
 
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...Joonhyung Lee
 
Single Sample Soft Shadows Using Depth Maps
Single Sample Soft Shadows Using Depth MapsSingle Sample Soft Shadows Using Depth Maps
Single Sample Soft Shadows Using Depth Mapsstefan_b
 
Explaining the decisions of image/video classifiers
Explaining the decisions of image/video classifiersExplaining the decisions of image/video classifiers
Explaining the decisions of image/video classifiersVasileiosMezaris
 
Practical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsxPractical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsxMannyK4
 

Ähnlich wie Paris Master Class 2011 - 01 Deferred Lighting, MSAA (20)

The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2
 
Develop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiakDevelop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiak
 
A modern Post-Processing Pipeline
A modern Post-Processing PipelineA modern Post-Processing Pipeline
A modern Post-Processing Pipeline
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
The Next Generation of PhyreEngine
The Next Generation of PhyreEngineThe Next Generation of PhyreEngine
The Next Generation of PhyreEngine
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)
 
Extended Light Maps
Extended Light MapsExtended Light Maps
Extended Light Maps
 
Rendering basics
Rendering basicsRendering basics
Rendering basics
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Practical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT MethodsPractical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT Methods
 
Edge detection-based post-processing in Warlords of Draenor
Edge detection-based post-processing in Warlords of DraenorEdge detection-based post-processing in Warlords of Draenor
Edge detection-based post-processing in Warlords of Draenor
 
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...
Unite Berlin 2018 - Book of the Dead Optimizing Performance for High End Cons...
 
Deferred Lighting and Post Processing on PLAYSTATION®3
Deferred Lighting and Post Processing on PLAYSTATION®3Deferred Lighting and Post Processing on PLAYSTATION®3
Deferred Lighting and Post Processing on PLAYSTATION®3
 
Enterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkEnterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using Spark
 
Enterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using SparkEnterprise Scale Topological Data Analysis Using Spark
Enterprise Scale Topological Data Analysis Using Spark
 
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...
DeepLab V3+: Encoder-Decoder with Atrous Separable Convolution for Semantic I...
 
Single Sample Soft Shadows Using Depth Maps
Single Sample Soft Shadows Using Depth MapsSingle Sample Soft Shadows Using Depth Maps
Single Sample Soft Shadows Using Depth Maps
 
Explaining the decisions of image/video classifiers
Explaining the decisions of image/video classifiersExplaining the decisions of image/video classifiers
Explaining the decisions of image/video classifiers
 
Practical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsxPractical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsx
 

Mehr von Wolfgang Engel

Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility bufferWolfgang 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 SystemWolfgang 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 TransparencyWolfgang 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 SystemWolfgang 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 ClassWolfgang Engel
 

Mehr von Wolfgang Engel (7)

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 - 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 - 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
 

Kürzlich hochgeladen

Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 

Kürzlich hochgeladen (20)

Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 

Paris Master Class 2011 - 01 Deferred Lighting, MSAA

  • 1. Deferred Lighting, MSAA Wolfgang Engel Confetti Special Effects Inc., Carlsbad Paris Master Class
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 10. Agenda • Rendering Many Lights History • Light Pre-Pass (LPP) • LPP Implementation • Efficient Light rendering on DX 9, 10, 11 • Balance Quality / Performance • MSAA Implementation on DX 10.0, 10.1, XBOX 360, 11
  • 12. Rendering Many Lights History • Forward / Z Pre-Pass rendering – Re-render geometry for each light -> lots of geometry throughput (still an option on older hardware) -> DOOM III – Write pixel shader with four or eight lights -> draw lights per-object -> need to split up geometry following light distribution – Store light properties in textures and index into this texture -> dependent texture look-up and lights are not fully dynamic
  • 13. Rendering Many Lights History • Deferred Shading / Rendering Split up rendering into a geometry pass and a lighting pass -> makes lights independent from geometry • Geometry pass stores all material and light properties Killzone 2’s G-Buffer Layout (courtesy of Michal Valient)
  • 14. Rendering Many Lights History Deferred Shading / Rendering Depth Buffer Deferred Lighting Forward Rendering Switch off depth write Specular / Motion Vec Normals Albedo / Shadow Sort Back-To-Front Render opaque objects Transparent objects
  • 15. Rendering Many Lights History • Advantages: – Only one geometry pass for the main view (probably more than a dozen for other views like shadows, reflections, transparent objects etc.) – Lights are blit and therefore only limited by memory bandwidth • Disadvantages: – Memory bandwidth (reading four render targets for each light) – Recalculate full lighting equation for every light – Limited material representation in G-Buffer – MSAA difficult compared to Forward Renderer
  • 16. Light Pre-Pass • Light Pre-Pass / Deferred Lighting Normals Specular Power Depth Light Buffer Frame Buffer Render opaque Geometry sorted front-to-back Blit Lights into Light Buffer (sorted front-to-back) Render opaque Geometry sorted front-to-back or Blit ambient term and other lighting terms into final image Color
  • 17. Light Pre-Pass • Version A (only opaque objects): – Geometry pass: fill up normal and depth buffer – Lighting pass: store light properties in light buffer – 2. Geometry pass: fetch light buffer and apply different material terms per surface by re- constructing the lighting equation
  • 18. Light Pre-Pass • Version B (similar to S.T.A.L.K.E.R: Clear Skies [Lobanchikov]): – Geometry pass: fill up normal + spec. power and depth buffer and a color buffer for the ambient pass – Lighting pass: store light properties in light buffer – Ambient + Resolve (MSAA) pass: fetch light buffer use its content as diffuse and specular content and add the ambient term while resolving into the main buffer
  • 20. Light Pre-Pass • Light Properties that are stored in light buffer • Light buffer layout • Dred/green/blue is the light color
  • 21. Light Pre-Pass • Specular stored as luminance • Reconstructed with diffuse chromacity
  • 22. Light Pre-Pass CryEngine 3: On the right the approx. specular term of the light buffer and on the left a correct specular term with its own specular color (courtesy of Martin Mittring)
  • 23. Light Pre-Pass CryEngine 3: On the right the approx. specular term of the light buffer and on the left the final image (courtesy of Martin Mittring)
  • 24. Light Pre-Pass • Advantage of Version A: offers more material variety • Version B faster: does not need to render scene geometry a second time
  • 25. Light Pre-Pass Implementation • Memory Bandwidth Optimizations (DirectX 9) – Depth-fail Stencil lights: render light volume in stencil and then blit light [Hargreaves][Valient] – Geometry lights: render bounding geometry -> never get inside light -> avoid depth func change [Thibieroz04] – Scissor lights: construct scissor rectangle from bounding volume and set it [Placeres] (PS3: depth bound testing ~ scissor in 3D) – Batched lights: sort lights by size, x and y position in screenspace. Render close lights in batches of 4, 8, 16 DistancefromCamera
  • 26. Light Pre-Pass Implementation • Memory Bandwidth Optimizations (DirectX 10, 10.1, 11) – Light bounds calculated in Geometry Shader • GS bounding box: construct bounding box around light in the geometry shader • Render only light for what is in this box • Check out implementation in the Deferred Lighting example provided – Implement lighting with the compute shader
  • 27. Light Pre-Pass Implementation Resistance 2TM in-game screenshot; first row on the left is the depth buffer, on the right is the normal buffer; in the second row is the diffuse light buffer and on the right is the specular light buffer; in the last row is the final result.
  • 30. Light Pre-Pass Implementation • Balance Quality / Performance – Stop rendering dynamic lights after a certain range for example 40 meters and render glow cards instead – Use smaller light buffer for distant lights and scale up
  • 31. Light Zoning • Deferred light source w/o shadows tend to bleed: – Shadows are expensive • Problem: e.g. light shines on other side of wall on the floor -> have special light types that deal with the problem like a 180 degree spotlight; artists have to place this • Solution 1: Advanced interzone lighting analysis [Lengyel]
  • 32. Light Zoning • Solution 2 [Kaplanyan]: use artist-defined clipping geometry: clip volumes – Mask the stencil in addition to light volume masking – Very cheap providing fourfold stencil tagging speed
  • 33. MSAA • MSAA Light Pre-Pass Version A • MSAA Light Pre-Pass Version B • Edge Detection to run per-sample – Centroid Sampling trick – Normal Sampling trick
  • 35. MSAA • LPP Version A 1. Geometry pass: render into MSAA’ed normal and depth buffer 2. Lighting pass (ideal world): render by reading each sample in the MSAA’ed buffer and write into each sample in the MSAA’ed light buffer 3. Second Geometry pass: render geometry into MSAA’ed accumulation buffer by reading the MSAA’ed light buffer, depth and normal buffer and re-constructing the lighting equation 4. Resolve: into main buffer
  • 36. MSAA • LPP Version B 1. Geometry pass: render into MSAA’ed normal, depth and color buffer 2. Lighting pass (ideal world): render by reading each sample in the MSAA’ed buffer and write into a sample in the MSAA’ed light buffer 3. Ambient pass: resolve light buffer and color buffer into main buffer by adding the ambient term
  • 37. MSAA • Lighting pass: MSAA lighting is required e.g. one sample is covered by a green light and three by a red light • Per sample is expensive- > optimize by detecting polygon edges – Run screen-space edge detection filter with normal and/or depth buffer – Or use centroid sampling
  • 38. • Edge Detection - Centroid Sampling Sample location with MSAA commonly center of pixel, except with centroid sampling -> sample location within the primitive Edge detection with centroid sampling (courtesy of Nicolas Thibieroz) MSAA
  • 39. MSAA • Edge Detection - Centroid Sampling Trick II – Sample without and with centroid sampling -> find out if the second sample coordinate is offset [Thieberoz] – Check the fractional part of the position value if it equals 0.5 -> no polygon edge [Persson]
  • 40. MSAA • Edge Detection - Centroid sampling Trick III: Disclaimer: – Probably only works with 2xMSAA – PC Hardware might return the center point for 4xMSAA [Shishkovtsov]
  • 41. MSAA • Edge Detection – MSAA’ed Normal Buffer • Normals in MSSA’ed buffer; e.g. 4 normals for 4xMSAA – If directions are similar -> averaged length is close to one – If directions are different -> averaged length is decreased clip( abs(L-P)-epsilon ) L – sample normal buffer with linear sampling P – sample normal buffer with point sampling • Assumes normals are in buffer with x,y and z value -> x and y alone wouldn’t work [Pranckevičius]
  • 42. MSAA • Store result in stencil buffer • Two shaders: – run the per-sample shader only on edges – rest -> run per-pixel shader // if MSAA is used for (int p = 0; p < 2; p++) { … renderer->setDepthState(stencilTest, (p == 0)? 0x1 : 0x0); renderer->setShader(lighting[p]); … }
  • 43. MSAA … // shader that fills the G-Buffer struct PsIn { centroid float4 position : SV_Position; … }; // find polygon edge with centroid sampling Out.base.a = dot(abs(frac(In.position.xy) - 0.5), 1000.0); // shader that resolves the color buffer with the edge data in alpha // resolve color buffer and write out 1 into a non-MSAA’ed render target return (base.a > 0.0); // shader that creates the stencil buffer mask clip(BackBuffer.Sample(filter, In.texCoord).a - 0.5); …
  • 44. MSAA • SV_Position outputs the sample location -> center of the pixel (without MSAA) – top-left pixel (0.5, 0.5) – bottom-right (width - 0.5, height - 0.5) float2 screenPos = In.Pos.xy; screenPos /= float2( m_FBWidth, m_FBHeight ); float4 outColor = g_txColor.Sample(g_SamplePoint, screenPos ); • Casting to int will return integer coordinates for the pixel given round-towards-zero semantics -> true for any sample location within the pixel float2 screenPos = In.Pos.xy; int3 iScreenPos = int3( int2(screenPos), 0 ); float4 outColor = g_txColor.Load( iScreenPos ); • Accessing samples requires uint uSample : SV_SAMPLEINDEX; // Sample frequency // Sample GBuffers C = Color.Load( nScreenCoordinates, In.uSample);
  • 45. MSAA • DirectX 10.1, 11, XBOX 360: execute pixel shader per sample struct PsIn { … uint uSample : SV_SAMPLEINDEX; // Sample frequency }; float4 PSLightPass_EdgeSampleOnly(PsIn In) : SV_TARGET { // Sample GBuffers C = Color.Load( nScreenCoordinates, In.uSample); Norm = Normal.Load( nScreenCoordinates, In.uSample); D = Depth.Load( nScreenCoordinates, In.uSample); // extract data from GBuffers //… // do the lighting return LightEquation(…); }
  • 46. MSAA • DirectX 9: – Can’t run shader at sample frequency or support of mask – no MSAA’ed depth buffer read and write • DirectX 10 – Can write with a mask into samples and read from samples -> shader runs per-pixel – No MSAA’ed depth buffer read and write officially (maybe if you ask your hardware support engineer )
  • 47. MSAA • MSAA has best quality settings • Might be quite expensive • Morphological Anti-Aliasing • http://www.iryoku.com/mlaa/ • Drawback: doesn’t work well on moving objects
  • 48. Homework • Read the written version of my SIGGRAPH talk • Read the overview on different Deferred Lighting Approaches by Naty Hoffman: http://www.realtimerendering.com/blog/deferred • Read in Real-Time Rendering Section 7.9.2
  • 49. Further Reading • Fabio Policarpo et al., Deferred Shading Tutorial, http://www710.univ-lyon1.fr/~jciehl/Public/educ/ • NVIDIA SDK Deferred Shading Example: http://developer.download.nvidia.com/SDK/9.5/S -> Shows how to project a box around a point light into clip space so that the surrounding rectangular can be calculated
  • 50. References [Brennan] Chris Brennan, “Per-Pixel Fresnel Term”, Direct3D ShaderX – Vertex and Pixel Shader Tips and Tricks, Wordware, 2002, ISBN 1-55622-041-3 [Engel] Wolfgang Engel, “Programming Vertex and Pixel Shaders,” pp. 123 – 127, Charles River Media, 2004, ISBN 1-58450-349-1 [Hargreaves] Shawn Hargreaves, “Deferred Shading”, http://www.talula.demon.co.uk/DeferredShading.pdf [Hoffman] Naty Hoffman, “Deferred lighting approaches”, http://www.realtimerendering.com/blog/deferred-lighting-approaches/#more-94 [Kaplanyan], Anton Kaplanyan, CryENGINE 3: reaching the speed of light, SIGGRAPH 2010, http://www.crytek.com/cryengine/presentations/CryENGINE3-reaching-the-speed-of-light [Lee] Mark Lee, “Resistance 2 Prelighting”, http://www.insomniacgames.com/tech/articles/0409/files/GDC09_Lee_Prelighting.pdf [Lobanchikov] Igor A. Lobanchikov, “ GSC Game World‘s S.T.A.L.K.E.R : Clear Sky – a showcase for Direct3D 10.0/1”, http://developer.amd.com/gpu_assets/01GDC09AD3DDStalkerClearSky210309.ppt [Mittring] Martin Mittring, “A bit more Deferred – Cry Engine 3”, http://www.slideshare.net/guest11b095/a-bit-more-deferred-cry-engine3 [Moeller] Tomas Akenine-Moeller, Eric Haines, Naty Hoffman, “Real-Time Rendering,” AK Peters, 2008, ISBN 978-1-56881-424-7, pp. 214 – 215 [Palestra] Christophe Balestra, Pål-Kristian Engstad, “The technology of Uncharted: Drake’s Fortune”, http://www.naughtydog.com/corporate/press/GDC%202008/UnchartedTechGDC2008.pdf [Persson] Emil Persson, “Deferred Shading 2”, http://www.humus.name/index.php?page=3D [Pettineo] Matt Pettineo, “Scintillating Snippets: Reconstructing Position From Depth”, http://mynameismjp.wordpress.com/2009/03/10/reconstructing-position-from-depth/ [Placeres] Frank Puig Placeres, “Overcoming Deferred Shading Drawbacks,” pp. 115 – 130, ShaderX5 [Shishkovtsov] Oles Shishkovtsov, “Making some use out of hardware multisampling”; http://oles-rants.blogspot.com/2008/08/making-some- use-out-of-hardware.html [Pranckevičius ] Aras Pranckevičius, “Compact Normal Storage for small G-Buffers”, http://aras-p.info/texts/CompactNormalStorage.html [Swoboda] Matt Swoboda, “Deferred Lighting and Post Processing on PLAYSTATION®3, http://research.scee.net/presentations [Thibieroz04] Nick Thibieroz, “Deferred Shading with Multiple-Render-Targets” pp. 251 – 269, ShaderX2 – Shader Programming Tips & Tricks with DirectX9 [Thibieroz] Nick Thibieroz, “Deferred Shading with Multisampling Anti-Aliasing in DirectX 10” , ShaderX7 – Advanced Rendering Techniques, pp. ??? - ??? [Tovey] Steven J. Tovey, Stephen McAuley, “Parallelized Light Pre-Pass Rendering with the Cell Broadband EngineTM ”, to appear in GPU Pro – Advanced Rendering Techniques, AK Peters, March 2010. [Valient07] Michael Valient, “Deferred Rendering in Killzone 2,” www.guerilla-games.com/publications/dr_kz2_rsx_dev07.pdf
  • 51. References [Thibieroz] Nick Thibieroz, “Deferred Shading with Multisampling Anti-Aliasing in DirectX 10” , ShaderX7 – Advanced Rendering Techniques, pp. 225- 245 [Tovey] Steven J. Tovey, Stephen McAuley, “Parallelized Light Pre-Pass Rendering with the Cell Broadband EngineTM ”, to appear in GPU Pro – Advanced Rendering Techniques, AK Peters, March 2010. [Valient07] Michael Valient, “Deferred Rendering in Killzone 2,” www.guerilla- games.com/publications/dr_kz2_rsx_dev07.pdf

Hinweis der Redaktion

  1. overlapping lights
  2. dark but not black layering spilling yellow light, red from below
  3. Because luminance is a linear function of RGB, accumulating luminance fulfills the requirement that the sum of all luminance values equals to the luminance of the sum of all specular contributions.
  4. Chromaticity = Color - Luminance Chromaticity is an objective specification of the quality of a color regardless of its luminance, that is, as determined by its hue and colorfulness (or saturation, chroma, intensity, or excitation purity).