cs 184 computer graphics
play

CS-184: Computer Graphics Lecture #3: Shading Prof. James OBrien - PowerPoint PPT Presentation

1 CS-184: Computer Graphics Lecture #3: Shading Prof. James OBrien University of California, Berkeley V2016-F-03-1.0 2 Today Local Illumination & Shading The BRDF Simple diffuse and specular approximations Shading


  1. 1 CS-184: Computer Graphics Lecture #3: Shading Prof. James O’Brien University of California, Berkeley V2016-F-03-1.0 2 Today • Local Illumination & Shading • The BRDF • Simple diffuse and specular approximations • Shading interpolation: flat, Gouraud, Phong • Some miscellaneous tricks 2 03-Shading.key - September 12, 2016

  2. 3 Local Shading • Local: consider in isolation • 1 light • 1 surface • The viewer • Recall: lighting is linear • Almost always... 3 Counter example: photochromatic materials 4 Local Shading • Examples of non-local phenomena • Shadows • Reflections • Refraction • Indirect lighting 4 03-Shading.key - September 12, 2016

  3. 5 The BRDF • The B i-directional R eflectance D istribution F unction • Given ρ = ρ ( θ V , θ L ) • Surface material • Incoming light direction ρ ( v , l , n ) = • Direction of viewer • Orientation of surface • Return: • fraction of light that reaches the viewer • We’ll worry about physical units later... 5 6 The BRDF Ideal specular • Perfect mirror reflection 
 Ideal diffuse • Equal reflection in all directions Glossy specular • Majority of light reflected near mirror direction Retro-reflective • Light reflected back towards light source Diagrams illustrate how light from incoming direction is reflected in various outgoing directions. Ren Ng 6 03-Shading.key - September 12, 2016

  4. 7 The BRDF ρ ( v , l , n ) n ˆ ˆ l v ˆ • Spatial variation capture by “the material” • Frequency dependent • Typically use separate RGB functions • Does not work perfectly • Better: ρ = ρ ( θ V , θ L , λ in , λ out ) 7 8 Obtaining BRDFs • Measure from real materials Images from Marc Levoy 8 03-Shading.key - September 12, 2016

  5. 9 Obtaining BRDFs • Measure from real materials • Computer simulation • Simple model + complex geometry • Derive model by analysis • Make something up 9 10 Beyond BRDFs • The BRDF model does not capture everything • e.g. Subsurface scattering (BSSRDF) Images from Jensen et. al, SIGGRAPH 2001 10 03-Shading.key - September 12, 2016

  6. 11 Beyond BRDFs • The BRDF model does not capture everything • e.g. Inter-frequency interactions ρ = ρ ( θ V , θ L , λ in , λ out ) This version would work.... 11 12 A Simple Model • Approximate BRDF as sum of • A diffuse component • A specular component • A “ambient” term + + = 12 03-Shading.key - September 12, 2016

  7. � 13 Diffuse Component • Lambert’s Law • Intensity of reflected light proportional to cosine of angle between surface and incoming light direction • Applies to “diffuse,” “Lambertian,” or “matte” surfaces • Independent of viewing angle • Use as a component of non-Lambertian surfaces 13 14 Diffuse Component l n Steve Marschner Top face of cube 
 Top face of 
 In general, light per unit 
 receives a certain 
 60º rotated cube 
 area is proportional to 
 amount of light intercepts half the light cos θ = l • n 14 03-Shading.key - September 12, 2016

  8. 15 Diffuse Component Comment about two-side lighting in text is wrong... k d I ( ˆ l · ˆ n ) max ( k d I ( ˆ l · ˆ n ) , 0 ) 15 16 Diffuse Component • Plot light leaving in a given direction: • Plot light leaving from each point on surface 16 03-Shading.key - September 12, 2016

  9. 17 Specular Component • Specular component is a mirror-like reflection • Phong Illumination Model • A reasonable approximation for some surfaces • Fairly cheap to compute • Depends on view direction 17 18 Specular Component v ) p N k s I ( ˆ r · ˆ L V v , 0 ) p R k s I max ( ˆ r · ˆ 18 03-Shading.key - September 12, 2016

  10. 19 Specular Component • Computing the reflected direction r = − ˆ l + 2 ( ˆ ˆ l · ˆ n ) ˆ n n r l θ n cos θ n cos θ - l 19 20 Specular Component • “Half-angle” approximation for specular ˆ l + ˆ v ˆ h = || ˆ l + ˆ v || n h l ω e k s I (ˆ different specular term h · ˆ n ) p *Don’t use half-angle approximation in your assignments! 20 03-Shading.key - September 12, 2016

  11. 21 Specular Component • Plot light leaving in a given direction: • Plot light leaving from each point on surface 21 22 Specular Component • Specular exponent sometimes called “roughness” n=1 n=2 n=4 n=8 n=16 n=32 n=64 n=128 n=256 22 03-Shading.key - September 12, 2016

  12. 23 Ambient Term • Really, its a cheap hack • Accounts for “ambient, omnidirectional light” • Without it everything looks like it’s in space 23 24 Summing the Parts R = k a I + k d I max ( ˆ v , 0 ) p l · ˆ n , 0 )+ k s I max ( ˆ r · ˆ + + = • Recall that the are by wavelength k ? • RGB in practice • Sum over all lights 24 03-Shading.key - September 12, 2016

  13. 25 Anisotropy 25 26 Metal -vs- Plastic 26 03-Shading.key - September 12, 2016

  14. 27 Metal -vs- Plastic 27 28 Other Color Effects 28 03-Shading.key - September 12, 2016

  15. Materials: Diffuse 29 Ren Ng Materials: Plastic 30 Ren Ng 03-Shading.key - September 12, 2016

  16. Materials: Paint 31 Ren Ng Materials: Paint 32 Ren Ng 03-Shading.key - September 12, 2016

  17. Materials: Mirror 33 Ren Ng Materials: Metallic 34 Ren Ng 03-Shading.key - September 12, 2016

  18. 35 Other Color Effects darken pure blue to yellow + select = pure black to object color final tone Images from Gooch et. al, 1998 35 36 Measured BRDFs BRDFs for automotive paint 36 Images from Cornell University Program of Computer Graphics 03-Shading.key - September 12, 2016

  19. 37 Measured BRDFs BRDFs for aerosol spray paint 37 Images from Cornell University Program of Computer Graphics 38 Measured BRDFs BRDFs for house paint 38 Images from Cornell University Program of Computer Graphics 03-Shading.key - September 12, 2016

  20. 39 Measured BRDFs BRDFs for lucite sheet 39 Images from Cornell University Program of Computer Graphics 40 Ashikhmin-Shirley BRDF • More realistic specular term (for some materials) • Anisotropic specularities • Fresnel behavior (grazing angle highlights) • Energy preserving diffuse term • Sum of diffuse and specular terms (as before) ρ ( ˆ v ) = ρ d ( ˆ v ) + ρ s ( ˆ v ) l , ˆ l , ˆ l , ˆ Michael Ashikhmin and Peter Shirley. 2000. An anisotropic phong BRDF model. J. Graph. Tools 5, 2 (February 2000), 25-32. 
 https://www.cs.utah.edu/~shirley/papers/jgtbrdf.pdf 40 03-Shading.key - September 12, 2016

  21. 41 Ashikhmin-Shirley BRDF h ) p u cos 2 φ + p v sin 2 φ p n · ˆ ( p u + 1)( p v + 1) ( ˆ ρ s ( ˆ ⌘ F ( ˆ l , ˆ e ) = h · ˆ e ) ⇣ 8 π ( ˆ n · ˆ h · ˆ e ) max ( ˆ n · ˆ e ) , ( ˆ l ) F ( ˆ e ) = K s + (1 − K s )(1 − ( ˆ e )) 5 h · ˆ h · ˆ Light direction ˆ l Viewer (eye) direction ˆ e Specular powers p u , p v Normal n ˆ Half angle ˆ h Specular coefficient (color) K s Parametric directions ˆ u , ˆ v 41 42 Ashikhmin-Shirley BRDF u )2+ pu ( ˆ v )2 pu ( ˆ h · ˆ h · ˆ n · ˆ p ( p u + 1)( p v + 1) ( ˆ h ) 1 − ( ˆ n )2 h · ˆ ρ s ( ˆ ⌘ F ( ˆ e ) = e ) l , ˆ h · ˆ 8 π ⇣ ( ˆ n · ˆ h · ˆ e ) max ( ˆ n · ˆ e ) , ( ˆ l ) F ( ˆ e ) = K s + (1 − K s )(1 − ( ˆ e )) 5 h · ˆ h · ˆ Approximate Fresnel function Light direction ˆ l Viewer (eye) direction e ˆ Specular powers p u , p v Normal ˆ n Half angle ˆ h Specular coefficient (color) K s Parametric directions ˆ u , ˆ v 42 03-Shading.key - September 12, 2016

  22. 43 Ashikhmin-Shirley BRDF ◆ 5 ! 0 ! 5 1 n · ˆ e ) = 28 K d ✓ 1 − ˆ n · ˆ e 1 − ˆ l ρ d ( ˆ 23 π (1 − K s ) 1 − @ 1 − l , ˆ A 2 2 Note: The Phong diffuse term (Lambertian) is independent of view. But this term accounts for unavailable light due to specular/Fresnel reflection. Light direction ˆ l Viewer (eye) direction e ˆ Specular powers p u , p v Normal ˆ n Half angle ˆ h Specular coefficient (color) K s Parametric directions u , ˆ ˆ v 43 44 Ashikhmin-Shirley BRDF 44 03-Shading.key - September 12, 2016

  23. 45 Ashikhmin-Shirley BRDF 45 46 Ashikhmin-Shirley BRDF n v = 10000 n v = 1000 n v = 100 n v = 10 n u = 10 n u = 100 n u = 1000 n u = 10000 46 03-Shading.key - September 12, 2016

  24. 47 Details Beget Realism • The “computer generated” look is often due to a lack of fine/subtle details... a lack of richness. 47 From bustledress.com 48 Details Beget Realism 48 03-Shading.key - September 12, 2016

  25. 49 Direction -vs- Point Lights • For a point light, the light direction changes over the surface • For “distant” light, the direction is constant • Similar for orthographic/perspective viewer 49 50 Falloff intensity 
 here: I/r 2 r 1 Steve Marschner intensity 
 here: I 50 03-Shading.key - September 12, 2016

  26. 51 Falloff 1 / r 2 • Physically correct: light intensify falloff • Tends to look bad (why?) • Not used in practice • Sometimes compromise of used 1 / r 51 52 Spot and Other Lights • Other calculations for useful effects • Spot light • Only light certain objects • Negative lights • etc. 52 03-Shading.key - September 12, 2016

  27. 53 Ugly.... 53 54 Ugly.... 54 03-Shading.key - September 12, 2016

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend