Successfully reported this slideshow.
Your SlideShare is downloading. ×

Unite2014: Mastering Physically Based Shading in Unity 5

Unite2014: Mastering Physically Based Shading in Unity 5

Download to read offline

Light introduction to Physically Based Shading. Presentation discusses theory behind light interaction with different materials, new Standard shader in Unity5 and how to prepare data for your Physically Based workflow.

Light introduction to Physically Based Shading. Presentation discusses theory behind light interaction with different materials, new Standard shader in Unity5 and how to prepare data for your Physically Based workflow.

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Unite2014: Mastering Physically Based Shading in Unity 5

  1. 1. Mastering Physically Based Shading in Unity 5 Renaldas Zioma / Unity @__ReJ__ Erland Körner / Unity Wes McDermott / Allegorithmic
  2. 2. Physically Based Shading in Unity 5
  3. 3. One shader
  4. 4. Our past • Butterfly Effect demo • Inspiration from Mental Images Architectural (MIA) shader • Inspiration from Disney SIGGRAPH’12 talk • Secret Aim: look identical /w Marmoset Toolbag 2 4
  5. 5. Natural Materials • Metals • Non-metals (Dielectrics) • monolithic materials: plastic, rock, water … • cloth • organic 5 vs
  6. 6. Dielectrics • Most objects in natural environments are dielectrics
  7. 7. Dielectrics Distinguishing Traits 7 • Hard to see your own image in the reflection • Much more reflective on the edge • Augustin Fresnel (1788-1827)
  8. 8. • Surface reflects almost* the same fraction of light for any dielectric • Light penetrates the surface • on atomic level a lot of space for light photons to pass through • Light is scattered under the surface Dielectrics All are almost the same * though gems can be 2-3 times more reflective than glass
  9. 9. Dielectrics Specular Reflection • Light bounces of the surface • NO color change! • Surface irregularities will affect spread of the bounce
  10. 10. • Subsurface scattering • Crystallites, cells, fibers - will absorb and reflect light • different color • random directions • Otherwise light just passes through • liquids, some plastics, gems Dielectrics Diffuse Reflection Scattering
  11. 11. • Surface micro-structure • rough vs smooth • Diffuse reflection (absorption & scattering) • we perceive it as a color of material • Slight variation in amount of light bounced in specular reflection • sometimes denoted as F0 • governed by the Index Of Refraction of material • 2-4% (IOR 1.3 .. 1.8) • gems are outliers 7%-13% (IOR 1.2 .. 2.6) 11 Dielectrics Why then they look different?
  12. 12. 12 Metals
  13. 13. • Very good mirrors (if smooth) • Colored reflection • Surface is impenetrable to light • can’t be transparent * Metals Distinguishing Traits 13 * well, actually some metals can be made into semi-transparent, if really really thin!
  14. 14. Electromagnetic field Metals Specular Reflection • Lots of free electrons! • light is bounced back • “prevent” light penetrating the surface • Fraction of light is absorbed at the surface • color tinted reflection
  15. 15. Metals What makes different looking metals • Color of specular reflection • we perceive it as a color of metal • Surface micro-structure • rough vs polished
  16. 16. Half-correct summary* * works only for pure materials • Metals • No diffuse • Very strong specular • Colored specular (reddish, yellowish) • Non-metals • Strong Fresnel • Very weak specular at normal incidence • Monochromatic specular • Colored diffuse (any color)
  17. 17. Materials are rarely pure or ideal
  18. 18. Materials are rarely pure or ideal • Metals • No diffuse - rust, oxidization, mix /w other materials … • Non-metals • Strong Fresnel - not for rough surfaces • Very weak specular at normal incidence • Monochromatic specular • Multilayer materials can have stronger tinted specular • dielectric mirrors, cloths like tarpaulin, vegetation …
  19. 19. Materials are rarely pure or ideal • That is why we pick Diffuse+Specular workflow • but there are definite upsides in the Metallic workflow too! ! • btw, some call this workflow: • Albedo+Reflectivity • Specular+Gloss
  20. 20. So what is this Specular, again? • Controls reflectivity at normal incidence • Plastic (IOR 1.5) • 4% ! • Some Crystal (IOR 2.1) • 13% ! • Aluminium • 95% 20
  21. 21. So what is this Specular, again? • Plastic (IOR 1.5) • 4% in Linear • (59, 59, 59) in sRGB • Some Crystal (IOR 2.1) • 13% • (100, 100, 100) in sRGB • Silver • 95% • (249, 249, 249) in sRGB
  22. 22. So what is this Specular, again? • Silver ! • Copper ! • Gold ! • Aluminum ! • Iron 22 gold copper silver reflectance% visible spectrum
  23. 23. Smoothness • Controls Fresnel - reflectivity at grazing angle • Controls blurriness of reflection • Very rough surfaces • Disney diffuse • cloth 23
  24. 24. 24 Standard shader break down
  25. 25. Direct Light 25
  26. 26. Diffuse reflection 26
  27. 27. Indirect Light 27
  28. 28. + Indirect Light * AO 28
  29. 29. + Fresnel 29
  30. 30. Metallic Reflections 30
  31. 31. (or) Dielectric Reflections 31
  32. 32. Reflections /w Smoothness 32
  33. 33. Reflections * Specular 33
  34. 34. + Reflections * Specular * AO 34
  35. 35. = Final result 35
  36. 36. What are the benefits!? • Accurate, realistic material representation • Consistent and predictable workflow and artwork • For everyday materials • …but also stylised look 36
  37. 37. The Standard shader • Compact • Folds • Thumbnails • Expandable 37
  38. 38. Standard shader - Primary inputs • Diffuse [RGB] • Specular [RGB] • defines material type • Smoothness [greyscale A] • character of the surface • Normal Map [Tangent Space] 38
  39. 39. Additionally… • Occlusion [greyscale] • Height map - Parallax [greyscale] • Emission - HDR range [RGB] • UV set selection • Detail maps (overlay) • Diffuse and Normal maps • Blended with Mask texture • Opaque, Cut-out, Transparent 39
  40. 40. Detail overlay 40
  41. 41. UV set selection and Masking 41
  42. 42. Normalmap overlay 42
  43. 43. Emission 43
  44. 44. Lighting in 5.0 • Lights • Environment • ambient probe • light probes • default reflection • reflection probes • Lightmaps • HDR IBL 44 Global Localized Diffuse Ambient Probe Light Probes Specular Default Reflection Reflection Probes
  45. 45. Environment lighting • Ties materials into environment • Lights must match surrounding • Exposure • HDR on Main camera • …in scene view • …tone mapping too 45
  46. 46. • Auto generated from Skybox • Directional light • Specular reflection • Ambient probe 46 Light Setups Default, Simple, Out-of-the-Box
  47. 47. • Specify your own IBL texture • Use “Specular Convolution” in Texture Import settings • Setup your own ambient probe • Top, Equator, Bottom • Or script code 47 Light Setups Custom Image Based
  48. 48. • Reflection Probes - convolved HDR Specular cubemaps • HDR Texture import • .hdr and .exr formats • Up to 8K resolution 48 Light Setups Reflection Probes, Light Probes and cubemaps
  49. 49. • Diffuse / Albedo • No lighting information • Metals are typically dark Painted Texture Example 49
  50. 50. • Specular • Defines material type • Small variation among
 dielectrics • Dielectrics are monochrome
 greyscale Painted Texture Example 50
  51. 51. Painted Texture Example • Specular, continued… • Similar hue as Diffuse if metal • Suggested range 40-75 sRGB 
 for non-metals. • 155-255 sRGB for metals 51
  52. 52. Painted Texture Example • Smoothness • Lots of details! • Range between 0.12-.94 52
  53. 53. Painted Texture Example • Occlusion - Cavities, Creases • Mask reflections • Mask indirect bounce 53
  54. 54. Obtaining texture data • Scanned - “scientific method” • Quixel Megatexture, Substance DB, Surface mimic, … • Hand painted • Time-consuming to match values • Need to remove lighting information • Reference charts (DontNod, Quixel, …) • Procedural • Substance, among others… 54
  55. 55. 55 Case Study Procedural workflow with Substance
  56. 56. Substance • Specialize in texture creation tools built around Physically Based Shading • Substance file : streamlined solution for using PBS in Unity • Input doesn’t matter : content packaged as Substance • Automatically connect outputs to shader • Exposed parameters with runtime support
  57. 57. Physically Based Templates • Supports Metal/Rough, Spec/Gloss and Custom PBR • Based on Disney Principled GGX BRDF 
 *cross-checked by AAA game studios
  58. 58. Material Workflow • Material Blending Substance Designer
  59. 59. Material Workflow • Weathering Filters : Propagate effect across multiple channels Substance Designer and Substance Painter
  60. 60. Material Painting • Paint across multiple channels • 100% Non-Destructive • Export to Unity 60 Substance Painter
  61. 61. Substance Database • Growing library of PBR materials as Substances
 • Hand-painted
 • Procedural • Custom database
  62. 62. Custom Tools • PBS Materials
 • Dielectric
 • Metal • PBS Map Validation Custom Nodes PBR Validation Node
  63. 63. Native Unity Support • Reduce texture package size • Change parameters at runtime • Quick texture iterations
  64. 64. Q&A 64

×