SlideShare a Scribd company logo
1 of 58
The Rendering Technology of Killzone 2 Michal Valient Guerrilla BV
How we made Killzone 2 run 30fps Deferred shading A diet for render targets Dirty lighting tricks Rendering, memory and SPUs Q&A
Geometry pass โ€“ fill the G-Buffer What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
Lighting pass โ€“ accumulate light info What is deferred shading?
G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB RGBA FP16 buffers proved to be too much Moved to RGBA8 4xRGBA8 + D24S8 - 18.4mb 2xMSAA (Quincunx) - 36.8mb Memory reused by later rendering stages Low resolution pass, post processing, HUD
G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB View space position computed from depth buffer Normal.z = sqrt(1-Normal.x2-Normal.y2) No negative z, but does not cause problems 2xFP16 compressed to RGBA8 on write Cg: unpack_4ubyte(pack_2half(Normal.xy)) Motion vectors โ€“ screen space
G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB Albedo - material diffuse color Roughness โ€“ Specular exponent in log range Specular intensity โ€“ single channel only Sun shadow โ€“ pre-rendered sun shadows Mixed with real-time sun shadows
G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB Lighting accumulation buffer (LAB) Geometry pass fills-in indirect lighting terms Stored in lightmaps and IBLs Also adds ambient color, scene reflectionsโ€ฆ Lighting pass adds contribution of each light Glow โ€“ contains HDR luminance of LAB Used to reconstruct HDR RGB for bloom
Light accumulation buffer After geometry pass - no real-time lights
Light accumulation buffer After lighting pass - with real-time lights
Lighting pass The most expensive pass 100+ dynamic lights per frame 10+ shadow casting lights per frame Anti-aliasing means more of everything Optimization strategies Avoid hard work where possible Work less for MSAA Precompute sun shadow offline Approximate
Avoid hard work where possible Donโ€™t run shaders Use your early z/stencil cull unit Depth bounds test is the new cool Enable conditional rendering Optimized light shaders For each combination of light features Fade-out shadows for small lights Remove small objects from shadow map
Lighting pass and MSAA MSAA facts Each sample has to be lit Samples of non-edge pixel are equal KZ2 solution โ€“ in-shader supersampling Run at 1280x720 not 2560x720 Light two samples in one go Where is the gain? Shadow filtering can be much cheaper
Shadow map filtering distribution Motivation Define filtering quality per pixel rather than per sample. Split filter coordinates into disjoint sets One set per pixel sample MSAA is almost as fast as non-MSAA
Sunlight Fullscreen directional light We divide screen into depth slices Each depth slice is lit separately Different shadow properties Use depth bounds test Use โ€˜Sun shadowโ€™ from G-Buffer Stencil-mark pixels completely in shadow Skip expensive sunlight shader! Also mixed with real-time shadows
Sunlight rendering - example Final scene - Corinth River level
Sun Shadow channel Sunlight rendering - example
Red โ€“ skipped pixels Sunlight rendering - example
Depth slice 3 - background, no shadow Sunlight rendering - example
Depth slice 2 Sunlight rendering - example
Depth slice 1 Sunlight rendering - example
Depth slice 0 Sunlight rendering - example
Only real-time shadows Sunlight rendering - example
Sun shadow channel - free ambient occlusion! Sunlight rendering - example
Sunlight rendering โ€“ Fake MSAA Used only in the distance We cut down on lighting cost By doing shadows properly, but... running lighting equation on closest sample only! But isnโ€™t it wrong? Itโ€™s a hack. We hope you donโ€™t notice it. Works correctly against background The edges are still partially anti-aliased Distant scenery is heavily post-processed
Sunlight โ€“ shadow map rendering We generate shadow map for each depth slice Common approach Align shadow maps to view direction Pros - Maximize shadow map usage
Sunlight โ€“ shadow map rendering Shadow map changes each frame... ...when viewer moves or rotates Smooth movement causes sub-pixel changes in shadow map Result โ€“ shadow shimmering
Sunlight โ€“ shadow map rendering ,[object Object],[object Object]
Sunlight โ€“ shadow map rendering ,[object Object],[object Object]
Push buffer (PB) building Multiple SPUs building PB in parallel Additional SPUs generating data Skinning, particles โ€“ vertex buffers IBL interpolation - textures Common solutions for memory allocation Ring buffering Issues with out-of-order allocations Double buffering Too much memory
KZ2 render memory allocator Fixed memory pool 22mb block - split into 256k blocks Each block has associated AllocationID Specified by client during allocation Only whole block can be allocated Fine grained allocation stack on top of this Global FreeID identifies free blocks Updated as RSX consumes โ€˜Freeโ€™ marker If (AllocationID<=FreeID) -> Free block
KZ2 render memory allocator Weโ€™ve got strengths of ring-buffering With none of the weaknesses Lockless, out-of-order, memory allocation From PPU and/or SPU Simple table walk (fast!) Allows immediate memory reuse We generate push-buffer just-in-time for RSX Block can be reused right after RSX consumption Can allocate memory for skinning early... ... and still free at correct point in frame
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Push buffer generation - example
Conclusion My advice - keep it simple I hope you learned something useful for your next game. Thank you!
Questions? ?
The Rendering Technology of Killzone 2
The Rendering Technology of Killzone 2

