Post on 20-Aug-2015
Moving to PBRSébastien Lagarde & Charles de Rousiers
Acknowledgments
• Contributions from *many* people
• This talk and the course notes are about:1. Summarizing all of the steps to move an engine to
PBR2. Using the state of the art in our base
implementation3. Small improvements in quality
Disclaimer
• This presentation is about: A high level overview Steps to move to PBR
• Courses notes come with full details and code …
What is the scope of PBR?
What is the scope of PBR?
Light
What is the scope of PBR?
Light
Environment
What is the scope of PBR?
Light Camera
Environment
What is the scope of PBR?
Light
Camera
Environment
1 Materials
2 Lighting
3 Camera
What is the scope of PBR?
CameraLight
Environment
1 Materials
2 Lighting
3 Camera
What is the scope of PBR?
Light
Environment
Camera
1 Materials
2 Lighting
3 Camera
Reference framework
• Need good reference Export to offline path-tracer In-engine reference
Materials
Material – Standard Model
• Standard material 80% of appearance types Model• Specular: Microfacet model with GGX NDF• Diffuse: Disney’s model
• Other material types Subsurface material Single layer coated material
Die
lectr
icC
on
du
cto
r
Material – Specular
4 (n.v)
F(v, h, f0)G(v, l, h )D(h, ɑ)
(n.l)Fs(v, l) =
Schlick GGX
Height-Correlated Smith[Heitz14]
Material – Specular
Standard (uncorrelated) Smith G Term
Die
lectr
icM
eta
l
Material – Specular
Height-correlated Smith G Term
Die
lectr
icM
eta
l
Material - Specular
Height-correlated Smith G Term
Correlated Standard
Material – Diffuse
• Disney Diffuse [Burley12] Coupled roughness between diffuse and specular Retro-reflection
Material – Diffuse
Lambertian Diffuse
RoughSmooth
Material – Diffuse
Disney Diffuse
RoughSmooth
Material - Diffuse
Disney’s Diffuse
Disney LambertDisney Lambert
Smooth Roughness
Material – Diffuse
Original Disney Diffuse Renormalized Disney Diffuse Diffuse + Specular
Material – Diffuse
Disney Diffuse
Material – Diffuse
Renormalized Disney Diffuse
Material – Parameterization
Normal
BaseColor
Smoothness
Metallic
Reflectance
Normal
BaseColor
Reflectance
Smoothness
Metallic
Material – Parameterization
(1 –Smoothness)
(1 –Smoothness)2
(1 –Smoothness)3
(1 –Smoothness)4
Burley12
Smoothness
Material – Parameterization
Fresnel0
Reflectance
0
255
ConductorsDielectrics
CommonMicro occlusion Gem stones
0
1
128
Material – Parameterization
LIGHTING
Lighting
Lighting
Lighting
Lighting
Lighting
• Lighting coherence All BRDFs must be integrated properly with all light
types All lights need to manage both direct and indirect
lighting All lighting is composed properly (SSR/local IBL/…) All lights have the correct ratio between each other
Lighting – Units & Frame of Reference
Light Power
Lighting – Units & Frame of Reference
Light Power
15 lm 1 200 lm 2 600 lm 64 000 lux
Lighting – Units & Frame of Reference
Luminous powerLumens Lux
Illuminance Luminous intensityCandela
LuminanceCandela/m2
Photometric Unit System
Lighting – Units & Frame of Reference
Luminous power (lm), Luminance (cd/m2), or EV
Area
Luminous power (lm)Punctual
Photometric
Emissive
Sun
Luminous intensity (cd)
Luminance (cd/m2) or EV
Illuminance (lux)
Lighting – Analytical Lights
• Parameterization
1,000 k 10,000 k
Lighting – Units & Frame of Reference
Lighting – Analytical Lights
Lighting – Analytical Lights
Point Sphere
LineTube
SpotDisk
FrustumRectangle
Punctual Area
Lighting – Analytical Lights
• Punctual lights Unit: Lum. power (lm) or Lum. intensity (cd) Use smooth attenuation [Karis13]
Inverse squareKaris13
Distance
Falloff
AttenuationRadius
Lighting – Analytical Lights
• Photometric lights Unit: luminous intensity (cd) Applied to point and spot lights
Simple / IsotropicProfile
IES photometricProfile
Artists
Measured
Lighting – Analytical Lights
• Area lights Unit: Luminous power (lm), Luminance (cd/m2 or
EV) Separate diffuse and specular evaluation
Lighting – Analytical Lights
• Area lights
Without horizon handling With horizon handling
Large area light Horizon handling
Lighting – Analytical Lights
• Diffuse area lights 3 integration techniques:• Analytic
Form factors (radiosity) / view factors (heat transfer)
• MRPSolid angles x Most Representative Point lighting [Drobot14]
• Structured sampling of light shapeSolid angles x average cos
Lighting – Analytical lights
• Area lights: Diffuse term
Sphere
Tube
Disk
Rectangle
View factor
Mix of sphere and rectangle
View factor
Structured sampling
Lighting – Analytical Lights
• Specular area lights No satisfying method Shortest distance to reflection
ray with energy conservation [Karis13]
Lighting – Analytical Lights
• Sun light Units: Illuminance (lux) Facing disk with non-null solid angle
Lighting – Analytical Lights
• Emissive surfaces Units: Luminance (cd/m2 or EV) ”Visible part” of a light Does not emit light
Lighting – Image-Based Lights
• Types of IBLs Distant light probe Local light probes Screen-space reflections Planar reflections
Lighting – Image-Based Lights
• Types of IBLs Distant light probe Local light probes Screen-space reflections Planar reflections
Focus
Lighting – Image-Based Lights
• Units: Luminance (cd/m2 or EV) • Source for the distant light probe
HDRI Procedural sky
Lighting – Image-Based Lights
• Light probe lighting: Integral[Env. lighting x BRDF]
• Pre-integration by separating:• Integral of Lighting x NDF, for V = N• Integral of BRDF, for all V & roughness values
Specular[Karis13]
& Diffuse
Lighting – Image-Based Lights
• Light probe lighting: Integral[Env. lighting x BRDF]
• Pre-integration by separating:• Integral of Lighting x NDF, for V = N• Integral of BRDF, for all V & roughness values
Specular[Karis13]
& Diffuse
LDDFG
Lighting – Image-Based Lights
• Light probe lighting: pre-integration
Isotropic approximation Reference
Error due to LD pre-integration with V = N
Lighting – Image-Based Lights
• Light probe lighting: pre-integration LD needs to be computed each time the lighting changes Needs to be fast (real-time capture / refresh) Deals with HDR source
• Integration method for LD Importance sampling Multiple importance sampling Filtered importance sampling
Lighting – Image-Based Lights
• Light probe lighting: pre-integration LD needs to be computed each time the lighting changes Needs to be fast (real-time capture / refresh) Deals with HDR source
• Integration method for LD Importance sampling Multiple importance sampling Filtered importance samplingFaster convergence
Lighting – Image-Based Lights
• Light probe: pre-integration
Filtered importance sampling
Importance sampling
Lighting – Image-based lights
• Light probe: pre-integration
Pre-Filtered importance sampling
Importance samplingFiltered ISSimple IS
Lighting – Image-Based LightsLight probe• Runtime evaluation
N
Lighting – Image-Based LightsLight probe• Runtime evaluation
N
Lighting – Image-Based LightsLight probe• Runtime evaluation
N
Lighting – Image-Based LightsLight probe• Runtime evaluation
N
Lighting – Image-Based Lights
Mirror Direction
Die
lectr
icM
eta
l
Lighting – Image-Based Lights
Dominant Direction
Die
lectr
icM
eta
l
Lighting – Image-Based Lights
Main Direction
DominantReferenceMirrorReference
Lighting – Image-Based Lights
• Local light probes Acquire surrounding geometry Approximate local parallax: box & sphere proxy
[Lagarde12]
RGB
Dielectric
Conductor
Sky is handled by distant light probe
ConductorDielectric
Lighting – Image-Based Lights
• Distant & local light probes composition Lots of local light probes across level Local light probes can overlap each other Distant light probe contains sky information
RGB Alpha
Probe
Lighting – Image-Based Lights
• Distance-based roughness
Probe
Probe
Lighting – Image-Based Lights
• Distance-based roughness
Probe
Probe
Lighting – Image-Based Lights
• Distance-based roughness
Probe
Probe
Lighting – Image-Based Lights
• Distance-based roughness
Probe
Probe
Lighting – Image-Based Lights
• Distance-based roughness
Probe
CAMERA
Camera – Physically Based Camera
• Transforming scene luminance to pixel value
Camera – Settings
Sensor (Sensitivity)
Aperture
Lens
Shutter Speed f/1.41/125s
ISO 100
f/2.81/125s
ISO 100
f/5.61/125s
ISO 100
f-Stop 1/s
ISO
Camera – Exposure Scene luminance
Sensor illumiance
CCD ADC FilmStock
Sensor exposure
Quantized value
Pixel value
Normalizedvalue
lux
lux.scd/m2
Camera – Exposure
Incident Luminance
Cam
era
ran
ge 1
0 Camera range
Pix
el valu
e
1
0
1. Film stock / tone map 2. Style (LUT / grading)3. sRGB / Rec709
1
Exposure computationbased on HSBS sensitivity
Camera – Exposure
• Sunny 16 rule as validation Sky 20,000 lux Sun 100,000 lux
f/16 1/125s ISO 100
TRANSITION TO PBR
Transition – Steps
1. Standard material + viewer first + educating key artists
2. PBR / non-PBR in parallel, with automatic conversion
3. Evangelize PBR to game teams + validation tools
Fresnel0 Diffuse Albedo Illuminance
Acknowledgements
• EA Frostbite - Alex Fry, Christian Bense, Noah Klabunde, Henrik Fernlund, the rendering team
• EA DICE - Yasin Uludag, Arne Schober
• Lucasfilm: Lutz Latta, Cliff Ramshaw, Rodney Huff, Rogers Cordes
• Graphics community: Michał Drobot, Benjamin Rouveyrol, Eric Heitz, Juan Cañada, Ondra Karlík, Tomasz Stachowiak, Brian Karis
• Stephen Hill & Stephen McAuley
QUESTIONS?
Sébastien LagardeLagardese@hotmail.frTwitter: @seblagarde
Charles de RousiersCharles.derousiers@frostbite.comTwitter: @kiwaiii
References
• [Burley12] Brent Burley, “Physically Based Shading at Disney”, SIGGRAPH’12, PBR Course
• [Karis13] Brian Karis, “Real Shading in Unreal Engine 4”, SIGRRAPH’13, PBR Course
• [Drobot14] Michal Drobot, ”Physically Based Area Lights”, GPU Pro 5
• [Heitz14] Eric Heitz, ”Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs”, JCGT, 2014
• [Lagarde12] Sébastien Lagarde, “Local Image-based Lighting With Parallax-Corrected Cubemaps”, SIGGRAPH’12