SlideShare a Scribd company logo
1 of 55
Download to read offline
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Deferred Rendering in Killzone 2
Michal Valient
Senior Programmer, Guerrilla
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Talk Outline
‣ Forward & Deferred Rendering Overview
‣ G-Buffer Layout
‣ Shader Creation
‣ Deferred Rendering in Detail
‣ Rendering Passes
‣ Light and Shadows
‣ Post-Processing
‣ SPU Usage / Architecture
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Forward & Deferred Rendering Overview
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Forward Rendering – Single Pass
‣ For each object
‣ Find all lights affecting object
‣ Render all lighting and material in a single shader
‣ Shader combinations explosion
‣ Shader for each material vs. light setup combination
‣ All shadow maps have to be in memory
‣ Wasted shader cycles
‣ Invisible surfaces / overdraw
‣ Triangles outside light influence
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Forward Rendering – Multi-Pass
‣ For each light
‣ For each object
‣ Add lighting from single light to frame buffer
‣ Shader for each material and light type
‣ Wasted shader cycles
‣ Invisible surfaces / overdraw
‣ Triangles outside light influence
‣ Lots of repeated work
‣ Full vertex shaders, texture filtering
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Deferred Rendering
‣ For each object
‣ Render surface properties into the G-Buffer
‣ For each light and lit pixel
‣ Use G-Buffer to compute lighting
‣ Add result to frame buffer
‣ Simpler shaders
‣ Scales well with number of lit pixels
‣ Does not handle transparent objects
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
G-Buffer Layout
Target Image
Depth
View-space normal
Specular intensity
Specular roughness / Power
Screen-space 2D motion vector
Albedo (texture colour)
Deferred composition
Image with post-processing (depth of field, bloom, motion blur, colorize, ILR)
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
G-Buffer : Our approach
R8 G8 B8 A8
Depth 24bpp Stencil
Lighting Accumulation RGB Intensity
Normal X (FP16) Normal Y (FP16)
Motion Vectors XY Spec-Power Spec-Intensity
Diffuse Albedo RGB Sun-Occlusion
DS
RT0
RT1
RT2
RT3
‣ MRT - 4xRGBA8 + 24D8S (approx 36 MB)
‣ 720p with Quincunx MSAA
‣ Position computed from depth buffer and pixel coordinates
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
‣ Lighting accumulation – output buffer
‣ Intensity – luminance of Lighting accumulation
‣ Scaled to range [0…2]
‣ Normal.z = sqrt(1.0f - Normal.x2 - Normal.y2)
G-Buffer : Our approach
R8 G8 B8 A8
Depth 24bpp Stencil
Lighting Accumulation RGB Intensity
Normal X (FP16) Normal Y (FP16)
Motion Vectors XY Spec-Power Spec-Intensity
Diffuse Albedo RGB Sun-Occlusion
DS
RT0
RT1
RT2
RT3
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
‣ Motion vectors – screen space
‣ Specular power - stored as log2(original)/10.5
‣ High range and still high precision for low shininess
‣ Sun Occlusion - pre-rendered static sun shadows
‣ Mixed with real-time sun shadow for higher quality
G-Buffer : Our approach
R8 G8 B8 A8
Depth 24bpp Stencil
Lighting Accumulation RGB Intensity
Normal X (FP16) Normal Y (FP16)
Motion Vectors XY Spec-Power Spec-Intensity
Diffuse Albedo RGB Sun-Occlusion
DS
RT0
RT1
RT2
RT3
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
G-Buffer Analysis
‣ Pros:
‣ Highly packed data structure
‣ Many extra attributes
‣ Allows MSAA with hardware support
‣ Cons:
‣ Limited output precision and dynamic range
‣ Lighting accumulation in gamma space
‣ Can use different color space (LogLuv)
‣ Attribute packing and unpacking overhead
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Deferred Rendering Passes
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Geometry Pass
‣ Fill the G-Buffer with all geometry (static, skinned, etc.)
‣ Write depth, motion, specular, etc. properties
‣ Initialize light accumulation buffer with pre-baked light
‣ Ambient, Incandescence, Constant specular
‣ Lightmaps on static geometry
‣ YUV color space, S3TC5 with Y in Alpha
‣ Sun occlusion in B channel
‣ Dynamic range [0..2]
‣ Image based lighting on dynamic geometry
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Image Based Lighting
‣ Artist placed light probes
‣ Arbitrary location and density
‣ Sampled and stored as 2nd order spherical harmonics
‣ Updated per frame for each object
‣ Blend four closest SHs based on distance
‣ Rotate into view space
‣ Encode into 8x8 envmap IBL texture
‣ Dynamic range [0..2]
‣ Generated on SPUs in parallel to other rendering tasks
Scene lighting
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Decals and Weapon Passes
‣ Primitives updating subset of the G-Buffer
‣ Bullet holes, posters, cracks, stains
‣ Reuse lighting of underlying surface
‣ Blend with albedo buffer
‣ Use G-Buffer Intensity channel to fix accumulation
‣ Same principle as particles with motion blur
‣ Separate weapon pass with different projection
‣ Different near plane
‣ Rendered into first 5% of depth buffer range
‣ Still reacts to lights and post-processing
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Light Accumulation Pass
‣ Light is rendered as convex geometry
‣ Point light – sphere
‣ Spot light – cone
‣ Sun – full-screen quad
‣ For each light…
‣ Find and mark visible lit pixels
‣ If light contributes to screen
‣ Render shadow map
‣ Shade lit pixels and add to framebuffer
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Determine Lit Pixels
‣ Marks pixels in front of the far light boundary
‣ Render back-faces of light volume
‣ Depth test GREATER-EQUAL
‣ Write to stencil on depth pass
‣ Skipped for very small distant lights
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Determine Lit Pixels
‣ Find amount of lit pixels inside the volume
‣ Start pixel query
‣ Render front faces of light volume
‣ Depth test LESS-EQUAL
‣ Don’t write anything – only EQUAL stencil test
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Render Shadow Map
‣ Enable conditional rendering
‣ Based on query results from previous stage
‣ GPU skips rendering for invisible lights
‣ Max 1024x1024xD16 shadow map
‣ Fast and with hardware filtering support
‣ Single map reused for all lights
‣ Skip small objects
‣ Small in shadow map and on screen
‣ Artist defined thresholds for lights and objects
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Shade Lit Pixels
‣ Render front-faces of light volume
‣ Depth test - LESS-EQUAL
‣ Stencil test - EQUAL
‣ Runs only on marked pixels inside light
‣ Compute light equation
‣ Read and unpack G-Buffer attributes
‣ Calculate Light vector, Color, Distance Attenuation
‣ Perform shadow map filtering
‣ Add Phong lighting to frame buffer
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Light Optimization
‣ Determine light size on the screen
‣ Approximation - angular size of light volume
‣ If light is “very small”
‣ Don’t do any stencil marking
‣ Switch to non-shadow casting type
‣ Shadows fade-out range
‣ Artist defined light sizes at which:
‣ Shadows start to fade out
‣ Switch to non-shadow casting light
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Sun Rendering
‣ Full screen quad
‣ Stencil mark potentially lit pixels
‣ Use only sun occlusion from G-Buffer
‣ Run final shader on marked pixels
‣ Approx. 50% of pixels skipped thanks 1st pass
‣ Also skybox/background
‣ Simple directional light model
‣ Shadow = min(RealTimeShadow, Occlusion)
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Sun – Real-Time Shadows
‣ Cascade shadow maps
‣ Provide more shadow detail where required
‣ Divide view frustum into several areas
‣ Split along view distance
‣ Split distances defined by artist
‣ Render shadow map for each area
‣ Max 4 cascades
‣ Max 512x512 pixels each in single texture
‣ Easy to address cascade in final render
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Sun – Real-Time Shadows
‣ Issue: Shadow shimmering
‣ Light cascade frustums follow camera
‣ Sub pixel changes in shadow map
‣ Solution!
‣ Don’t rotate shadow map cascade
‣ Make bounding sphere of cascade frustum
‣ Use it to generate cascade light matrix
‣ Remove sub-pixel movements
‣ Project world origin onto shadow map
‣ Use it to round light matrix to nearest shadow pixel corner
Sun - Colored shadow Cascades - Unstable shadow artifacts
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
MSAA Lighting Details
‣ Run light shader at pixel resolution
‣ Read G-Buffer for both pixel samples
‣ Compute lighting for both samples
‣ Average results and add to frame buffer
‣ Optimization in shadow map filtering
‣ Max 12 shadow taps per pixel
‣ Alternate taps between both samples
‣ Half quality on edges, full quality elsewhere
‣ Performance equal to non-MSAA case
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Forward Rendering Pass
‣ Used for transparent geometry
‣ Single pass solution
‣ Shader has four uberlights
‣ No shadows
‣ Per-vertex lighting version for particles
‣ Lower resolution rendering available
‣ Fill-rate intensive effects
‣ Half and quarter screen size rendering
‣ Half resolution rendering using MSAA HW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Post-Processing Pass
‣ Highly customizable color correction
‣ Separate curves for shadows, mid-tones, highlight colors, contrast and
brightness
‣ Everything Depth dependent
‣ Per-frame LUT textures generated on SPU
‣ Image based motion blur and depth of field
‣ Internal lens reflection
‣ Film grain filter
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
SPU Usage and Architecture
Putting it all together
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
SPU Usage
‣ We use SPU a lot during rendering
‣ Display list generation
‣ Main display list
‣ Lights and Shadow Maps
‣ Forward rendering
‣ Scene graph traversal / visibility culling
‣ Skinning
‣ Triangle trimming
‣ IBL generation
‣ Particles
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
SPU Usage (cont.)
‣ Everything is data driven
‣ No “virtual void Draw()” calls on objects
‣ Objects store a decision-tree with DrawParts
‣ DrawParts link shader, geometry and flags
‣ Decision tree used for LODs, etc.
‣ SPUs pull rendering data directly from objects
‣ Traverse scenegraph to find objects
‣ Process object's decision-tree to find DrawParts
‣ Create displaylist from DrawParts
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Main scenegraph + displaylist
Shadow scenegraph + displaylist
IBL generationParticles, Skinning
edgeGeom
PPU
SPU 0
SPU 1
SPU 2
SPU 3
SPU Architecture
GAME, AI
PHYSICS
PREPARE
DRAW
GAME, AI
PHYSICS
PREPARE
DRAW
DRAW
DATA
LOCK
GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
Conclusion
‣ Deferred rendering works well and gives us artistic
freedom to create distinctive Killzone look
‣ MSAA did not prove to be an issue
‣ Complex geometry with no resubmit
‣ Highly dynamic lighting in environments
‣ Extensive post-process
‣ Still a lot of features planned
‣ Ambient occlusion / contact shadows
‣ Shadows on transparent geometry
‣ More efficient anti-aliasing
‣ Dynamic radiosity
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2

