1 / 61

Physically Based Shading

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.

olina
Download Presentation

Physically Based Shading

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Physically Based Shading A simplified artist interface 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 3rd 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 3rd 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 3rd Edition”

  6. Basic BRDF Theory • Sub surface scattering • Distance between enter and exit positions are determined by the material. Image from “Real-Time Rendering 3rd 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 3rd Edition”

  8. Basic Microfacet BRDF Theory • Microfacets • 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”

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

  10. Shadowing & Masking • Not all micro facets facing half vectors direction contribute to lightning • Shadowing • Masking Images from “Real-Time Rendering 3rd 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 3rd Edition”

  16. Fresnel Images from “Everything has Fresnel” by John Hable

  17. Schlick’s 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

  24. Blinn Phong Energy Conversation

  25. Blinn Phong Energy Conversation

  26. Blinn Phong Energy Conversation

  27. Blinn Phong Energy Conversation • 0.397436n+0.0856832

  28. Blinn Phong Energy Conversation • 0.397436n+0.03183

  29. Blinn Phong Energy Conversation

  30. Energy Conversation • Our Normalized equation for specular light • Lambert Cdiff*PI <=1 • Full BRDF Cdiff+Cspec <=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 ? • 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

  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 can’t show • Touch • Observe

  39. Example Material rusty Paint

  40. Flexibillity

  41. Sample Oskar stålberg

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

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

  44. What we did • Crefis the value from the reflection probe • Cambis the value from the ambient probe • Fschlick(v,h) is the fresnel term using the view direction instead of the light direction

  45. Ambient vs reflection Energy Conversation

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

  47. Maya plugin

More Related