Physically Based Shading
date post
12-Jan-2016Category
Documents
view
99download
2
Embed Size (px)
description
Transcript of Physically Based Shading
A simplified artist interface
Physically Based Shading
Niklas HanssonHead 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 TheoryBoundary : When light goes from one material to anotherLight splits up into two directions : reflection and refraction.The amount of light reflected depends on thematerials reflective index.
Image from Real-Time Rendering 3rd Edition
Basic BRDF Theory Basic Material- Part is Reflected- Part enters the material
MetalPart is ReflectedThe part entering the Material is absorbed
Image from Real-Time Rendering 3rd Edition
Basic BRDF TheoryNon 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 TheorySub surface scatteringDistance between enter and exit positions are determined by the material.
Image from Real-Time Rendering 3rd Edition
Basic BRDF TheoryPoint modelBy ignoring distance between exit and enter points we can model lighting with an BRDF.
Image from Real-Time Rendering 3rd Edition
Basic Microfacet BRDF TheoryImage from Real-Time Rendering 3rd EditionMicrofacetsA surface consists of many small perfectly flat surfaces.How much they differ in normal determines how light interact
Basic Microfacet BRDF TheoryImages from Real-Time Rendering 3rd Edition
Shadowing & Masking Not all micro facets facing half vectors direction contribute to lightning
ShadowingMasking
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 ReflectanceReturns a Value from 0-1 in RGBFraction of light reflected from optically flat surface given Light directon l and Half vector h
Fresnel ReflectanceDepends on refraction index (in our terms the substance of the object) and the light angle.Image from Real-Time Rendering 3rd Edition
FresnelImages from Everything has Fresnel by John Hable
Schlicks ApproximationDecently Accurate, uses F(0) the refractive index as input.Which is our substance term.
Geometric termGives 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 eyeThe function determines size and shape of the specular highlight
Blinn Phong Distribution FunctionsBlinn Phong Distribution Function
Modified Blinn Phong
Beckman Distribution functionConversion :
Blinn Phong Energy ConversationIf 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 Conversation0.397436n+0.0856832
Blinn Phong Energy Conversation0.397436n+0.03183
Blinn Phong Energy Conversation
Energy ConversationOur Normalized equation for specular light
Lambert
Cdiff*PI
Ambient LightAmbient Light is just LightHas a specular component tooreflections 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 ?Its 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 interfaceReduces number of maps from 4-5 to 2.
Simplifies Junior artist trainingNo longer take albedo and desaturate for intensityAnd then lower color for glossWe have all seen it
Simplified Artist interfacePBL simplifies this by creating a material interface that makes sense. SubstanceIs the index of refraction for the materialNo need to hand paint.Mathematically matches old intensity
Color picker
Simplified Artist interfaceRoughnessThe old glossBut thanks to Normalization a lot more usefulWhere hand painting happensControls reflection blurrinees and spec Surface Roughness that normal maps cant show
TouchObserve
Example Material rusty Paint
Flexibillity
Sample Oskar stlberg
Why physically based ?Lower numbers of values to tweak
Smaller tighter gbufferLow bandwitdhSmall ALU increaseIdeal for deferred rendering
While still allowing very varied materials
How to use itWhat did we do ?
Microfacet BRDF with Normalized Blinn PhongFresnel reflectanceVoid Geometry FunctionG(h) = 4(n dot l)(n dot v)Prefiltered glossy reflections from cubemap probesAmbient 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 GlossSpend time training and communicating to your artistsHelp them use the new interface
Tools is essentialBeware of bugs
Maya plugin
What we didFlexibleKind of projectsSpace shooterRealtime Strategy First Person shooter
Space shooter
Fps projectGoalsResolve all issues found during the last projectGet an easy to light solution that took little rebuild time and would work with just a few spot lights.TechniquesAll 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 ambientSimple Multi bounce solution for lightning
OcclusionSpecular and reflection doing more workWill look weird in areas normally dont reach by much lightUse Ambient occlusionMultiply to specMultiply to reflectionIf needed add special Specular occlusion
ReferencesSbastien Lagarde Adopting a physically based shadingmodel ,Feeding a physically based shadingmodelRoy Driscol Energy Conversation In GamesFabien Giesen Blinn-Phong normalization factorNathaniel Hoffmann, Crafting Physically Motivated Shading Models for Game Development, SIGGRAPH 2010Dimitar Lazarov, Physically-based lighting in Call of Duty: Black Ops SIGGRAPH 2011Christian Schler, An Efficient and Physically Plausible Real-Time Shading Model. , The Blinn-Phong Normalization ZooAkienne-Mller, Haines and Hoffmann, Real-Time Rendering bookYoshiharu Gotanda, Practical Implementation of Physically-Based Shading Models at tri-Ace, SIGGRAPH 2010Yoshiharu Gotanda, Practical Physically Based Rendering in Real-time, SIGGRAPH 2012
Going forwardTesting on real projects
Better Geometry term
Using the proper mipmapping for cubemaps
Some kind of Diffuse- specular energy conversation
Physically based for non realistic renderingCan we do it ?Yes just a material interfaceRules can be bent and broken.Specular not that important for cartoonish lookDiffuse light ,albedo,normal,AO more important
RTS game
More non photo
Lightning base on the physical properties of light.
Replacement of Ad Hoc solutions
Instead of havingSpec Intensity,Spec Gloss,Reflectivity,Fresnel strength map and even a separate reflection gloss factor.
With a physically based solution we will be able to collapse this down to two simple maps.
Instead of Ad hoc solutions competing we have one stable system.
*Been asked to keep this not to technical
Basics are important.
BoundraryL is split into ri and t
SplitRefractive index
BRDF
Works no matter the materials
We will only look at air to other material***If red pixel and green exit pos
needs SSSBRDF cant cope.
If other wayWorks *Holds holds true no matter the source of the light.
Works for perfectly flat boundaries
Most real world materials (except mirrors) doesnt share this property.
*MicrofactesNormal differences encoded as a normal distribution
The difference from the Phong model to the Blinn Phong model
Blinn Phong instead used the microfacet
If parallel light hits small solid angle with all light, the rougher the larger solid angle the light will hit.
We use a normal distribution function to model this
The data it uses is the roughness of the surface (or flattnes would be a better name)*As you can see the rougher the surface the blurrier reflection and larger specular highlights.
Microfacets model sub normal map resolution shapes
*Strength of being physically based
Values have real value
Can update formulas without changing the value
Ca
Recommended