SlideShare a Scribd company logo
1 of 57
Download to read offline
Deferred Rendering
in Dying Light
Agenda
Deferred shading - why?
G-Buffer
Questions?
Deferred shading - why?
Deferred shading - why?
>250K objects
Deferred shading - why?
>250K objects
Multiple materials
Deferred shading - why?
>250K objects
Multiple materials
Thousands of lights
Deferred shading - why?
>250K objects
Multiple materials
Thousands of lights
Day-night cycle
Deferred shading - why?
>250K objects
Multiple materials
Thousands of lights
Day-night cycle
Changing weather
Deferred shading - why?
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
SCENE
Deferred shading - why?
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
○ G-Buffer
SCENE
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
○ G-Buffer
● Improved lighting rendering performance
○ Scene complexity independency
Deferred shading - why?
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
○ G-Buffer
● Improved lighting rendering performance
○ Scene complexity independency
○ Object material & geometry complexity independency
Deferred shading - why?
Deferred shading - why?
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
○ G-Buffer
● Improved lighting rendering performance
○ Scene complexity independency
○ Object material & geometry complexity independency
● Simpler rendering pipeline
○ Easy light handling
Deferred shading - why?
Deferred Shading vs Forward Rendering
● Separated scene and lighting rendering
○ G-Buffer
● Improved lighting rendering performance
○ Scene complexity independency
○ Object material & geometry complexity independency
● Simpler rendering pipeline
○ Easy light handling
○ No material-light litght shader combinations
Deferred shading - why?
Not only lights
● Complex materials
● Scene overdraw
● Consistency
● Lighting model independency
● Deferred Linear Space
Deferred shading - why?
Not only lights
● Complex materials
● Scene overdraw
● Consistency
● Lighting model independency
● Deferred Linear Space
Deferred shading - why?
Not only lights
● Complex materials
● Scene overdraw
● Consistency
● Lighting model independency
● Deferred Linear Space
Deferred shading - why?
Not only lights
● Complex materials
● Scene overdraw
● Consistency
● Lighting model independency
● Deferred Linear Space
Deferred shading - why?
Not only lights
● Complex materials
● Scene overdraw
● Consistency
● Lighting model independency
● Deferred Linear Space
G-Buffer
G-Buffer
Limitations
X Y Z W
R G B A
Z-Buffer
G-Buffer
Limitations
X Y Z W
R G B A
G-Buffer
Limitations
Needs (PBR)
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
G-Buffer
How?
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
?
G-Buffer
How?
Solutions
● Lower resolution
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
?
G-Buffer
How?
Solutions
● Lower resolution
● Spherical Normals
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
?
G-Buffer
How?
Solutions
● Lower resolution
● Spherical Normals
● YUV
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
?
G-Buffer
How?
Solutions
● Lower resolution
● Spherical Normals
● YUV
● ?
X Y Z W
R G B A
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
?
G-Buffer
● Specular & Diffuse
G-Buffer
● Specular & Diffuse
● PBR Materials
○ Metals
○ Dielectrics
Specular Diffuse
Metals
bright
colorful
black
Dielectrics
dark
monochromatic
full range
colorful
G-Buffer
● Specular & Diffuse
● PBR Materials
○ Metals
○ Dielectrics
● Conclusions
○ Metals needs only RGB
○ Dielectrics needs only RGB + Gray
○ Non-overlaping ranges
Specular Diffuse
Metals
bright
colorful
black
Dielectrics
dark
monochromatic
full range
colorful
G-Buffer
● Specular & Diffuse
● PBR Materials
○ Metals
○ Dielectrics
● Conclusions
○ Metals needs only RGB
○ Dielectrics needs only RGB + Gray
○ Non-overlaping ranges
● PBR needs (real)
Specular Diffuse
Metals
bright
colorful
black
Dielectrics
dark
monochromatic
full range
colorful
RGB Alpha
Metal specular color 0 (black)
Dielectric diffuse color Dielectric specular
G-Buffer
● Specular & Diffuse
● PBR Materials
○ Metals
○ Dielectrics
● Conclusions
○ Metals needs only RGB
○ Dielectrics needs only RGB + Gray
○ Non-overlaping ranges
● PBR needs (real)
○ Lossless
Specular Diffuse
Metals
bright
colorful
black
Dielectrics
dark
monochromatic
full range
colorful
RGB Alpha
Metal specular color 0 (black)
Dielectric diffuse color Dielectric specular
G-Buffer
● Encoding
rgb = dielectric ? diffuse.rgb : specular.rgb
alpha = dielectric ? specular.g : 0.0
G-Buffer
● Encoding
rgb = dielectric ? diffuse.rgb : specular.rgb
alpha = dielectric ? specular.g : 0.0
● Decoding
Specular = (alpha > 0.0) ? alpha : rgb;
Diffuse = (alpha > 0.0) ? rgb : 0.0;
G-Buffer
Specular & Diffuse
Normal (XYZ)
Specular (RGB)
Diffuse (RGB)
Roughness
Human Skin Translucency Leaves
G-Buffer
Specular & Diffuse
Normal (XYZ)
Specular/Diffuse (RGB) Specular (SD)
Roughness
Human Skin Translucency Leaves
G-Buffer
Specular & Diffuse
Roughness
Normal (XYZ)
Specular/Diffuse (RGB) Specular (SD)
Roughness
Human Skin Translucency Leaves
G-Buffer
Specular & Diffuse
Roughness
Masks
● subsurface scattering
● dielectrics only
● binary values
● exclusive
Normal (XYZ) Roughness
Specular/Diffuse (RGB) Specular (SD)
Human Skin Translucency Leaves
G-Buffer
Diffuse/Specular alpha channel - human skin
Normal (XYZ) Roughness
Specular/Diffuse (RGB) Specular (SD)
Human Skin Translucency Leaves
G-Buffer
Diffuse/Specular alpha channel - human skin
M Dielectric Specular
0 1 255
G-Buffer
Diffuse/Specular alpha channel - human skin
M Dielectric Specular H
0 1 254 255
G-Buffer
Diffuse/Specular alpha channel - translucency
● simple subsurface scattering
M Dielectric Specular H
0 1 254 255
G-Buffer
Diffuse/Specular alpha channel - translucency
● simple subsurface scattering
● varying specular
M Dielectric Specular H
0 1 254 255
G-Buffer
Diffuse/Specular alpha channel - translucency
● simple subsurface scattering
● varying specular
● signed format?
M Dielectric Specular H
0 1 254 255
G-Buffer
Diffuse/Specular alpha channel - translucency
● simple subsurface scattering
● varying specular
● signed format?
● encoding/decoding - single mad instruction (alpha * 2.0 - 1.0)
H Translucent Dielectric Specular M M Dielectric Specular H
0 1 126 127 128 129 254 255
-1.0 0.0 1.0
G-Buffer
Diffuse/Specular alpha channel - translucency
● simple subsurface scattering
● varying specular
● signed format?
● encoding/decoding - single mad instruction (alpha * 2.0 - 1.0)
● encoded specular inversion - abs()
H Translucent Dielectric Specular M M Dielectric Specular H
0 1 max min 126 127 128 129 min max 254 255
-1.0 0.0 1.0
G-Buffer
Diffuse/Specular alpha channel - leaves
● simplified lighting for tree crowns
H Translucent Dielectric Specular M M Dielectric Specular H
0 1 max min 126 127 128 129 min max 254 255
-1.0 0.0 1.0
G-Buffer
Diffuse/Specular alpha channel - leaves
● simplified lighting for tree crowns
● no specular
H Translucent Dielectric Specular M M Dielectric Specular H
0 1 max min 126 127 128 129 min max 254 255
-1.0 0.0 1.0
G-Buffer
Diffuse/Specular alpha channel - leaves
L Translucent Dielectric Specular M M Dielectric Specular H
0 1 max min 126 127 128 129 min max 254 255
-1.0 0.0 1.0
Final layout (almost)
Normal (XYZ) Roughness
Specular/Diffuse (RGB) M/SD/H/T/L
G-Buffer
G-Buffer
Final layout
Normal (XYZ) M/SD/H/T/L
Specular/Diffuse (RGB) Roughness
G-Buffer
Final layout - summary
● simple (en)coding
Normal (XYZ) M/SD/H/T/L
Specular/Diffuse (RGB) Roughness
G-Buffer
Final layout - summary
● simple (en)coding
● slim
Normal (XYZ) M/SD/H/T/L
Specular/Diffuse (RGB) Roughness
G-Buffer
Final layout - summary
● simple (en)coding
● slim
● lossless
Normal (XYZ) M/SD/H/T/L
Specular/Diffuse (RGB) Roughness
G-Buffer
Final layout - summary
● simple (en)coding
● slim
● lossless
● PBR correct
Normal (XYZ) M/SD/H/T/L
Specular/Diffuse (RGB) Roughness
Questions?

