ray tracing assignment
play

Ray Tracing Assignment Goal is to reproduce the following So You - PDF document

Ray Tracing Assignment Goal is to reproduce the following So You Want to Write a Ray Tracer Checkpoint 6 Refraction Whitted, 1980 Ray Tracing Assignment Ray Tracing Assignment Seven checkpoints Seven checkpoints Setting


  1. Ray Tracing Assignment  Goal is to reproduce the following So You Want to Write a Ray Tracer Checkpoint 6 – Refraction Whitted, 1980 Ray Tracing Assignment Ray Tracing Assignment Seven checkpoints Seven checkpoints    Setting the Scene  Setting the Scene    Camera Modeling  Camera Modeling  Basic Shading  Basic Shading  Procedural Shading  Procedural Shading    Recursive Ray Tracing – Reflection  Recursive Ray Tracing – Reflection  Recursive Ray Tracing – Transmission  Recursive Ray Tracing – Transmission  Tone Reproduction  Tone Reproduction   Refraction Recursive Ray Tracing color illuminate (ray, depth)  Perform recursive ray tracing by find closest intersect considering reflection and refraction if (!intersection) return background color else  Parameters to add: spawn shadow ray  For each object retcolor = local illumination if (depth < MAX_DEPTH)  k r , k t – reflection and transmission constants if (k r > 0)  k t ≠ 0 for this checkpoint spawn reflection ray retcolor += k r * illuminate (reflect ray, depth+1)  Index of refraction (example 0.95) if (k t > 0) spawn transmission ray retcolor += k t * illuminate (trans ray, depth +1) return retcolor 1

  2. Total Internal Reflection Recursive Ray Tracing Calculating Transmission Ray For each pixel Starting with Snell’s law d n � i spawn ray from camera pos to pixel η sin θ = η sin θ � i i i t t pixel_color = illuminate (ray, 1) η t θ Assume d and n are normalized. t t We can find the equation for t, the transmission ray: d is the incoming ray, t is the 2 η ( d − n(d • n) ) η ( 1 − ( d • n ) 2 ) transmission ray. i i t = + n 1 - 2 η η t t If negative – total internal reflection Total Internal Reflection  an optical phenomenon that occurs when light is refracted (bent) at a medium boundary enough to send it backwards, effectively reflecting all of the light.  In these cases, the transmission ray will be spawned in the reflection direction. Wikipedia Total Internal Reflection Calculating transmission ray  Snell’s law applet  http://www.physics.northwestern.edu/ugrad/vpl/opt ics/snell.html  Index of refraction of air = 1.0  Optimization  If indices of refractions are the same Total internal reflection occurs around boundary of  no bending  Transmission direction is the same as incoming direction transparent sphere 2

  3. Things to think about Things to think about  Must keep track if you are inside or  2 ways to deal outside  If n • d < 0 then  Inside Index of refraction  Use –n as normal for calculations η  Use inside η as � i Normal vector  Keep track as you are spawning rays Things to think about Refraction public Vector3f faceForward (Vector3f A Vector3f B)  For sake of checkpoint {  Make one sphere transparent (k t = 0.8) // For acute angles, dot product will  Make other sphere non-transparent // be positive if (A.dot(B) >= 0) return A;  May wish to test first with index of refraction = 1.0 // Obtuse angle, reverse the first vector Vector3f V = new Vector3f (A); V.scale (-1.0f); return V; } Refraction Refraction  Note:  Due date:  If done correctly, you should now have a faithful  Must be posted to Web site by May 2nd reproduction of the target image.  Recall:  Sample parameters  10% penalty per day  Sphere1 – front  Sphere2 – rear  Having trouble?  Color (amb/diffuse)  Color (all) = white (0.7, 0.7, 0.7)  Ka = 0 .0 7 5  Let me know EARLY.  Color (spec) = white  Kd = 0 .0 7 5  Ka = 0 .1 5  Questions?  Ks = 0 .2  Kd = 0 .2 5  Ke = 2 0 .0  Ks = 1 .0  Kr = 0 .0 1  Ke = 2 0 .0  Kt = 0 .8 5  Kr = 0 .7 5  Kt = 0 .0 3

  4. Extra extra  For 5 points:  Adjust shadow ray based upon transparency of objects. 4

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