11. Raytracing

Brock University
COSC 3P98 Computer Graphics
Instructor: Brian J. Ross



Back to raytracing


Raytracing


Raytracing

- define objects and light sources in scene
- set up the camera
- for j = 0 to MAXROW
      for i = 0 to MAXCOL  /* cast i,jth pixel's ray */
         - build the parameters of i,j-th ray
         - find all intersections of ray with objects in the scene
         - identify the intersection that lies closest to camera
         - find the colour of light returning to camera along the
           ray from the point of intersection
           - if ray reflects at hit point:
                     determine reflection ray, and recurse
           - if ray refracts at hit point:
                     determine refraction ray, and recurse
         - combine colour of eye ray, reflection ray, refraction ray
         - draw combined color: SetPixel(i,j,colour)
   end


Raytracing

ray = record
   start, dir: vector3D
end;
generic type = (sphere, cone, cylinder, cube, ...);
obj_ptr = ^instance;
instance = record
   kind: generic_type; /* type of object */
   transf: affine3D;   /* 3D transformation for object  */
   nature:... ;        /* surface props, materials, reflect,...*/
   next: obj_ptr;      /* points to next object in scene */
   ... etc ...
end;


Raytracing: intersecting the eye ray with an object


Raytracing


Raytracing


(from [Hill 1990])


Raytracing: POV (Persistence of Vision)


Beyond Raytracing: Radiosity


Raytracing: comments


References



Back to COSC 3P98 index

COSC 3P98 Computer Graphics
Brock University
Dept of Computer Science
Copyright © 2021 Brian J. Ross (Except noted figures).
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/raytracing/
Last updated: April 6, 2021