More Related Content

What's hot

Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
pjcozzi
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
Frank Chao
 

What's hot (20)

Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility buffer
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
 
Frostbite on Mobile
Frostbite on MobileFrostbite on Mobile
Frostbite on Mobile
 
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
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The Surge
 
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
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
 
Inferred lighting
Inferred lightingInferred lighting
Inferred lighting
 
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
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
 
Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3Shiny PC Graphics in Battlefield 3
Shiny PC Graphics in Battlefield 3
 
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
 
Dissecting the Rendering of The Surge
Dissecting the Rendering of The SurgeDissecting the Rendering of The Surge
Dissecting the Rendering of The Surge
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
 
Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2Bindless Deferred Decals in The Surge 2
Bindless Deferred Decals in The Surge 2
 
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
 
Light prepass
Light prepassLight prepass
Light prepass
 
Advancements in-tiled-rendering
Advancements in-tiled-renderingAdvancements in-tiled-rendering
Advancements in-tiled-rendering
 
More explosions, more chaos, and definitely more blowing stuff up
More explosions, more chaos, and definitely more blowing stuff upMore explosions, more chaos, and definitely more blowing stuff up
More explosions, more chaos, and definitely more blowing stuff up
 

Similar to Deferred rendering in Dying Light

Similar to Deferred rendering in Dying Light (11)

