CS3388 ASSIGNMENT 4
CS3388 ASSIGNMENT 4
Due date: Monday December 4th 2017, at 11:55pm
Weight: 10% of final mark
This assignment consists of the writing of a simple non-recursive ray-tracing program that creates images of scenes
containing a number of simple generic objects. The ray tracing program must be able to:
The program must create objects (spheres and planes), place and transform them into the scene, and set the synthetic camera and the light source, and
render the scene using ray tracing.
- render spheres and planes as generic objects
- implement shading (ambient, diffuse, and specular reflections)
- implement shadowing through the use of shadow rays
A C framework for a ray tracer is provided as a
starting point. Also, an updated version of matrix.h is necessary to run the program.
A generally efficient approach to complete the ray tracer is to:
- Place the synthetic camera such that its line of sight passes through the origin of the world coordinate system.
Make sure the camera is at a convenient distance from the origin of the world coordinate system such that a sphere
of radius 1 is visible.
- Define a generic sphere with affine transformation matrix set to identity (sphere at the origin with radius of 1) and
simple color attributes (for example, green: RGB = (0,1,0)).
- Code and test the ray casting algorithm (cast the rays and compute intersection points, and normal vectors).
Without shading, the ray tracer should render what would look like a green circle within the rendering window.
- Once this is working, add a white light source defined in world coordinates, and implement the diffuse lighting
component. The 3D shape of the sphere should become visible, however no specular reflection will show on the sphere.
- Place a plane at Z = 0 (that is, also with a transformation matrix set to identity) to create a ground surface,
and render it. At this point the scene should start to look more or less realistic.
- Implement specular reflection and see that you get a bright spot on the sphere consonant with the position of the
- At this point, the sphere does not cast a shadow on the ground plane. Implement shadow ray casting to create that effect.
- The shadow area on the ground plane will appear completely black. Implement the ambient part of the lighting model to
remedy this problem.
- Create a scene that has at least four spheres, in different positions, sizes, colours, and deformation. The scene
should clearly demonstrate that shadowing performs correctly, with the ground plane and other spheres.
Before submitting your assignment, please refer to the assignment
marking scheme and submission guidelines.