1 / 92

Physically Based Shading in Real Time Rendering

Physically Based Shading in Real Time Rendering. Christian Schüler MBL Development. Introduction. Who’s me? Veteran: Engine programming since 15 years Several shipped games Doing “serious” work now but still love games. Introduction. Physically Based Shading Solves some real problems

Télécharger la présentation

Physically Based Shading in Real Time Rendering

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 Shadingin Real Time Rendering • Christian Schüler • MBL Development

  2. Introduction • Who’s me? • Veteran: Engine programming since 15 years • Several shipped games • Doing “serious” work now but still love games

  3. Introduction • Physically Based Shading • Solves some real problems • Can make authoring easier • Can improve looks • Feels as the “right” way to do things • Is going to be implemented in more and more engines

  4. Introduction • Ingredients for Physically Based Shading • Linear Lighting • Energy Preserving Specular • Metals + Dielectrics • Fresnel Reflectance • Image Based Reflections • Microfacet Models

  5. Introduction • Ingredients for Physically Based Shading • Linear Lighting • Energy Preserving Specular • Metals + Dielectrics • Fresnel Reflectance • Image Based Reflections • Microfacet Models will talk about these today important for content creation

  6. Introduction • Ingredients for Physically Based Shading • Linear Lighting • Energy Preserving Specular • Metals + Dielectrics • Fresnel Reflectance • Image Based Reflections • Microfacet Models programmers and shader authors worry about these

  7. PBS Ingredients • PBS Ingredient #1Linear Lighting

  8. PBS Ingredients → Display Gamma and Linear Lighting • 1989The age of “Pixel Art” and a life-changing revelation:RGB values are not linear!

  9. PBS Ingredients → Display Gamma and Linear Lighting naïve 0—25—50—75—100 corrected 0—50—71—87—100 too dark

  10. PBS Ingredients → Display Gamma and Linear Lighting • RGB values are not linear. This is important for— • Distance and falloff curves sharp border

  11. PBS Ingredients → Display Gamma and Linear Lighting • RGB values are not linear. This is important for— • Distance and falloff curves • Addition of Lights not washed out

  12. PBS Ingredients → Display Gamma and Linear Lighting • RGB values are not linear. This is important for— • Distance and falloff curves • Addition of Lights • Addition of Colors(diffuse + specular) no color shift

  13. PBS Ingredients → Display Gamma and Linear Lighting effect begins early • RGB values are not linear. This is important for— • Distance and falloff curves • Addition of Lights • Addition of Colors(diffuse + specular) • Addition of Colors(atmospheric effects) bright details still visible

  14. color shift falloff, gradient too soft color shift and clipping PBS Ingredients → Display Gamma and Linear Lighting • Counter-Example: • Not done with linear lighting • Classic “computer” look

  15. PBS Ingredients → Display Gamma and Linear Lighting • Further reading • Blogshttp://filmicgames.com/archives/category/gamma • Unrealhttp://udn.epicgames.com/Three/TexturingGuidelines.html • CryEnginehttp://freesdk.crydev.net/display/SDKDOC4/Gamma-Correct+Rendering+(sRGB) • Unityhttp://docs.unity3d.com/Documentation/Manual/LinearLighting.html

  16. PBS Ingredients • PBS Ingredient #2Energy Preserving Specular

  17. PBS Ingredients → Energy Preserving Specular • Assignment: • Make a Blinn/Phong material with textured glossiness.

  18. PBS Ingredients → Energy Preserving Specular • Assignment: • Make a Blinn/Phong material with textured glossiness. • Why?

  19. PBS Ingredients → Energy Preserving Specular smooth rough • 2006 • Per pixel varying glossiness for ice material • Spellforce 2

  20. rough low glossiness smooth high glossiness PBS Ingredients → Energy Preserving Specular http://en.wikipedia.org/wiki/File:Frost_patterns_4.jpg

  21. 2009 Per pixel varying glossiness for wet vs dry effect Velvet Assassin PBS Ingredients → Energy Preserving Specular

  22. glossiness texture alpha channel of specular map 2009 Per pixel varying glossiness for wet vs dry effect Velvet Assassin PBS Ingredients → Energy Preserving Specular

  23. Blinn/Phong diffuse color opacity specular color specular power Texture color alpha PBS Ingredients → Energy Preserving Specular • First try:

  24. Blinn/Phong diffuse color opacity specular color specular power Texture color alpha PBS Ingredients → Energy Preserving Specular 0 ... 1 0 ... infinity ? • What about the parameterization? • What are meaningful values to put into a texture?

  25. Blinn/Phong diffuse color opacity specular color specular power Texture color alpha exponential function PBS Ingredients → Energy Preserving Specular 0 ... 1 1 ... 4096 • What about the parameterization? • What are meaningful values to put into a texture?

  26. low gloss high gloss PBS Ingredients → Energy Preserving Specular • In reality, the size of a highlight is linked with its peak brightness. • This is the Energy Preservation bit.

  27. dependency PBS Ingredients → Energy Preserving Specular glossiness specular color • Workflow hazard: Glossiness channel and specular color channel become dependent on one another!

  28. Blinn/Phong diffuse color opacity specular color specular power multiplier Texture color alpha exponential function ? PBS Ingredients → Energy Preserving Specular • Solution: Break the dependency! • Shader must scale specular color automatically.

  29. integral normalization factor PBS Ingredients → Energy Preserving Specular • This multiplier is called the normalization factor. • Can be computed from a hemispherical integral. • Several possibilities, see references.

  30. normalization factor Blinn/Phong diffuse color opacity specular color specular power Texture color alpha exponential function n+1 2 PBS Ingredients → Energeticgy Conserving Specular • It starts to get somewhat messy.

  31. normalization factor Blinn/Phong diffuse color opacity specular color specular power Texture color alpha exponential function n+1 2 PBS Ingredients → Energeticgy Conserving Specular • Why not call that a new kind of material?

  32. normalized Blinn/Phong diffuse color opacity specular color glossiness Texture color alpha PBS Ingredients → Energy Preserving Specular • Enter the normalized Blinn/Phong material. • Accepts a glossiness parameter in the range 0 to 1. • Automatic scale of specular color.

  33. Texture color alpha normalized Blinn/Phong diffuse color opacity specular color glossiness Texture color alpha PBS Ingredients → Energy Preserving Specular • Neat side effect: • Completely parameterized by two RGBA textures.

  34. PBS Ingredients → Energy Preserving Specular • Further reading • Blogshttp://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/http://seblagarde.wordpress.com/2011/08/17/hello-world/http://www.thetenthplanet.de/archives/255 • Unrealhttp://udn.epicgames.com/Three/ImageBasedReflections.html • CryEnginehttp://freesdk.crydev.net/display/SDKDOC4/Shading

  35. PBS Ingredients • PBS Ingredient #3Metals and Dielectrics

  36. PBS Ingredients • PBS Ingredient #3Metals and ...

  37. PBS Ingredients • PBS Ingredient #3Metals and Non-Metals

  38. PBS Ingredients • PBS Ingredient #3Metals and Non-Metals • aka: “can set diffuse color to zero without everything else messed up”

  39. PBS Ingredients • PBS Ingredient #3Metals and Non-Metals • aka: “can set diffuse color to zero without everything else messed up”= no need for an extra “metal shader” (helps batching)

  40. PBS Ingredients → Metals and Dielectrics • Assignment: • What is the difference between metals and non-metals?

  41. Are metals “somehow grey”? PBS Ingredients → Metals and Dielectrics • Assignment: • What is the difference between metals and non-metals?

  42. Are metals “especially shiny”? PBS Ingredients → Metals and Dielectrics • Assignment: • What is the difference between metals and non-metals?

  43. But surely they have “lots of specular”? PBS Ingredients → Metals and Dielectrics • Assignment: • What is the difference between metals and non-metals?

  44. metal non-grey non-metal low glossiness metal low glossiness non-metal high glossiness PBS Ingredients → Metals and Dielectrics metal high glossiness

  45. non-metaldiffuse + specular PBS Ingredients → Metals and Dielectrics metal specular only • Metals are pure reflection, • characterized by the absence of a diffuse component.

  46. PBS Ingredients → Metals and Dielectrics • Specular reflection happens on the surface incoming light specular reflection more or less glossy surface more or less smooth

  47. PBS Ingredients → Metals and Dielectrics • This is still specular reflection incoming light specular reflection all over the place surface extremely rough

  48. PBS Ingredients → Metals and Dielectrics • This is still specular reflection incoming light specular reflection all over the place surface extremely rough 100% specular

  49. PBS Ingredients → Metals and Dielectrics • Diffuse reflection happens below the surface • Completely different physical process incoming light diffuse reflection absorption and re-emission molecules

  50. PBS Ingredients → Metals and Dielectrics • Diffuse reflection happens below the surface • Completely different physical process incoming light diffuse reflection absorption and re-emission 100% diffuse (no solid surface at all) molecules

More Related