CPSC310A Assignment 15 - Anti-aliasing

Due Monday April 2

Details

Modify your C++ ray tracing program to render scenes using anti-aliasing. Anti-aliasing can reduce the jagged edges in a ray traced image by using multiple rays per pixel. The color of a pixel is determined by averaging all of the rays emanating from a pixel.

Create a class that stores an array of random floating point values between 0 and 1 and a current index as member data. The constructor for a random object should take the number of random values to generate and initialize the current index to 0. The random class should also define a method that given a pixel returns the next random point inside the specified pixel. Each pair of random floating point values represents a point in a pixel.

The scene class ray trace method should be updated to create a single random object with a size that is specified with a constant. For every pixel in the final image the ray trace method should use the random object to compute multiple rays with an origin inside the pixel. The color of the pixel should be set to the average of all of the rays with origins inside the pixel.

Submission

Tar your code in a file that contains your name and submit it on the course Inquire site.