More Related Content

What's hot

Deferred shading
Deferred shadingDeferred shading
Deferred shading
Frank Chao
ย 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
guest11b095
ย 
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
ย 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Johan Andersson
ย 

What's hot (20)

The Unique Lighting of Mirror's Edge
The Unique Lighting of Mirror's EdgeThe Unique Lighting of Mirror's Edge
The Unique Lighting of Mirror's Edge
ย 
Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3
ย 
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
ย 
Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3
ย 
Stochastic Screen-Space Reflections
Stochastic Screen-Space ReflectionsStochastic Screen-Space Reflections
Stochastic Screen-Space Reflections
ย 
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
ย 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
ย 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
ย 
Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in FrostbitePhysically Based Sky, Atmosphere and Cloud Rendering in Frostbite
Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
ย 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
ย 
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
ย 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)
ย 
Frostbite on Mobile
Frostbite on MobileFrostbite on Mobile
Frostbite on Mobile
ย 
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
ย 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
ย 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
ย 
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal FilteringStable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
ย 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
ย 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
ย 
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time RenderingDD18 - SEED - Raytracing in Hybrid Real-Time Rendering
DD18 - SEED - Raytracing in Hybrid Real-Time Rendering
ย 

Similar to The Rendering Technology of Killzone 2

Practical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT MethodsPractical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT Methods
Naughty Dog
ย 
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
stefan_b
ย 
A Bizarre Way to do Real-Time Lighting
A Bizarre Way to do Real-Time LightingA Bizarre Way to do Real-Time Lighting
A Bizarre Way to do Real-Time Lighting
Steven Tovey
ย 

Similar to The Rendering Technology of Killzone 2 (20)

Paris Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAAParis Master Class 2011 - 01 Deferred Lighting, MSAA
Paris Master Class 2011 - 01 Deferred Lighting, MSAA
ย 
Practical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT MethodsPractical Spherical Harmonics Based PRT Methods
Practical Spherical Harmonics Based PRT Methods
ย 
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
ย 
Develop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiakDevelop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiak
ย 
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)
ย 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
ย 
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
ย 
Killzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemKillzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo Postmortem
ย 
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
ย 
Reyes
ReyesReyes
Reyes
ย 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
ย 
Advanced Lighting for Interactive Applications
Advanced Lighting for Interactive ApplicationsAdvanced Lighting for Interactive Applications
Advanced Lighting for Interactive Applications
ย 
Deferred rendering in_leadwerks_engine[1]
Deferred rendering in_leadwerks_engine[1]Deferred rendering in_leadwerks_engine[1]
Deferred rendering in_leadwerks_engine[1]
ย 
Hill Stephen Rendering Tools Splinter Cell Conviction
Hill Stephen Rendering Tools Splinter Cell ConvictionHill Stephen Rendering Tools Splinter Cell Conviction
Hill Stephen Rendering Tools Splinter Cell Conviction
ย 
Rendering basics
Rendering basicsRendering basics
Rendering basics
ย 
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
ย 
Crysis 2-key-rendering-features
Crysis 2-key-rendering-featuresCrysis 2-key-rendering-features
Crysis 2-key-rendering-features
ย 
A Bizarre Way to do Real-Time Lighting
A Bizarre Way to do Real-Time LightingA Bizarre Way to do Real-Time Lighting
A Bizarre Way to do Real-Time Lighting
ย 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
ย 
Real-time lightmap baking
Real-time lightmap bakingReal-time lightmap baking
Real-time lightmap baking
ย 

More from Guerrilla

More from Guerrilla (20)

Horizon Zero Dawn: An Open World QA Case Study
Horizon Zero Dawn: An Open World QA Case StudyHorizon Zero Dawn: An Open World QA Case Study
Horizon Zero Dawn: An Open World QA Case Study
ย 
Horizon Zero Dawn: A Game Design Post-Mortem
Horizon Zero Dawn: A Game Design Post-MortemHorizon Zero Dawn: A Game Design Post-Mortem
Horizon Zero Dawn: A Game Design Post-Mortem
ย 
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero DawnPutting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
ย 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero Dawn
ย 
Building Non-Linear Narratives in Horizon Zero Dawn
Building Non-Linear Narratives in Horizon Zero DawnBuilding Non-Linear Narratives in Horizon Zero Dawn
Building Non-Linear Narratives in Horizon Zero Dawn
ย 
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnPlayer Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
ย 
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero DawnThe Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
ย 
The Production and Visual FX of Killzone Shadow Fall
The Production and Visual FX of Killzone Shadow FallThe Production and Visual FX of Killzone Shadow Fall
The Production and Visual FX of Killzone Shadow Fall
ย 
Out of Sight, Out of Mind: Improving Visualization of AI Info
Out of Sight, Out of Mind: Improving Visualization of AI InfoOut of Sight, Out of Mind: Improving Visualization of AI Info
Out of Sight, Out of Mind: Improving Visualization of AI Info
ย 
The Next-Gen Dynamic Sound System of Killzone Shadow Fall
The Next-Gen Dynamic Sound System of Killzone Shadow FallThe Next-Gen Dynamic Sound System of Killzone Shadow Fall
The Next-Gen Dynamic Sound System of Killzone Shadow Fall
ย 
Killzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of GamesKillzone Shadow Fall: Creating Art Tools For A New Generation Of Games
Killzone Shadow Fall: Creating Art Tools For A New Generation Of Games
ย 
Lighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow FallLighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow Fall
ย 
A Hierarchically-Layered Multiplayer Bot System for a First-Person Shooter
A Hierarchically-Layered Multiplayer Bot System for a First-Person ShooterA Hierarchically-Layered Multiplayer Bot System for a First-Person Shooter
A Hierarchically-Layered Multiplayer Bot System for a First-Person Shooter
ย 
Practical Occlusion Culling on PS3
Practical Occlusion Culling on PS3Practical Occlusion Culling on PS3
Practical Occlusion Culling on PS3
ย 
Release This! Tools for a Smooth Release Cycle
Release This! Tools for a Smooth Release CycleRelease This! Tools for a Smooth Release Cycle
Release This! Tools for a Smooth Release Cycle
ย 
Killzone 2 Multiplayer Bots
Killzone 2 Multiplayer BotsKillzone 2 Multiplayer Bots
Killzone 2 Multiplayer Bots
ย 
Automatic Annotations in Killzone 3 and Beyond
Automatic Annotations in Killzone 3 and BeyondAutomatic Annotations in Killzone 3 and Beyond
Automatic Annotations in Killzone 3 and Beyond
ย 
The Creation of Killzone 3
The Creation of Killzone 3The Creation of Killzone 3
The Creation of Killzone 3
ย 
The PlayStationยฎ3โ€™s SPUs in the Real World: A KILLZONE 2 Case Study
The PlayStationยฎ3โ€™s SPUs in the Real World: A KILLZONE 2 Case StudyThe PlayStationยฎ3โ€™s SPUs in the Real World: A KILLZONE 2 Case Study
The PlayStationยฎ3โ€™s SPUs in the Real World: A KILLZONE 2 Case Study
ย 
Killzone's AI: Dynamic Procedural Tactics
Killzone's AI: Dynamic Procedural TacticsKillzone's AI: Dynamic Procedural Tactics
Killzone's AI: Dynamic Procedural Tactics
ย 

