Physically Based Shading
A simplified artist interface
Niklas Hansson
Head Teacher Game programming
The Game Assembly.
Physically Based Shading
• What is it ?
• Why should I use it ?
• How do I integrate it into a project ?
Basic BRDF Theory
• Boundary : When light goes from one material to
• Light splits up into two directions : reflection and
• The amount of light
reflected depends on the
materials reflective index.
Image from “Real-Time Rendering 3rd Edition”
Basic BRDF Theory
• Basic Material
- Part is Reflected
- Part enters the material
• Metal
-Part is Reflected
-The part entering the
Material is absorbed
Image from “Real-Time Rendering 3rd Edition”
Basic BRDF Theory
•Non metals
- Light that enters the material scatters internally
- Is absorbed
- and often exits the surface again.
Image from “Real-Time Rendering 3rd Edition”
Basic BRDF Theory
• Sub surface scattering
– Distance between enter and exit positions are
determined by the material.
Image from “Real-Time Rendering 3rd Edition”
Basic BRDF Theory
• Point model
– By ignoring distance between exit and enter points
we can model lighting with an BRDF.
Image from “Real-Time Rendering 3rd Edition”
Basic Microfacet BRDF Theory
•A surface consists of many small
perfectly flat surfaces.
•How much they differ in normal
determines how light interact
Image from “Real-Time Rendering 3rd Edition”
Basic Microfacet BRDF Theory
Images from “Real-Time Rendering 3rd Edition”
Shadowing & Masking
• Not all micro facets facing half vectors direction
contribute to lightning
Images from “Real-Time Rendering 3rd Edition”
So why is specular so important ?
Images from “Everything is Shiny” by John Hable
So why is specular so important ?
Images from “Everything is Shiny” by John Hable
The Microfacet BRDF
Fresnel Reflectance
• Returns a Value from 0-1 in RGB
– Fraction of light reflected from optically flat surface
given Light directon l and Half vector h
Fresnel Reflectance
• Depends on refraction index (in our terms the
substance of the object) and the light angle.
Image from “Real-Time Rendering 3rd Edition”
Images from “Everything has Fresnel” by John Hable
Schlick’s Approximation
• Decently Accurate, uses F(0) the refractive index
as input.
– Which is our substance term.
Geometric term
•Gives a scalar value between 0 and 1
• Contains the fraction of non obscured microfacets
• Various functions exists most using roughness as input
Distribution function
• Calculates factor of microfacets reflecting light towards
the eye
• The function determines size and shape of the specular
Blinn Phong Distribution Functions
• Blinn Phong Distribution Function
• Modified Blinn Phong
Beckman Distribution function
Conversion :
Blinn Phong Energy Conversation
• If the specular highlight is larger the specular
intensity must be lower.
• N = roughness
Blinn Phong Energy Conversation
Blinn Phong Energy Conversation
Blinn Phong Energy Conversation
Blinn Phong Energy Conversation
Blinn Phong Energy Conversation
• 0.397436n+0.0856832
Blinn Phong Energy Conversation
• 0.397436n+0.03183
Blinn Phong Energy Conversation
Energy Conversation
• Our Normalized equation for specular light
• Lambert
Cdiff*PI <=1
• Full BRDF
Cdiff+Cspec <=1
Ambient Light
• Ambient Light is just Light
– Has a specular component too
• reflections
• roughness controls reflections blurriness
substance controls reflection strength.
• Pre blurred cubemaps
Ambient Light
• ATI cubemap gen has nice functions for
preblurring mipmaps.
– For correctnes the blurring needs to match your
specular light
Blurred cubemap
• Use the angular extent and always sample from top mip.
• Use the glossiness for that mipmap level and evaluate max size of
highlight for size of angular extent.
• Use the phong function to evaluate a contribution for all the pixels
inside the extent.
Why physically based ?
• It’s more realistic thanks to being physically based?
• Materials does not require as much retweaking under
changing lighting conditions.
• You can create more easily varied materials with lesser
number of values
• It saves artist time and simplifies workflow
Simplified Artist interface
• Reduces number of maps from 4-5 to 2.
• Simplifies Junior artist training
– No longer take albedo and desaturate for intensity
– And then lower color for gloss
– We have all seen it
Simplified Artist interface
• PBL simplifies this by creating a material interface
that makes sense.
– Substance
• Is the index of refraction for the material
• No need to hand paint.
• Mathematically matches old intensity
Color picker
Simplified Artist interface
• Roughness
– The old gloss
– But thanks to Normalization a lot more useful
– Where hand painting happens
– Controls reflection blurrinees and spec
– Surface Roughness that normal maps can’t show
– Touch
– Observe
Example Material rusty Paint
Sample Oskar stålberg
Why physically based ?
• Lower numbers of values to tweak
• Smaller tighter gbuffer
– Low bandwitdh
– Small ALU increase
– Ideal for deferred rendering
• While still allowing very
varied materials
How to use it
• What did we do ?
• Microfacet BRDF with
– Normalized Blinn Phong
– Fresnel reflectance
– Void Geometry Function
• G(h) = 4(n dot l)(n dot v)
– Prefiltered glossy reflections from cubemap probes
– Ambient from ambient probes
What we did
• Cref is the value from the reflection probe
• Camb is the value from the ambient probe
• Fschlick(v,h) is the fresnel term using the view direction instead of
the light direction
Ambient vs reflection Energy Conversation
Lessons learned
• Substance and Roughness vs Intensity and Gloss
– Spend time training and communicating to your
– Help them use the new interface
• Tools is essential
– Beware of bugs
Maya plugin
What we did
• Flexible
• Kind of projects
–Space shooter
–Realtime Strategy
–First Person shooter
Space shooter
Fps project
• Goals
– Resolve all issues found during the last project
– Get an easy to light solution that took little rebuild
time and would work with just a few spot lights.
• Techniques
– All enviroment and ambient probes generated by the
ingame engine to achieve consistency.
– Box projected cubemaps was used for reflections and
a variation was used for ambient
– Simple Multi bounce solution for lightning
• Specular and reflection doing more work
– Will look weird in areas normally don’t reach by much
• Use Ambient occlusion
– Multiply to spec
– Multiply to reflection
• If needed add special Specular occlusion
Sébastien Lagarde ”Adopting a physically based shading model “,”Feeding a physically
based shading model”
Roy Driscol
“Energy Conversation In Games”
Fabien Giesen “Blinn-Phong normalization factor”
Nathaniel Hoffmann, “Crafting Physically Motivated Shading Models for Game Development”, SIGGRAPH 2010
Dimitar Lazarov, “Physically-​based lighting in Call of Duty: Black Ops” SIGGRAPH 2011
Christian Schüler, “An Efficient and Physically Plausible Real-​Time Shading Model.” ,”
The Blinn-​Phong Normalization Zoo”
Akienne-​Möller, Haines and Hoffmann, “Real-​Time Rendering” book
Yoshiharu Gotanda, “Practical Implementation of Physically-​Based Shading Models at
tri-​Ace”, SIGGRAPH 2010
Yoshiharu Gotanda, “Practical Physically ​Based Rendering in Real-time”, SIGGRAPH
Going forward
• Testing on real projects
• Better Geometry term
• Using the proper mipmapping for cubemaps
• Some kind of Diffuse- specular energy
Physically based for non realistic rendering
• Can we do it ?
– Yes just a material interface
– Rules can be bent and broken.
• Specular not that important for cartoonish look
– Diffuse light ,albedo,normal,AO more important
RTS game
More non photo

Nordic Game Conference Speak on the subject