raynotes

raynotes - RayTracer:trace ->RayTracer:rayThrough:...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
RayTracer::trace ->RayTracer::rayThrough: ->RayTracer::traceRay ->scene::intersect: did the ray hit anything? if so, what are the location and normal vector? V N L is direction to light source R Direction of the ray that is sent out through the image plane Normal returned from object hit Compute from V and N, p161-2 text
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
RayTracer.cpp if( scene->intersect( r, i ) ) { // YOUR CODE HERE // An intersection occured! We've got work to do. For now, // this code gets the material for the surface that was intersected, // and asks that material to provide a color for the ray. // This is a great place to insert code for recursive ray tracing. // Instead of just returning the result of shade(), add some // more steps: add in the contributions from reflected and refracted // rays. const Material& m = i.getMaterial(); return m.shade(scene, r, i); •}
Background image of page 2
•->compute rays for reflection and refraction given surface normal and material properties (index of refraction) by calling traceRay recursively, up to the depth limit. Compute appropriate contributions to the total return color value.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/21/2009 for the course CPSC 478 taught by Professor Hollyrushmeier during the Spring '05 term at Yale.

Page1 / 9

raynotes - RayTracer:trace ->RayTracer:rayThrough:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online