More Related Content

Similar to Deferred Rendering in Killzone 2

Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2ozlael ozlael
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Guerrilla
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationGuerrilla
 
Foveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUsFoveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUsTakahiro Harada
 
Unity: Next Level Rendering Quality
Unity: Next Level Rendering QualityUnity: Next Level Rendering Quality
Unity: Next Level Rendering QualityUnity Technologies
 
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 FrostbiteElectronic Arts / DICE
 
Dissecting the Rendering of The Surge
Dissecting the Rendering of The SurgeDissecting the Rendering of The Surge
Dissecting the Rendering of The SurgePhilip Hammer
 
NVIDIA effects GDC09
NVIDIA effects GDC09NVIDIA effects GDC09
NVIDIA effects GDC09IGDA_London
 
MM-4099, Adapting game content to the viewing environment, by Noman Hashim
MM-4099, Adapting game content to the viewing environment, by Noman HashimMM-4099, Adapting game content to the viewing environment, by Noman Hashim
MM-4099, Adapting game content to the viewing environment, by Noman HashimAMD Developer Central
 
The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2Guerrilla
 
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...Unity Technologies
 
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
 
Deferred shading
Deferred shadingDeferred shading
Deferred shadingFrank Chao
 
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016Alex Vlachos
 
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptLighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptCharlesMatu2
 
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019Unity Technologies
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space MarinePope Kim
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applicationsstefan_b
 
