All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Information Report

Category:
## Gadgets

Published:

Views: 14 | Pages: 26

Extension: PDF | Download: 0

Share

Related documents

Description

CSE 681 Reflection and Refraction Mirror Reflection Shiny Objects Perfect mirror in the extreme case Assume this for now mathematics easy for this nice case Reflect the view vector about the normal and

Transcript

CSE 681 Reflection and Refraction Mirror Reflection Shiny Objects Perfect mirror in the extreme case Assume this for now mathematics easy for this nice case Reflect the view vector about the normal and cast a reflection ray Reflection Ray Reflect the view vector about the normal, call it R We already know how to solve this R = -2 (V.N) N + V (note that V is pointing to the object) Ray tracing With Reflection L 2 N2 L 1 R 2 R 1 secondary ray N 1 primary ray Raytracing With Reflection Color shade( ray, recursiondepth ) { c = background color; intersectflag = FALSE; for each object intersectflag = intersect ( ray, p ); Keep track of the depth of the ray tree } if intersectflag is TRUE c = ambient; for each light source compute reflective ray R (or H); c += diffuse; c += specular components; if ( recursiondepth MAXRECURSION) if (object is shiny) compute reflection of the ray, R1; c += Ks * shade( R1, recursiondepth + 1 ); return c; First illuminate the point Don t spawn reflection ray past the pre-chosen tree depth R1 reflects the view vector Add the returned color with a shininess factor Reflection Problem Same issue as the shadow ray - self intersection How shall we perturb the intersection point? In the direction of the reflection vector No epsilon With epsilon Transparency 7 Refraction Transparency depends upon the refractive properties of the material Light bends through some materials 8 Snell s Law Willebrord Snell (Dutch Physicist) determined how light refracts through a medium in Snell s Law The angle at which the light bends is described by the following relationship: θ i : Incident angle θ t : Refractive angle η r : Refractive index of the medium light is entering η i : Refractive index of the medium light is leaving 10 Refraction (Ray Tracing) Since we are following rays from the eye to the light, we refract using the view vector Cast a secondary ray (refractive ray) Incorporate the color from this ray into our shading 11 Refraction How do we compute the refraction vector T? 12 Geometric Construction Project T onto M to get a Project T onto -N to get b a T = a + b b 13 Geometric Construction Assume all given vectors are unit vectors Define vector M that is to N Normalization 14 Algebra Geometric Construction 15 Total Internal Reflection In the equation above, if the term inside the sqrt is negative, then there is no refraction. This is called total internal refraction This happens when light tries to pass from a dense medium (glass) to a less-dense medium (air) at a shallow angle air glass 16 Raytracing Algorithm Shadows, Reflection, and Refraction Color shade( ray, recursiondepth ) { Initialize pixel color to background Intersect all objects If an intersection is found Initialize to ambient shading For each light Shoot shadow ray If not in shadow add diffuse and specular If ( recursiondepth MAXRECURSION) If (object is shiny) Trace reflection ray If (object is transparent) Trace transmittive (refractive) ray Return color } 17 Raytracing Pseudocode Shadows, Reflection, and Refraction Color shade( ray, recursiondepth ) { c = background color; intersectflag = FALSE; for each object intersectflag = intersect ( ray, p ); } if intersectflag is TRUE return c; c = ambient; for each light source shadowflag = intersectshadowray ( p ); if shadowflag is FALSE compute reflective ray R (or H); c += diffuse; c += specular components; if ( recursiondepth MAXRECURSION) if (object is shiny) compute reflection of the ray, R1; c += Ks * shade( R1, recursiondepth + 1 ); if (object is transparent) compute transmittance ray T; c += Kt * shade( R1, recursiondepth + 1 ); //Kt is the amount of light allowed to go through 18 Wavelength Refraction (and reflection) is wavelength-dependent Remember Newton s experiment Where rainbow s come from So, compute separately for each component (i.e., r, g, b) 19 Reflection and Refraction Light is partially reflected and refracted Refractive Index: η = sin φ / sin θ Depends on the object material N θ reflected φ refracted Fresnel Equation The reflectance R of a dielectric depends on the refractive index η of the material and the angle of incidence θ dielectric: a transparent material that refracts light R 0 = ( η - 1 ) 2 / ( η + 1 ) 2, for θ = 0 Depends on the material For example, burnished copper has roughly: R 0,blue = 0.1, R 0,green = 0.2, R 0,red = 0.5 Schlick s Approximation R θ = R 0 + ( 1 - cos θ ) 5 ( 1 - R 0 ), for 0 θ 90 As θ increases, R θ increases R 90 = 1, the light is tangential to the surface θ is always the larger of the internal and external angles relative to the normal (e.g. always the angle in air) Incorporating Fresnel Effect if (p is on a dielectric) then // p is the ray hit point n r = reflect(d,n) // calculate reflection ray r d Cr = shade(p,r); if (d.n 0) then // going into medium: case 1 refract(d,n,η,t); // t is the transmitted ray Ct = shade(p,t); cos = -d.n else //going out of medium: case 2 if (refract(d,-n, 1/η,t) = true) then // no total internal refraction Ct = shade(p,t) cos = t.n else return Cr // just the reflection color 2 2 R0 = (η-1) / (η+1) R = R0 + (1-R0)(1-cos) return R*Cr + (1-R) * Ct 5 case 1 t 22 d n t case 2 Lafortune et al. Fresnel Reflectance The Ray Tree Recursion! R 2 T 3 Eye N 2 T 1 R 1 R 3 N 3 L 1 L 2 N 1 L 3 L 1 R 1 T 1 L 2 L 3 N i surface normal Eye R i reflected ray R 2 R 3 T 3 L i shadow ray T i transmitted (refracted) ray 24 Infinite Recursion Stopping criteria Recursion depth Stop after some bounces Ray contribution Stop if transparency/transmitted attenuation becomes too small Usually do both 25 Recursion for Reflection 0 recursion 1 recursion 2 recursions 26

Recommended

Related Search

Massive Sequencing and Microarray PdfReflection and aerobic exercisePure reflection and accessory reflection (Sarmb6892 questions and answers pdfLeadership and reflectionmb2714 pdf and test enginerefraction exam in st kitts and nevis300135 pdf and test enginenew 210260 pdf questions and answrssap sales and distribution tutorial pdf

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks