1 / 10

Ray Tracing

Ray Tracing. Ray Tracing. Highly realistic Considerable computation time. Ray Tracing. prp. Ray Tracing. ambient light: k a I a diffuse light: k d (N.L) specular light: k s (H.N) ns specular reflection direction: R = u-(2u.N)N

Download Presentation

Ray Tracing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ray Tracing

  2. Ray Tracing • Highly realistic • Considerable computation time

  3. Ray Tracing prp

  4. Ray Tracing ambient light: kaIa diffuse light: kd (N.L) specular light: ks (H.N)ns specular reflection direction: R = u-(2u.N)N T = [(hi/hr) cos qi - cos qr] N - (hi/hr)L cos qr = √1 - (hi/hr)2 (1-cos2qi ) reflected light R L shadow ray T qr N qi hr H hi u incoming ray (viewing direction V = -u)

  5. Ray Tracing main() { Select prp for (each scan line) for (each pixel in scan line) determine ray from prp through pixel pixel = Trace (ray, 1) } Trace (ray, depth) { determine closest intersection of ray with an object if (object hit) compute normal at intersection return Shade( closest object hit, ray, intersection, normal, depth) else return background_value } Shade ( object, ray, point, normal, depth) { color = ambient term for (each light) Sray = ray to light from point if (N.L>0) compute how much light is blocked by opaque and transparent surfaces, and use to scale diffuse and specular terms before adding term to color if (depth < maxdepth) if (object is reflective) Rray = ray in reflection direction from point Rcolor = Trace (Rray, depth+1) scale Rcolor by specular coeff. and add to color if (object is transparent) Tray = ray in refraction direction from point if (total internal reflection does not occur) Tcolor = Trace (Tray, depth+1) scale Tcolor by transmission coeff. and add to color return color }

  6. Ray Tracing Ray equation P = P0 + s.u P: any point along the ray P0: initial position vector s: distance of P to P0 u: unit direction vector Ppix – Pprp u = ------------------ | Ppix – Pprp | Initially P0 is Ppix or prp. Update P0 and u at each intersection point on the ray with a surface. y ray path u P0 Ppix x prp z

  7. Ray Tracing

  8. Ray Tracing

  9. Ray Tracing

  10. Ray Tracing

More Related