Upload
maciej-jamrozik
View
5.058
Download
24
Embed Size (px)
Citation preview
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
LimitationsX Y Z W
R G B A
Z-Buffer
G-Buffer
LimitationsX 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 brightcolorful black
Dielectrics darkmonochromatic
full rangecolorful
G-Buffer
● Specular & Diffuse
● PBR Materials○ Metals
○ Dielectrics
● Conclusions○ Metals needs only RGB
○ Dielectrics needs only RGB + Gray
○ Non-overlaping ranges
Specular Diffuse
Metals brightcolorful black
Dielectrics darkmonochromatic
full rangecolorful
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 brightcolorful black
Dielectrics darkmonochromatic
full rangecolorful
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 brightcolorful black
Dielectrics darkmonochromatic
full rangecolorful
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
RoughnessNormal (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 skinNormal (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 layoutNormal (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?