Crysis 2-key-rendering-features
Crysis 2-key-rendering-featuresCrysis 2-key-rendering-features
Crysis 2-key-rendering-featuresRaimundo Renato
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3guest11b095
 

Similar to Deferred Rendering in Killzone 2 (20)

Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next Generation
 
Foveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUsFoveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUs
 
Unity: Next Level Rendering Quality
Unity: Next Level Rendering QualityUnity: Next Level Rendering Quality
Unity: Next Level Rendering Quality
 
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
 
Dissecting the Rendering of The Surge
Dissecting the Rendering of The SurgeDissecting the Rendering of The Surge
Dissecting the Rendering of The Surge
 
NVIDIA effects GDC09
NVIDIA effects GDC09NVIDIA effects GDC09
NVIDIA effects GDC09
 
MM-4099, Adapting game content to the viewing environment, by Noman Hashim
MM-4099, Adapting game content to the viewing environment, by Noman HashimMM-4099, Adapting game content to the viewing environment, by Noman Hashim
MM-4099, Adapting game content to the viewing environment, by Noman Hashim
 
The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2
 
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...
XR graphics in Unity: delivering the best AR/VR experiences – Unite Copenhage...
 
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)
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016
Alex_Vlachos_Advanced_VR_Rendering_Performance_GDC2016
 
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptLighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
 
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019
How the Universal Render Pipeline unlocks games for you - Unite Copenhagen 2019
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
 