The rendering technology of 'lords of the fallen' philip hammer
The rendering technology of 'lords of the fallen'   philip hammerThe rendering technology of 'lords of the fallen'   philip hammer
The rendering technology of 'lords of the fallen' philip hammer
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
Abalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR MaterialsAbalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR Materials
 
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
 
LED research. final.pptx
LED research. final.pptxLED research. final.pptx
LED research. final.pptx
 
Develop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiakDevelop2012 deferred sanchez_stachowiak
Develop2012 deferred sanchez_stachowiak
 
Unity: Next Level Rendering Quality
Unity: Next Level Rendering QualityUnity: Next Level Rendering Quality
Unity: Next Level Rendering Quality
 
Spatial Sound 4: Getting the Best Surround Around
Spatial Sound 4: Getting the Best Surround AroundSpatial Sound 4: Getting the Best Surround Around
Spatial Sound 4: Getting the Best Surround Around
 
Ambisonics: Getting the Best Surround Around
Ambisonics: Getting the Best Surround AroundAmbisonics: Getting the Best Surround Around
Ambisonics: Getting the Best Surround Around
 
Matrix New World offices
Matrix New World officesMatrix New World offices
Matrix New World offices
 
Io 3d product overview 2013 07 en
Io 3d product overview 2013 07 enIo 3d product overview 2013 07 en
Io 3d product overview 2013 07 en
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Deferred rendering in Dying Light

  • 2. Agenda Deferred shading - why? G-Buffer Questions?
  • 4. Deferred shading - why? >250K objects
  • 5. Deferred shading - why? >250K objects Multiple materials
  • 6. Deferred shading - why? >250K objects Multiple materials Thousands of lights
  • 7. Deferred shading - why? >250K objects Multiple materials Thousands of lights Day-night cycle
  • 8. Deferred shading - why? >250K objects Multiple materials Thousands of lights Day-night cycle Changing weather
  • 9. Deferred shading - why? Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering SCENE
  • 10. Deferred shading - why? Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering ○ G-Buffer SCENE
  • 11. Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering ○ G-Buffer ● Improved lighting rendering performance ○ Scene complexity independency Deferred shading - why?
  • 12. Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering ○ G-Buffer ● Improved lighting rendering performance ○ Scene complexity independency ○ Object material & geometry complexity independency Deferred shading - why?
  • 13. Deferred shading - why? Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering ○ G-Buffer ● Improved lighting rendering performance ○ Scene complexity independency ○ Object material & geometry complexity independency ● Simpler rendering pipeline ○ Easy light handling
  • 14. Deferred shading - why? Deferred Shading vs Forward Rendering ● Separated scene and lighting rendering ○ G-Buffer ● Improved lighting rendering performance ○ Scene complexity independency ○ Object material & geometry complexity independency ● Simpler rendering pipeline ○ Easy light handling ○ No material-light litght shader combinations
  • 15. Deferred shading - why? Not only lights ● Complex materials ● Scene overdraw ● Consistency ● Lighting model independency ● Deferred Linear Space
  • 16. Deferred shading - why? Not only lights ● Complex materials ● Scene overdraw ● Consistency ● Lighting model independency ● Deferred Linear Space
  • 17. Deferred shading - why? Not only lights ● Complex materials ● Scene overdraw ● Consistency ● Lighting model independency ● Deferred Linear Space
  • 18. Deferred shading - why? Not only lights ● Complex materials ● Scene overdraw ● Consistency ● Lighting model independency ● Deferred Linear Space
  • 19. Deferred shading - why? Not only lights ● Complex materials ● Scene overdraw ● Consistency ● Lighting model independency ● Deferred Linear Space
  • 21. G-Buffer Limitations X Y Z W R G B A Z-Buffer
  • 23. G-Buffer Limitations Needs (PBR) X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves
  • 24. G-Buffer How? X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves ?
  • 25. G-Buffer How? Solutions ● Lower resolution X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves ?
  • 26. G-Buffer How? Solutions ● Lower resolution ● Spherical Normals X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves ?
  • 27. G-Buffer How? Solutions ● Lower resolution ● Spherical Normals ● YUV X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves ?
  • 28. G-Buffer How? Solutions ● Lower resolution ● Spherical Normals ● YUV ● ? X Y Z W R G B A Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves ?
  • 30. G-Buffer ● Specular & Diffuse ● PBR Materials ○ Metals ○ Dielectrics Specular Diffuse Metals bright colorful black Dielectrics dark monochromatic full range colorful
  • 31. G-Buffer ● Specular & Diffuse ● PBR Materials ○ Metals ○ Dielectrics ● Conclusions ○ Metals needs only RGB ○ Dielectrics needs only RGB + Gray ○ Non-overlaping ranges Specular Diffuse Metals bright colorful black Dielectrics dark monochromatic full range colorful
  • 32. G-Buffer ● Specular & Diffuse ● PBR Materials ○ Metals ○ Dielectrics ● Conclusions ○ Metals needs only RGB ○ Dielectrics needs only RGB + Gray ○ Non-overlaping ranges ● PBR needs (real) Specular Diffuse Metals bright colorful black Dielectrics dark monochromatic full range colorful RGB Alpha Metal specular color 0 (black) Dielectric diffuse color Dielectric specular
  • 33. G-Buffer ● Specular & Diffuse ● PBR Materials ○ Metals ○ Dielectrics ● Conclusions ○ Metals needs only RGB ○ Dielectrics needs only RGB + Gray ○ Non-overlaping ranges ● PBR needs (real) ○ Lossless Specular Diffuse Metals bright colorful black Dielectrics dark monochromatic full range colorful RGB Alpha Metal specular color 0 (black) Dielectric diffuse color Dielectric specular
  • 34. G-Buffer ● Encoding rgb = dielectric ? diffuse.rgb : specular.rgb alpha = dielectric ? specular.g : 0.0
  • 35. G-Buffer ● Encoding rgb = dielectric ? diffuse.rgb : specular.rgb alpha = dielectric ? specular.g : 0.0 ● Decoding Specular = (alpha > 0.0) ? alpha : rgb; Diffuse = (alpha > 0.0) ? rgb : 0.0;
  • 36. G-Buffer Specular & Diffuse Normal (XYZ) Specular (RGB) Diffuse (RGB) Roughness Human Skin Translucency Leaves
  • 37. G-Buffer Specular & Diffuse Normal (XYZ) Specular/Diffuse (RGB) Specular (SD) Roughness Human Skin Translucency Leaves
  • 38. G-Buffer Specular & Diffuse Roughness Normal (XYZ) Specular/Diffuse (RGB) Specular (SD) Roughness Human Skin Translucency Leaves
  • 39. G-Buffer Specular & Diffuse Roughness Masks ● subsurface scattering ● dielectrics only ● binary values ● exclusive Normal (XYZ) Roughness Specular/Diffuse (RGB) Specular (SD) Human Skin Translucency Leaves
  • 40. G-Buffer Diffuse/Specular alpha channel - human skin Normal (XYZ) Roughness Specular/Diffuse (RGB) Specular (SD) Human Skin Translucency Leaves
  • 41. G-Buffer Diffuse/Specular alpha channel - human skin M Dielectric Specular 0 1 255
  • 42. G-Buffer Diffuse/Specular alpha channel - human skin M Dielectric Specular H 0 1 254 255
  • 43. G-Buffer Diffuse/Specular alpha channel - translucency ● simple subsurface scattering M Dielectric Specular H 0 1 254 255
  • 44. G-Buffer Diffuse/Specular alpha channel - translucency ● simple subsurface scattering ● varying specular M Dielectric Specular H 0 1 254 255
  • 45. G-Buffer Diffuse/Specular alpha channel - translucency ● simple subsurface scattering ● varying specular ● signed format? M Dielectric Specular H 0 1 254 255
  • 46. G-Buffer Diffuse/Specular alpha channel - translucency ● simple subsurface scattering ● varying specular ● signed format? ● encoding/decoding - single mad instruction (alpha * 2.0 - 1.0) H Translucent Dielectric Specular M M Dielectric Specular H 0 1 126 127 128 129 254 255 -1.0 0.0 1.0
  • 47. G-Buffer Diffuse/Specular alpha channel - translucency ● simple subsurface scattering ● varying specular ● signed format? ● encoding/decoding - single mad instruction (alpha * 2.0 - 1.0) ● encoded specular inversion - abs() H Translucent Dielectric Specular M M Dielectric Specular H 0 1 max min 126 127 128 129 min max 254 255 -1.0 0.0 1.0
  • 48. G-Buffer Diffuse/Specular alpha channel - leaves ● simplified lighting for tree crowns H Translucent Dielectric Specular M M Dielectric Specular H 0 1 max min 126 127 128 129 min max 254 255 -1.0 0.0 1.0
  • 49. G-Buffer Diffuse/Specular alpha channel - leaves ● simplified lighting for tree crowns ● no specular H Translucent Dielectric Specular M M Dielectric Specular H 0 1 max min 126 127 128 129 min max 254 255 -1.0 0.0 1.0
  • 50. G-Buffer Diffuse/Specular alpha channel - leaves L Translucent Dielectric Specular M M Dielectric Specular H 0 1 max min 126 127 128 129 min max 254 255 -1.0 0.0 1.0
  • 51. Final layout (almost) Normal (XYZ) Roughness Specular/Diffuse (RGB) M/SD/H/T/L G-Buffer
  • 52. G-Buffer Final layout Normal (XYZ) M/SD/H/T/L Specular/Diffuse (RGB) Roughness
  • 53. G-Buffer Final layout - summary ● simple (en)coding Normal (XYZ) M/SD/H/T/L Specular/Diffuse (RGB) Roughness
  • 54. G-Buffer Final layout - summary ● simple (en)coding ● slim Normal (XYZ) M/SD/H/T/L Specular/Diffuse (RGB) Roughness
  • 55. G-Buffer Final layout - summary ● simple (en)coding ● slim ● lossless Normal (XYZ) M/SD/H/T/L Specular/Diffuse (RGB) Roughness
  • 56. G-Buffer Final layout - summary ● simple (en)coding ● slim ● lossless ● PBR correct Normal (XYZ) M/SD/H/T/L Specular/Diffuse (RGB) Roughness