Presentation is loading. Please wait.

Presentation is loading. Please wait.

A simplified artist interface Physically Based Shading Niklas Hansson Head Teacher Game programming The Game Assembly.

Similar presentations

Presentation on theme: "A simplified artist interface Physically Based Shading Niklas Hansson Head Teacher Game programming The Game Assembly."— Presentation transcript:

1 A simplified artist interface Physically Based Shading Niklas Hansson Head Teacher Game programming The Game Assembly.

2 Physically Based Shading What is it ? Why should I use it ? How do I integrate it into a project ?

3 Basic BRDF Theory Boundary : When light goes from one material to another Light splits up into two directions : reflection and refraction. The amount of light reflected depends on the materials reflective index. Image from Real-Time Rendering 3 rd Edition

4 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 3 rd Edition

5 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 3 rd Edition

6 Basic BRDF Theory Sub surface scattering – Distance between enter and exit positions are determined by the material. Image from Real-Time Rendering 3 rd Edition

7 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 3 rd Edition

8 Basic Microfacet BRDF Theory Image from Real-Time Rendering 3 rd Edition Microfacets A surface consists of many small perfectly flat surfaces. How much they differ in normal determines how light interact

9 Basic Microfacet BRDF Theory Images from Real-Time Rendering 3 rd Edition

10 Shadowing & Masking Not all micro facets facing half vectors direction contribute to lightning Shadowing Masking Images from Real-Time Rendering 3 rd Edition

11 So why is specular so important ? Images from Everything is Shiny by John Hable

12 So why is specular so important ? Images from Everything is Shiny by John Hable

13 The Microfacet BRDF

14 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

15 Fresnel Reflectance Depends on refraction index (in our terms the substance of the object) and the light angle. Image from Real-Time Rendering 3 rd Edition

16 Fresnel Images from Everything has Fresnel by John Hable

17 Schlicks Approximation Decently Accurate, uses F(0) the refractive index as input. – Which is our substance term.

18 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

19 Distribution function Calculates factor of microfacets reflecting light towards the eye The function determines size and shape of the specular highlight

20 Blinn Phong Distribution Functions Blinn Phong Distribution Function Modified Blinn Phong

21 Beckman Distribution function Conversion :

22 Blinn Phong Energy Conversation If the specular highlight is larger the specular intensity must be lower. N = roughness

23 Blinn Phong Energy Conversation




27 n

28 Blinn Phong Energy Conversation n

29 Blinn Phong Energy Conversation

30 Energy Conversation Our Normalized equation for specular light Lambert C diff*PI <=1 Full BRDF C diff +C spec <=1

31 Ambient Light Ambient Light is just Light – Has a specular component too reflections roughness controls reflections blurriness substance controls reflection strength. Pre blurred cubemaps

32 Ambient Light ATI cubemap gen has nice functions for preblurring mipmaps. – For correctnes the blurring needs to match your specular light

33 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.

34 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

35 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

36 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

37 Color picker

38 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 cant show – Touch – Observe

39 Example Material rusty Paint

40 Flexibillity

41 Sample Oskar stålberg


43 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

44 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

45 What we did C ref is the value from the reflection probe C amb is the value from the ambient probe F schlick (v,h) is the fresnel term using the view direction instead of the light direction

46 Ambient vs reflection Energy Conversation


48 Lessons learned Substance and Roughness vs Intensity and Gloss – Spend time training and communicating to your artists – Help them use the new interface Tools is essential – Beware of bugs

49 Maya plugin


51 What we did Flexible Kind of projects – Space shooter – Realtime Strategy – First Person shooter

52 Space shooter


54 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


56 Occlusion Specular and reflection doing more work – Will look weird in areas normally dont reach by much light Use Ambient occlusion – Multiply to spec – Multiply to reflection If needed add special Specular occlusion

57 References 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 Hoff­mann, Crafting Physically Moti­vated Shading Models for Game Devel­ op­ment, SIGGRAPH 2010 Dim­i­tar Lazarov, Physically-based lighting in Call of Duty: Black Ops SIGGRAPH 2011 Chris­t­ian Schüler, An Efficient and Physically Plausible Real-Time Shad­ing Model., The Blinn-Phong Normalization Zoo Akienne-Möller, Haines and Hoff­mann, 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 2012

58 Going forward Testing on real projects Better Geometry term Using the proper mipmapping for cubemaps Some kind of Diffuse- specular energy conversation

59 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

60 RTS game

61 More non photo

Download ppt "A simplified artist interface Physically Based Shading Niklas Hansson Head Teacher Game programming The Game Assembly."

Similar presentations

Ads by Google