Crysis 2-key-rendering-features
Crysis 2-key-rendering-featuresCrysis 2-key-rendering-features
Crysis 2-key-rendering-features
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
 

More from Slide_N

SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...
SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...
SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...Slide_N
 
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdfParallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdfSlide_N
 
Experiences with PlayStation VR - Sony Interactive Entertainment
Experiences with PlayStation VR  - Sony Interactive EntertainmentExperiences with PlayStation VR  - Sony Interactive Entertainment
Experiences with PlayStation VR - Sony Interactive EntertainmentSlide_N
 
SPU-based Deferred Shading for Battlefield 3 on Playstation 3
SPU-based Deferred Shading for Battlefield 3 on Playstation 3SPU-based Deferred Shading for Battlefield 3 on Playstation 3
SPU-based Deferred Shading for Battlefield 3 on Playstation 3Slide_N
 
Filtering Approaches for Real-Time Anti-Aliasing
Filtering Approaches for Real-Time Anti-AliasingFiltering Approaches for Real-Time Anti-Aliasing
Filtering Approaches for Real-Time Anti-AliasingSlide_N
 
Chip Multiprocessing and the Cell Broadband Engine.pdf
Chip Multiprocessing and the Cell Broadband Engine.pdfChip Multiprocessing and the Cell Broadband Engine.pdf
Chip Multiprocessing and the Cell Broadband Engine.pdfSlide_N
 
Cell Today and Tomorrow - IBM Systems and Technology Group
Cell Today and Tomorrow - IBM Systems and Technology GroupCell Today and Tomorrow - IBM Systems and Technology Group
Cell Today and Tomorrow - IBM Systems and Technology GroupSlide_N
 
New Millennium for Computer Entertainment - Kutaragi
New Millennium for Computer Entertainment - KutaragiNew Millennium for Computer Entertainment - Kutaragi
New Millennium for Computer Entertainment - KutaragiSlide_N
 
Sony Transformation 60 - Kutaragi
Sony Transformation 60 - KutaragiSony Transformation 60 - Kutaragi
Sony Transformation 60 - KutaragiSlide_N
 
Sony Transformation 60
Sony Transformation 60 Sony Transformation 60
Sony Transformation 60 Slide_N
 
Moving Innovative Game Technology from the Lab to the Living Room
Moving Innovative Game Technology from the Lab to the Living RoomMoving Innovative Game Technology from the Lab to the Living Room
Moving Innovative Game Technology from the Lab to the Living RoomSlide_N
 
Cell Technology for Graphics and Visualization
Cell Technology for Graphics and VisualizationCell Technology for Graphics and Visualization
Cell Technology for Graphics and VisualizationSlide_N
 
Industry Trends in Microprocessor Design
Industry Trends in Microprocessor DesignIndustry Trends in Microprocessor Design
Industry Trends in Microprocessor DesignSlide_N
 