Recently uploaded

Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034 Independent Chennai ...
Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034  Independent Chennai ...Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034  Independent Chennai ...
Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034 Independent Chennai ...
Shivani Pandey
ย 
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
Shivani Pandey
ย 
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
rahim quresi
ย 
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
hotbabesbook
ย 
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034 Independe...
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034  Independe...Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034  Independe...
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034 Independe...
Shivani Pandey
ย 
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Shivani Pandey
ย 
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
amitlee9823
ย 
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
SUHANI PANDEY
ย 
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
rahim quresi
ย 
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
rajveermohali2022
ย 
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Shivani Pandey
ย 
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
rahim quresi
ย 
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
SUHANI PANDEY
ย 

Recently uploaded (20)

๐Ÿ“ž Contact Number 8617697112 VIP East Sikkim Call Girls
๐Ÿ“ž Contact Number 8617697112 VIP East Sikkim Call Girls๐Ÿ“ž Contact Number 8617697112 VIP East Sikkim Call Girls
๐Ÿ“ž Contact Number 8617697112 VIP East Sikkim Call Girls
ย 
Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034 Independent Chennai ...
Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034  Independent Chennai ...Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034  Independent Chennai ...
Verified Trusted Call Girls Egmore Chennai โœ”โœ”7427069034 Independent Chennai ...
ย 
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
Low Rate Call Girls Dhakuria (8005736733) 100% GENUINE ESCORT SERVICE & HOTEL...
ย 
Bhimtal โคCALL GIRL 8617697112 โคCALL GIRLS IN Bhimtal ESCORT SERVICEโคCALL GIRL
Bhimtal โคCALL GIRL 8617697112 โคCALL GIRLS IN Bhimtal ESCORT SERVICEโคCALL GIRLBhimtal โคCALL GIRL 8617697112 โคCALL GIRLS IN Bhimtal ESCORT SERVICEโคCALL GIRL
Bhimtal โคCALL GIRL 8617697112 โคCALL GIRLS IN Bhimtal ESCORT SERVICEโคCALL GIRL
ย 
Navi Mumbai Call Girls -๐Ÿ“ž9833754194-Call Girls Number Vashi-Nerul Call Girls ...
Navi Mumbai Call Girls -๐Ÿ“ž9833754194-Call Girls Number Vashi-Nerul Call Girls ...Navi Mumbai Call Girls -๐Ÿ“ž9833754194-Call Girls Number Vashi-Nerul Call Girls ...
Navi Mumbai Call Girls -๐Ÿ“ž9833754194-Call Girls Number Vashi-Nerul Call Girls ...
ย 
Hire ๐Ÿ’• 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire ๐Ÿ’• 8617697112 North Sikkim Call Girls Service Call Girls AgencyHire ๐Ÿ’• 8617697112 North Sikkim Call Girls Service Call Girls Agency
Hire ๐Ÿ’• 8617697112 North Sikkim Call Girls Service Call Girls Agency
ย 
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
Sonagachi ( Call Girls ) Kolkata โœ” 6297143586 โœ” Hot Model With Sexy Bhabi Rea...
ย 
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
Model VVIP Call Girls In Porur ๐Ÿ‘‰ Chennai ๐Ÿฌ 7427069034 Escort Service & Hotel ...
ย 
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034 Independe...
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034  Independe...Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034  Independe...
Verified Trusted Call Girls Singaperumal Koil Chennai โœ”โœ”7427069034 Independe...
ย 
Kolkata Call Girls Service โค๏ธ at @30% discount Everyday
Kolkata Call Girls Service โค๏ธ at @30% discount EverydayKolkata Call Girls Service โค๏ธ at @30% discount Everyday
Kolkata Call Girls Service โค๏ธ at @30% discount Everyday
ย 
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
Model Call Girls In Ariyalur WhatsApp Booking 7427069034 call girl service 24...
ย 
โคPersonal Whatsapp Number Mukteshwar Call Girls 8617697112 ๐Ÿ’ฆโœ….
โคPersonal Whatsapp Number Mukteshwar Call Girls 8617697112 ๐Ÿ’ฆโœ….โคPersonal Whatsapp Number Mukteshwar Call Girls 8617697112 ๐Ÿ’ฆโœ….
โคPersonal Whatsapp Number Mukteshwar Call Girls 8617697112 ๐Ÿ’ฆโœ….
ย 
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
Call Girls Bellandur โ˜Ž 7737669865โ˜Ž Book Your One night Stand (Bangalore)
ย 
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
ย 
Ranikhet call girls ๐Ÿ“ž 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls ๐Ÿ“ž 8617697112 At Low Cost Cash Payment BookingRanikhet call girls ๐Ÿ“ž 8617697112 At Low Cost Cash Payment Booking
Ranikhet call girls ๐Ÿ“ž 8617697112 At Low Cost Cash Payment Booking
ย 
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
๐“€คCall On 6297143586 ๐“€ค Park Street Call Girls In All Kolkata 24/7 Provide Call...
ย 
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
Zirakpur Call Girls๐Ÿ‘ง Book Now๐Ÿ“ฑ8146719683 ๐Ÿ“ž๐Ÿ‘‰Mohali Call Girl Service No Advanc...
ย 
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
ย 
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
๐“€คCall On 6297143586 ๐“€ค Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
ย 
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
VIP Model Call Girls Vijayawada ( Pune ) Call ON 8005736733 Starting From 5K ...
ย 

The Rendering Technology of Killzone 2

  • 1.
  • 2. The Rendering Technology of Killzone 2 Michal Valient Guerrilla BV
  • 3. How we made Killzone 2 run 30fps Deferred shading A diet for render targets Dirty lighting tricks Rendering, memory and SPUs Q&A
  • 4. Geometry pass โ€“ fill the G-Buffer What is deferred shading?
  • 5. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 6. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 7. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 8. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 9. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 10. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 11. Lighting pass โ€“ accumulate light info What is deferred shading?
  • 12. G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB RGBA FP16 buffers proved to be too much Moved to RGBA8 4xRGBA8 + D24S8 - 18.4mb 2xMSAA (Quincunx) - 36.8mb Memory reused by later rendering stages Low resolution pass, post processing, HUD
  • 13. G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB View space position computed from depth buffer Normal.z = sqrt(1-Normal.x2-Normal.y2) No negative z, but does not cause problems 2xFP16 compressed to RGBA8 on write Cg: unpack_4ubyte(pack_2half(Normal.xy)) Motion vectors โ€“ screen space
  • 14. G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB Albedo - material diffuse color Roughness โ€“ Specular exponent in log range Specular intensity โ€“ single channel only Sun shadow โ€“ pre-rendered sun shadows Mixed with real-time sun shadows
  • 15. G-Buffer Lighting accumulation RGB View space normals XY (RG FP16) Motion vectors XY Roughness, spec. intensity Albedo RGB Lighting accumulation buffer (LAB) Geometry pass fills-in indirect lighting terms Stored in lightmaps and IBLs Also adds ambient color, scene reflectionsโ€ฆ Lighting pass adds contribution of each light Glow โ€“ contains HDR luminance of LAB Used to reconstruct HDR RGB for bloom
  • 16. Light accumulation buffer After geometry pass - no real-time lights
  • 17. Light accumulation buffer After lighting pass - with real-time lights
  • 18. Lighting pass The most expensive pass 100+ dynamic lights per frame 10+ shadow casting lights per frame Anti-aliasing means more of everything Optimization strategies Avoid hard work where possible Work less for MSAA Precompute sun shadow offline Approximate
  • 19. Avoid hard work where possible Donโ€™t run shaders Use your early z/stencil cull unit Depth bounds test is the new cool Enable conditional rendering Optimized light shaders For each combination of light features Fade-out shadows for small lights Remove small objects from shadow map
  • 20. Lighting pass and MSAA MSAA facts Each sample has to be lit Samples of non-edge pixel are equal KZ2 solution โ€“ in-shader supersampling Run at 1280x720 not 2560x720 Light two samples in one go Where is the gain? Shadow filtering can be much cheaper
  • 21. Shadow map filtering distribution Motivation Define filtering quality per pixel rather than per sample. Split filter coordinates into disjoint sets One set per pixel sample MSAA is almost as fast as non-MSAA
  • 22. Sunlight Fullscreen directional light We divide screen into depth slices Each depth slice is lit separately Different shadow properties Use depth bounds test Use โ€˜Sun shadowโ€™ from G-Buffer Stencil-mark pixels completely in shadow Skip expensive sunlight shader! Also mixed with real-time shadows
  • 23. Sunlight rendering - example Final scene - Corinth River level
  • 24. Sun Shadow channel Sunlight rendering - example
  • 25. Red โ€“ skipped pixels Sunlight rendering - example
  • 26. Depth slice 3 - background, no shadow Sunlight rendering - example
  • 27. Depth slice 2 Sunlight rendering - example
  • 28. Depth slice 1 Sunlight rendering - example
  • 29. Depth slice 0 Sunlight rendering - example
  • 30. Only real-time shadows Sunlight rendering - example
  • 31. Sun shadow channel - free ambient occlusion! Sunlight rendering - example
  • 32. Sunlight rendering โ€“ Fake MSAA Used only in the distance We cut down on lighting cost By doing shadows properly, but... running lighting equation on closest sample only! But isnโ€™t it wrong? Itโ€™s a hack. We hope you donโ€™t notice it. Works correctly against background The edges are still partially anti-aliased Distant scenery is heavily post-processed
  • 33. Sunlight โ€“ shadow map rendering We generate shadow map for each depth slice Common approach Align shadow maps to view direction Pros - Maximize shadow map usage
  • 34. Sunlight โ€“ shadow map rendering Shadow map changes each frame... ...when viewer moves or rotates Smooth movement causes sub-pixel changes in shadow map Result โ€“ shadow shimmering
  • 35.
  • 36.
  • 37. Push buffer (PB) building Multiple SPUs building PB in parallel Additional SPUs generating data Skinning, particles โ€“ vertex buffers IBL interpolation - textures Common solutions for memory allocation Ring buffering Issues with out-of-order allocations Double buffering Too much memory
  • 38. KZ2 render memory allocator Fixed memory pool 22mb block - split into 256k blocks Each block has associated AllocationID Specified by client during allocation Only whole block can be allocated Fine grained allocation stack on top of this Global FreeID identifies free blocks Updated as RSX consumes โ€˜Freeโ€™ marker If (AllocationID<=FreeID) -> Free block
  • 39. KZ2 render memory allocator Weโ€™ve got strengths of ring-buffering With none of the weaknesses Lockless, out-of-order, memory allocation From PPU and/or SPU Simple table walk (fast!) Allows immediate memory reuse We generate push-buffer just-in-time for RSX Block can be reused right after RSX consumption Can allocate memory for skinning early... ... and still free at correct point in frame
  • 55. Conclusion My advice - keep it simple I hope you learned something useful for your next game. Thank you!