F
inal
P
roject
Raytracer
with Antialiasing, Soft Shadows, Glossy Reflection and depth of field
For
my final project, I have extended the Raytracer to
support depth of field, Antialiasing, glossy reflection and soft shadows.
Antialiasing
This method is used to improve quality in images.
For Antialiasing I used the method describe
in the book.
To be more exact I used the
subpixel jittering algorithm with each subpixel being sampled randomly after
subdivision. So what this does is instead of just getting the color of one
pixel, the algorithm subdivides the pixel in a grid and treats each subdivision
as a single pixel and at the end it gets the average color of all the
subpixels. The number of subdivisions that I used for the ray tracer is 4x4
grid
and the range of the random numbers is between 0 and 1.
No antialiasing with antialiasing
Depth of Field
Depth of field is when a lens focuses on a subject at a
distance,
all subjects at that distance are sharply focused. Subjects that are not at the
same distance are out of focus and theoretically are not sharp. For
convenience, in my ray tracer I used the same number of jittered rays for the
camera as the number of rays for antialiasing. The amount of jittering is set
on the input file as part of the camera options. To get nice result the radius
of the lens must be set to 0.01 – 0.5.
Without Depth of Field front ball out of focus back balls out of focus
Soft
Shadows
Shadows are implemented by generating a secondary shadow
ray from the intersection point to all the light sources and checking whether
there are some other objects intersecting with the shadow ray or not.
I have implemented
Soft Shadows as it was describe in the book. This threats a point light as an
area light.
To generate soft shadows, multiple shadow rays are generated
towards a couple of jittered light sources around a certain light source. The
returned illumination colors are averaged and assigned to the intersection
point.
No Soft Shadows
Soft Shadows
Soft Shadows
and Antialiasing
Glossy
Reflection
Glossy refection work the same way as soft shadows but instead of jittering the ray coming from the light, the reflected ray is jitter. This is to simulate the reflection that is created from materials not are not perfect mirrors like metals.
No Glossy Reflection Glossy Reflection
I
Also
have texture mapping and bump mapping
Texture
mapping and glossy reflection
Texture mapping and bump
mapping
Another thing that I was thinking of adding to my ray tracer was path tracing and photon mapping but this didn’t work here is my attempt.
And finally my final image