Translating GPU Binaries to Tiered SIMD Architectures with Ocelot
Translating GPU Binaries to Tiered SIMD Architectures with OcelotTranslating GPU Binaries to Tiered SIMD Architectures with Ocelot
Translating GPU Binaries to Tiered SIMD Architectures with OcelotSlide_N
 
Cellular Neural Networks: Theory
Cellular Neural Networks: TheoryCellular Neural Networks: Theory
Cellular Neural Networks: TheorySlide_N
 
Network Processing on an SPE Core in Cell Broadband EngineTM
Network Processing on an SPE Core in Cell Broadband EngineTMNetwork Processing on an SPE Core in Cell Broadband EngineTM
Network Processing on an SPE Core in Cell Broadband EngineTMSlide_N
 
Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Slide_N
 
Developing Technology for Ratchet and Clank Future: Tools of Destruction
Developing Technology for Ratchet and Clank Future: Tools of DestructionDeveloping Technology for Ratchet and Clank Future: Tools of Destruction
Developing Technology for Ratchet and Clank Future: Tools of DestructionSlide_N
 
NVIDIA Tesla Accelerated Computing Platform for IBM Power
NVIDIA Tesla Accelerated Computing Platform for IBM PowerNVIDIA Tesla Accelerated Computing Platform for IBM Power
NVIDIA Tesla Accelerated Computing Platform for IBM PowerSlide_N
 
The Visual Computing Revolution Continues
The Visual Computing Revolution ContinuesThe Visual Computing Revolution Continues
The Visual Computing Revolution ContinuesSlide_N
 

More from Slide_N (20)

SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...
SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...
SpursEngine A High-performance Stream Processor Derived from Cell/B.E. for Me...
 
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdfParallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
 
Experiences with PlayStation VR - Sony Interactive Entertainment
Experiences with PlayStation VR  - Sony Interactive EntertainmentExperiences with PlayStation VR  - Sony Interactive Entertainment
Experiences with PlayStation VR - Sony Interactive Entertainment
 
SPU-based Deferred Shading for Battlefield 3 on Playstation 3
SPU-based Deferred Shading for Battlefield 3 on Playstation 3SPU-based Deferred Shading for Battlefield 3 on Playstation 3
SPU-based Deferred Shading for Battlefield 3 on Playstation 3
 
Filtering Approaches for Real-Time Anti-Aliasing
Filtering Approaches for Real-Time Anti-AliasingFiltering Approaches for Real-Time Anti-Aliasing
Filtering Approaches for Real-Time Anti-Aliasing
 
Chip Multiprocessing and the Cell Broadband Engine.pdf
Chip Multiprocessing and the Cell Broadband Engine.pdfChip Multiprocessing and the Cell Broadband Engine.pdf
Chip Multiprocessing and the Cell Broadband Engine.pdf
 
Cell Today and Tomorrow - IBM Systems and Technology Group
Cell Today and Tomorrow - IBM Systems and Technology GroupCell Today and Tomorrow - IBM Systems and Technology Group
Cell Today and Tomorrow - IBM Systems and Technology Group
 
New Millennium for Computer Entertainment - Kutaragi
New Millennium for Computer Entertainment - KutaragiNew Millennium for Computer Entertainment - Kutaragi
New Millennium for Computer Entertainment - Kutaragi
 
Sony Transformation 60 - Kutaragi
Sony Transformation 60 - KutaragiSony Transformation 60 - Kutaragi
Sony Transformation 60 - Kutaragi
 
Sony Transformation 60
Sony Transformation 60 Sony Transformation 60
Sony Transformation 60
 
Moving Innovative Game Technology from the Lab to the Living Room
Moving Innovative Game Technology from the Lab to the Living RoomMoving Innovative Game Technology from the Lab to the Living Room
Moving Innovative Game Technology from the Lab to the Living Room
 
Cell Technology for Graphics and Visualization
Cell Technology for Graphics and VisualizationCell Technology for Graphics and Visualization
Cell Technology for Graphics and Visualization
 
Industry Trends in Microprocessor Design
Industry Trends in Microprocessor DesignIndustry Trends in Microprocessor Design
Industry Trends in Microprocessor Design
 
