In this project, I improved my ray tracer from project 2 with anti-aliasing, soft shadow and refraction.
Explanation of Algorithms
I did anti-aliasing in this project by super-sampling. Instead of sending out 1 ray to each pixel location, I send out 4 rays and average the result.
To simulate soft shadow, I model lights by spheres. Instead of sending out only 1 shadow ray, I send out multiple shadow rays. The rays are generated randomly by picking random points on the sphere. The color contribution is for each shadow ray. The final color is the average.
To simulate refraction, I add new fields to RayObjElement that speciy whether the
Close up image of a sphere without anti-aliasing and with anti-aliasing (4 rays per pixel).
Full image of a sphere without anti-aliasing and with anti-aliasing (4 rays per pixel).