**CS3388 ASSIGNMENT 4**

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:

- render spheres, cones, and planes as generic objects
- implement shading (ambient, diffuse, and specular reflections)
- implement shadowing through the use of shadow rays

To facilitate your work, a C framework for a ray tracer is provided as a starting point. 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, red: RGB = (1,0,0)).
- Code and test the ray tracing algorithm by rendering the pixels for which you have an intersection with the sphere in red. Without shading, the ray tracer should render a red circle within the rendering window.
- Once this is working, add a white light source defined in world coordinates, and implement the ambient, diffuse, and specular components as per the class notes (you will need to compute the intersection point, and the four vectors that are necessary for this). The 3D shape of the sphere should become obvious at this stage
- Place a plane at Z = -1 (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.
- At this point, the sphere does not cast a shadow on the ground plane. Implement shadow ray casting to create that effect.
- The the pixels in the shadow area should be rendered with ambient light only.
- Create a scene that has at least four spheres, two cones, and a ground plane. Choose different positions, sizes, colours, and deformation for the spheres and the cones, The scene should clearly demonstrate that shadowing performs correctly.

Note that there is a 5 transcript marks bonus if you implement object reflections through recursive ray-tracing.

Before submitting your assignment, please refer to the assignment marking scheme and submission guidelines.