Translating GPU Binaries to Tiered SIMD Architectures with Ocelot
Translating GPU Binaries to Tiered SIMD Architectures with OcelotTranslating GPU Binaries to Tiered SIMD Architectures with Ocelot
Translating GPU Binaries to Tiered SIMD Architectures with Ocelot
 
Cellular Neural Networks: Theory
Cellular Neural Networks: TheoryCellular Neural Networks: Theory
Cellular Neural Networks: Theory
 
Network Processing on an SPE Core in Cell Broadband EngineTM
Network Processing on an SPE Core in Cell Broadband EngineTMNetwork Processing on an SPE Core in Cell Broadband EngineTM
Network Processing on an SPE Core in Cell Broadband EngineTM
 
Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3
 
Developing Technology for Ratchet and Clank Future: Tools of Destruction
Developing Technology for Ratchet and Clank Future: Tools of DestructionDeveloping Technology for Ratchet and Clank Future: Tools of Destruction
Developing Technology for Ratchet and Clank Future: Tools of Destruction
 
NVIDIA Tesla Accelerated Computing Platform for IBM Power
NVIDIA Tesla Accelerated Computing Platform for IBM PowerNVIDIA Tesla Accelerated Computing Platform for IBM Power
NVIDIA Tesla Accelerated Computing Platform for IBM Power
 
The Visual Computing Revolution Continues
The Visual Computing Revolution ContinuesThe Visual Computing Revolution Continues
The Visual Computing Revolution Continues
 

Recently uploaded

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Deferred Rendering in Killzone 2

  • 1. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON
  • 2. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Deferred Rendering in Killzone 2 Michal Valient Senior Programmer, Guerrilla
  • 3. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Talk Outline ‣ Forward & Deferred Rendering Overview ‣ G-Buffer Layout ‣ Shader Creation ‣ Deferred Rendering in Detail ‣ Rendering Passes ‣ Light and Shadows ‣ Post-Processing ‣ SPU Usage / Architecture
  • 4. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Forward & Deferred Rendering Overview
  • 5. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Forward Rendering – Single Pass ‣ For each object ‣ Find all lights affecting object ‣ Render all lighting and material in a single shader ‣ Shader combinations explosion ‣ Shader for each material vs. light setup combination ‣ All shadow maps have to be in memory ‣ Wasted shader cycles ‣ Invisible surfaces / overdraw ‣ Triangles outside light influence
  • 6. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Forward Rendering – Multi-Pass ‣ For each light ‣ For each object ‣ Add lighting from single light to frame buffer ‣ Shader for each material and light type ‣ Wasted shader cycles ‣ Invisible surfaces / overdraw ‣ Triangles outside light influence ‣ Lots of repeated work ‣ Full vertex shaders, texture filtering
  • 7. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Deferred Rendering ‣ For each object ‣ Render surface properties into the G-Buffer ‣ For each light and lit pixel ‣ Use G-Buffer to compute lighting ‣ Add result to frame buffer ‣ Simpler shaders ‣ Scales well with number of lit pixels ‣ Does not handle transparent objects
  • 8. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON G-Buffer Layout
  • 10. Depth
  • 17. Image with post-processing (depth of field, bloom, motion blur, colorize, ILR)
  • 18. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Stencil Lighting Accumulation RGB Intensity Normal X (FP16) Normal Y (FP16) Motion Vectors XY Spec-Power Spec-Intensity Diffuse Albedo RGB Sun-Occlusion DS RT0 RT1 RT2 RT3 ‣ MRT - 4xRGBA8 + 24D8S (approx 36 MB) ‣ 720p with Quincunx MSAA ‣ Position computed from depth buffer and pixel coordinates
  • 19. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON ‣ Lighting accumulation – output buffer ‣ Intensity – luminance of Lighting accumulation ‣ Scaled to range [0…2] ‣ Normal.z = sqrt(1.0f - Normal.x2 - Normal.y2) G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Stencil Lighting Accumulation RGB Intensity Normal X (FP16) Normal Y (FP16) Motion Vectors XY Spec-Power Spec-Intensity Diffuse Albedo RGB Sun-Occlusion DS RT0 RT1 RT2 RT3
  • 20. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON ‣ Motion vectors – screen space ‣ Specular power - stored as log2(original)/10.5 ‣ High range and still high precision for low shininess ‣ Sun Occlusion - pre-rendered static sun shadows ‣ Mixed with real-time sun shadow for higher quality G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Stencil Lighting Accumulation RGB Intensity Normal X (FP16) Normal Y (FP16) Motion Vectors XY Spec-Power Spec-Intensity Diffuse Albedo RGB Sun-Occlusion DS RT0 RT1 RT2 RT3
  • 21. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON G-Buffer Analysis ‣ Pros: ‣ Highly packed data structure ‣ Many extra attributes ‣ Allows MSAA with hardware support ‣ Cons: ‣ Limited output precision and dynamic range ‣ Lighting accumulation in gamma space ‣ Can use different color space (LogLuv) ‣ Attribute packing and unpacking overhead
  • 22. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Deferred Rendering Passes
  • 23. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Geometry Pass ‣ Fill the G-Buffer with all geometry (static, skinned, etc.) ‣ Write depth, motion, specular, etc. properties ‣ Initialize light accumulation buffer with pre-baked light ‣ Ambient, Incandescence, Constant specular ‣ Lightmaps on static geometry ‣ YUV color space, S3TC5 with Y in Alpha ‣ Sun occlusion in B channel ‣ Dynamic range [0..2] ‣ Image based lighting on dynamic geometry
  • 24. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Image Based Lighting ‣ Artist placed light probes ‣ Arbitrary location and density ‣ Sampled and stored as 2nd order spherical harmonics ‣ Updated per frame for each object ‣ Blend four closest SHs based on distance ‣ Rotate into view space ‣ Encode into 8x8 envmap IBL texture ‣ Dynamic range [0..2] ‣ Generated on SPUs in parallel to other rendering tasks
  • 26. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Decals and Weapon Passes ‣ Primitives updating subset of the G-Buffer ‣ Bullet holes, posters, cracks, stains ‣ Reuse lighting of underlying surface ‣ Blend with albedo buffer ‣ Use G-Buffer Intensity channel to fix accumulation ‣ Same principle as particles with motion blur ‣ Separate weapon pass with different projection ‣ Different near plane ‣ Rendered into first 5% of depth buffer range ‣ Still reacts to lights and post-processing
  • 27.
  • 28.
  • 29. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Light Accumulation Pass ‣ Light is rendered as convex geometry ‣ Point light – sphere ‣ Spot light – cone ‣ Sun – full-screen quad ‣ For each light… ‣ Find and mark visible lit pixels ‣ If light contributes to screen ‣ Render shadow map ‣ Shade lit pixels and add to framebuffer
  • 30. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Determine Lit Pixels ‣ Marks pixels in front of the far light boundary ‣ Render back-faces of light volume ‣ Depth test GREATER-EQUAL ‣ Write to stencil on depth pass ‣ Skipped for very small distant lights
  • 31. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Determine Lit Pixels ‣ Find amount of lit pixels inside the volume ‣ Start pixel query ‣ Render front faces of light volume ‣ Depth test LESS-EQUAL ‣ Don’t write anything – only EQUAL stencil test
  • 32. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Render Shadow Map ‣ Enable conditional rendering ‣ Based on query results from previous stage ‣ GPU skips rendering for invisible lights ‣ Max 1024x1024xD16 shadow map ‣ Fast and with hardware filtering support ‣ Single map reused for all lights ‣ Skip small objects ‣ Small in shadow map and on screen ‣ Artist defined thresholds for lights and objects
  • 33. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Shade Lit Pixels ‣ Render front-faces of light volume ‣ Depth test - LESS-EQUAL ‣ Stencil test - EQUAL ‣ Runs only on marked pixels inside light ‣ Compute light equation ‣ Read and unpack G-Buffer attributes ‣ Calculate Light vector, Color, Distance Attenuation ‣ Perform shadow map filtering ‣ Add Phong lighting to frame buffer
  • 34. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Light Optimization ‣ Determine light size on the screen ‣ Approximation - angular size of light volume ‣ If light is “very small” ‣ Don’t do any stencil marking ‣ Switch to non-shadow casting type ‣ Shadows fade-out range ‣ Artist defined light sizes at which: ‣ Shadows start to fade out ‣ Switch to non-shadow casting light
  • 35. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Sun Rendering ‣ Full screen quad ‣ Stencil mark potentially lit pixels ‣ Use only sun occlusion from G-Buffer ‣ Run final shader on marked pixels ‣ Approx. 50% of pixels skipped thanks 1st pass ‣ Also skybox/background ‣ Simple directional light model ‣ Shadow = min(RealTimeShadow, Occlusion)
  • 36. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Sun – Real-Time Shadows ‣ Cascade shadow maps ‣ Provide more shadow detail where required ‣ Divide view frustum into several areas ‣ Split along view distance ‣ Split distances defined by artist ‣ Render shadow map for each area ‣ Max 4 cascades ‣ Max 512x512 pixels each in single texture ‣ Easy to address cascade in final render
  • 37. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Sun – Real-Time Shadows ‣ Issue: Shadow shimmering ‣ Light cascade frustums follow camera ‣ Sub pixel changes in shadow map ‣ Solution! ‣ Don’t rotate shadow map cascade ‣ Make bounding sphere of cascade frustum ‣ Use it to generate cascade light matrix ‣ Remove sub-pixel movements ‣ Project world origin onto shadow map ‣ Use it to round light matrix to nearest shadow pixel corner
  • 38. Sun - Colored shadow Cascades - Unstable shadow artifacts
  • 39. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON MSAA Lighting Details ‣ Run light shader at pixel resolution ‣ Read G-Buffer for both pixel samples ‣ Compute lighting for both samples ‣ Average results and add to frame buffer ‣ Optimization in shadow map filtering ‣ Max 12 shadow taps per pixel ‣ Alternate taps between both samples ‣ Half quality on edges, full quality elsewhere ‣ Performance equal to non-MSAA case
  • 40. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Forward Rendering Pass ‣ Used for transparent geometry ‣ Single pass solution ‣ Shader has four uberlights ‣ No shadows ‣ Per-vertex lighting version for particles ‣ Lower resolution rendering available ‣ Fill-rate intensive effects ‣ Half and quarter screen size rendering ‣ Half resolution rendering using MSAA HW
  • 41. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Post-Processing Pass ‣ Highly customizable color correction ‣ Separate curves for shadows, mid-tones, highlight colors, contrast and brightness ‣ Everything Depth dependent ‣ Per-frame LUT textures generated on SPU ‣ Image based motion blur and depth of field ‣ Internal lens reflection ‣ Film grain filter
  • 42. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON SPU Usage and Architecture Putting it all together
  • 43. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON SPU Usage ‣ We use SPU a lot during rendering ‣ Display list generation ‣ Main display list ‣ Lights and Shadow Maps ‣ Forward rendering ‣ Scene graph traversal / visibility culling ‣ Skinning ‣ Triangle trimming ‣ IBL generation ‣ Particles
  • 44. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON SPU Usage (cont.) ‣ Everything is data driven ‣ No “virtual void Draw()” calls on objects ‣ Objects store a decision-tree with DrawParts ‣ DrawParts link shader, geometry and flags ‣ Decision tree used for LODs, etc. ‣ SPUs pull rendering data directly from objects ‣ Traverse scenegraph to find objects ‣ Process object's decision-tree to find DrawParts ‣ Create displaylist from DrawParts
  • 45. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture
  • 46. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS
  • 47. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW
  • 48. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW
  • 49. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW
  • 50. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW
  • 51. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW
  • 52. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generationParticles, Skinning edgeGeom PPU SPU 0 SPU 1 SPU 2 SPU 3 SPU Architecture GAME, AI PHYSICS PREPARE DRAW GAME, AI PHYSICS PREPARE DRAW DRAW DATA LOCK
  • 53. GUERRILLA | DEVELOP CONFERENCE | JULY ‘07 | BRIGHTON Conclusion ‣ Deferred rendering works well and gives us artistic freedom to create distinctive Killzone look ‣ MSAA did not prove to be an issue ‣ Complex geometry with no resubmit ‣ Highly dynamic lighting in environments ‣ Extensive post-process ‣ Still a lot of features planned ‣ Ambient occlusion / contact shadows ‣ Shadows on transparent geometry ‣ More efficient anti-aliasing ‣ Dynamic radiosity