transparency
play

Transparency CS 6965 Fall 2011 Transparency Light is an - PowerPoint PPT Presentation

Transparency CS 6965 Fall 2011 Transparency Light is an electromagnetic wave Some materials conduct energy at visible frequencies CS 6965 Fall 2011 2 Transmitted rays plane of incidence i n r 1 1 1 boundary 2 t


  1. Transparency CS 6965 Fall 2011

  2. Transparency • Light is an electromagnetic wave • Some materials conduct energy at visible frequencies CS 6965 Fall 2011 2

  3. Transmitted rays plane of incidence i n r θ 1 θ 1 η 1 boundary θ 2 t η 2 CS 6965 Fall 2011 3

  4. Maxwell’s equations • Maxwell’s equations relate electricity and magnetism (light) as waves in space • They predict the speed of light in a vacuum: 1 c = µ 0 ε 0 µ 0 : Electric permittivity of free space ε 0 :Magnetic permeability of free space CS 6965 Fall 2011 4

  5. Speed of light • Speed of light changes (slows) in other materials 1 v = µ ε µ : Electrical permittivity of material ε :Magnetic permeability of material v ≤ c CS 6965 Fall 2011 5

  6. Fermat’s principle (1657) • Light takes the fastest path between two points: A t AB = t AC + t BC = C − A + B − C v a v b Simplify: B y = 0 2 + A y 2 + B y C ( ) ( ) 2 2 C x − A x B x − C x t AB = + v a v b 3.00 2.75 B 2.50 t 2.25 2.00 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 CS 6965 Fall 2011 6

  7. A Refraction θ A 2 + A y 2 + B y ( ) ( ) 2 2 C x − A x B x − C x C t AB = + v a v b d C x − A x C x − B x t AB = 0 = 2 + 2 + A y 2 + B y dC x ( ) ( ) 2 v a C x − A x v b B x − C x 0 = sin θ a + − sin θ b θ B B v a v b v b sin θ a = v a sin θ b sin θ a = v a sin θ b v b CS 6965 Fall 2011 7

  8. Index of refraction Absolute index of refraction: c η abs = v where c = 2.99 x 108 m/s. Note: v ≤ c for all transparent materials, so η ≥ 1. Relative index of refraction: η = η 2 η 1 CS 6965 Fall 2011 8

  9. Common values Medium Index of refraction Perfect vacuum 1.0 Air (1 atm, 20° C) 1.0003 Water 1.33 Acrylic 1.49 Crown glass 1.52 Diamond 2.42 CS 6965 Fall 2011 9

  10. Snell’s Law plane of incidence sin θ 1 = v 1 = η 2 = η = η 12 sin θ 2 v 2 η 1 i n r θ 1 θ 1 η 1 boundary θ 2 t η 2 CS 6965 Fall 2011 10

  11. Transmission N V sin θ 1 = η = S 1 = η 2 , S 2 η = S 1 sin θ 2 S 2 η 1 θ 1    cos θ 1 = C 1 = − N ⋅ V    cos θ 2 = C 2 = − N ⋅ T Square both sides of S 1 η = S 2 : V’ θ 2 T -N’ 2 η 2 = S 1 2 S 2 And use S 2 + C 2 = 1 to get cosine forms : ) η 2 = 1 − C 1 ( 2 2 1 − C 2 2 − 1 ( ) C 1 2 = 1 + C 2 η 2 2 − 1 ( ) C 1 C 2 = 1 + η 2 CS 6965 Fall 2011 11

  12. Transmission N V                θ 1 ( ) = k ʹ″ T N + k V N V + ( k − 1) N = − ʹ″ ʹ″ + ʹ″ ʹ″   T = 1     N = C 2 N ʹ″    V’ θ 2 T          -N’ N − ʹ″ = C 2 V C 1 = − N , V , V ʹ″ ʹ″ ʹ″ = ʹ″ V’+N’ k C 1 C 1     = C 2 V V ʹ″ C 1   T k = S 2  = S 2 1 = S 2 C 1  C 2 S 1 S 1 C 2 S 1 V ʹ″ C 1 CS 6965 Fall 2011 12

  13.                Transmission ( ) = k ʹ″ T N + k V N V + ( k − 1) N = − ʹ″ ʹ″ + ʹ″ ʹ″   T k = S 2  = S 2 1 = S 2 C 1  C 2 V N S 1 S 1 C 2 S 1 V ʹ″ C 1 θ 1 2 − 1 ( ) C 1 C 2 = 1 + η 2      = S 2 C 1 C 2 ⎛ S 2 C 1 ⎞ T V − 1 ⎟ C 2 N + ⎜ V’ C 2 S 1 C 1 C 2 S 1 T ⎝ ⎠ θ 2 -N’    = S 2 ⎛ S 2 ⎞ V’+N’ k V C 1 − C 2 ⎟ N + ⎜ S 1 S 1 ⎝ ⎠    = 1 1 ⎛ ⎞ η V η C 1 − C 2 ⎟ N + ⎜ ⎝ ⎠ 2 − 1 ⎛ ( ) ⎞    C 1 = 1 + C 1 η V ⎜ 1 + ⎟ N η − η 2 ⎜ ⎟ ⎝ ⎠ CS 6965 Fall 2011 13

  14. Transmitted ray direction, t (cont’d.) When η 1 < η 2, t bends toward the normal direction at the hit point n i r θ 1 θ 1 η 1 η 2 θ 2 t CS 6965 Fall 2011 14

  15. Transmitted ray direction, t (cont’d.) When η 1 > η 2, t bends away from the normal direction at the hit point n i r θ 1 θ 1 η 1 t η 2 θ 2 CS 6965 Fall 2011 15

  16. Total internal reflection There exists a critical angle, θ c, when the transmitted ray direction t is parallel to the boundary and θ 2 = π /2 θ 2 = π /2 η 1 t η 2 θ 1 θ 1 i r n CS 6965 Fall 2011 16

  17. θ 1 approaches θ c As θ 1 increases, t bends toward the boundary t θ 2 θ 2 η 1 η 1 t η 2 η 2 θ 1 θ 1 r θ 1 θ 1 i … i r n n θ 1 << θ c θ 1 < θ c CS 6965 Fall 2011 17

  18. θ 1 is greater than or equal to θ c When θ 1 ≥ θ c, t is parallel to the boundary and it carries no energy (total internal reflection occurs) θ 2 = π /2 η 1 η 1 t η 2 η 2 θ 1 θ 1 θ 1 θ 1 i r i r n n θ 1 = θ c θ 1 > θ c CS 6965 Fall 2011 18

  19. Checking for TIR Recall that the angle of refraction θ 2 is given by: 1 cos θ 2 = [1 - (1 - cos2 θ 1)]1/2 η 2 CS 6965 Fall 2011 19

  20. TIR occurs when θ 1 = θ c When θ 1 = θ c, the expression: 1 1 - (1 - cos2 θ 1) η 2 becomes zero. When θ 1 > θ c, this expression is negative, so θ 2 is imaginary and t is a complex number. CS 6965 Fall 2011 20

  21. TIR condition Thus, TIR occurs when: 1 1 - (1 - cos2 θ 1) < 0 η 2 CS 6965 Fall 2011 21

  22. Spawning secondary rays t 1 i r 1 c(p) = clocal(p) + kr(p)*cr(pr) + kt(p)*ct(pt) CS 6965 Fall 2011 22

  23. Dielectric shading result = normal lambertian (or other) shading Ray rray = reflect_ray(ray, …); if (tir(ray)) { // kr = 1, kt = 0 result += traceRay(rray, depth + 1, …); } else { result += kr*traceRay(rray, depth + 1, …); Ray tray = transmit_ray(ray, …); result += kt*traceRay(tray, depth + 1, …); } CS 6965 Fall 2011 23

  24. Pseudocode (cont’d.) bool tir(const Ray& ray) { float cosTheta = -ray.direction()*normal; float eta; if(cosTheta > 0) eta = ior_from/ior_to; else eta = ior_to/ior_from; return ((1. - (1. - cosTheta*cosTheta)/ (eta*eta)) < 0.); } CS 6965 Fall 2011 24

  25. Pseudocode (cont’d.) bool Dielectric::transmit_ray(const Ray& ray, …) { compute eta and cosTheta the same as in tir flip normal, eta, cosTheta if cosTheta < 0 tmp = 1.f - (1. - cosTheta1*cosTheta1)/(eta*eta); cosTheta2 = sqrt(tmp); Ray tray(hit_point, ray.direction()/(cosTheta2 - cosTheta1/eta)*normal; return tray; } CS 6965 Fall 2011 25

  26. Implementation notes • There are more efficient ways of doing it than the above pseudocode • If you want to do nested refraction, or if you want the eyepoint in something beside a vacuum, you must track current index of refraction • Directions of the normal matter! CS 6965 Fall 2011 26

  27. Light transport • There are 4 primary ways that light interacts with a surface: • Bounces off (perfect specular reflection) • Absorbed and retransmitted in an arbitrary direction (perfect diffuse reflection) • Travels through surface (perfect specular transmission) • Absorbed and retransmitted on other side (perfect diffuse transmission) CS 6965 Fall 2011 27

  28. Imperfect materials • Most surfaces are not perfectly smooth: CS 6965 Fall 2011 28

  29. Material models Two choices: 1. Simulate microfacets (intractable) 2. Approximate models CS 6965 Fall 2011 29

  30. BRDF Source: surfaceoptics.com CS 6965 Fall 2011 30

  31. BRDF info • http://graphics.stanford.edu/~smr/brdf/bv/ • http://www.cs.utah.edu/~shirley/classes/brdf/ • http://www.cs.princeton.edu/~smr/cs348c-97/surveypaper.html CS 6965 Fall 2011 31

  32. Questions? CS 6965 Fall 2011 32

  33. Texturing CS 6965 Fall 2011

  34. Texture mapping • Most real objects do not have uniform color • Texture: color and other material properties as a function of space CS 6965 Fall 2011 34

  35. Texture mapping topics • Image textures • Texture coordinates • Linear, cylindrical, spherical mappings • Barycentric coordinates for triangles • Software architecture • Procedural textures • Simple: checkerboards, tiles, etc. • Fractal noise based: marble, granite, wood, etc. • Ken Perlin, NYU Bump mapping CS 6965 Fall 2011 35

  36. Lambertian Shading       Compute hit position ( P = O + tV )  Call primitive to get normal (N ) (normalized)    costheta = − N ⋅ V if ( costheta < 0) normal =-normal Color light = scene.ambient*Ka foreach light source   get C L and L       = L   dist= L , L n L    cosphi = N ⋅ L n if( cosphi > 0) if(!intersect with 0 < t < dist ) light += C L *( Kd * cosphi ) result=light*surface color CS 6965 Fall 2011 36

  37. Simple image texture Use hit position to determine image location   P P : hit position y   C : lower left corner of image  x C U : image X axis in world space   Image V : image Y axis in world space x, y: normalized image coordinates (0-1)         P = C + xU + yV    V if U ⋅ V = 0 :       ( ) ⋅ U P − C   x = U       ( ) ⋅ V P − C   y = U V World CS 6965 Fall 2011 37

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