Spring 2003 Dr. Reinhard
|
|
Ray Tracer 1.0(diffuse) |
Due: |
|
This simple ray tracer provides the basic functionality
of what makes a ray tracer. We start with a background picture (the sky) and
some basic geometry (3 spheres). After setting up a virtual camera, we
compute a ray for every pixel in our destination buffer (final image). Each
ray must be checked for intersection against all geometry in the scene. The
nearest point of intersection determines the final color of the pixel. In
this simple example, diffuse lighting is computed, where the camera itself is
the light source. |
||
Ray Tracer 1.1(shadows) |
Due: |
|
|
Several improvements since that last version: diffuse materials, lighting and shadowing
computation for an arbitrary number of light sources. The image to the left
was created with Varol’s scene description (Thanx). In the image, the only
primitives used are spheres and triangles. I added another primitive (not
shown): an axis-aligned box. The bounding volume hierarchy is still a
work-in-progress, which I expect to have up and running by Friday (a bit
late… sorry). |
||
|
--Update— (bounding volume hierarchy) (3D File Format Converter) |
||
|
Ok… the bounding volume hierarchy works fine now. The
horse to your left has 39,700 triangles, 2 point lights, a resolution of 800
x 800, and I was able to render it in less than 10 seconds. Another scene
(not shown) has 58,700 triangles, 2 lights, and the same resolution… I was
able to render that in 12.6 sec. Because the scene file(s) are so big, I will not
post them online, but if you want it (them), just ask for them, and I’ll
email them back to you. Email: geduardo@cs.ucf.edu |
||
Ray Tracer 1.2(metals/mirrors) |
Due: |
|
|
The image to the left demonstrates the new feature
of the ray tracer… reflections! A blue
metallic cube is surrounded by three spheres of different colors. The surface
of the box should act as a mirror, and that seems to be working. The program
still needs to calculate dielectric properties before it fully meets this
week’s requirements. It seems that (just like last week) I’ll be a day or two
off schedule. |
||
|
--Update— (dielectrics) |
||
|
Now the dielectric stuff is working. On the left is
a modified scene from Varol’s. It demonstrates both mirrors and reflectance from
a dielectric (the sphere). The way I coded the dielectric behavior of
spheres, it does not check for objects INSIDE the object. I had to move the
glass sphere away from the green one in order for this scene to look correct. |
||
|
This is just another sample of metals and
dielectrics. I can claim that this scene is my own. :o) I made the floor out of “boards” of
different colors. The purpose for this is to show the bending of light through
the dielectric sphere. There is also a reflective (metal) triangle that shows
the sphere from a different angle. |
||
Ray Tracer 1.3(specular reflections) |
Due: ????? |
|
|
This update includes the use of specular reflection. The technique I decided to implement is known as Phong Shading. Specular highlights (shiny surfaces) are computed using the reflected ray as it comes from the light sources. Another techniques involves the use of the half-angle ray “thing”, which gives similar results. |
||
Ray Tracer 1.4(Jittering) |
Due: ????? |
|
|
This update includes the option to eliminate some
“jaggies” by using an anti-aliasing technique known as jittering. In this technique, every outgoing ray (from the
camera) is somewhat distorted in direction by a random value. This will cause
edges to become a little more “fuzzy.” The animation to the left should help
you see the benefits of jittering. Hopefully you’ll notice the difference
although the image is kind of small.
Other anti-aliasing techniques (not yet implemented) are super
sampling, and filtering (more evident when using textures). |
||
Ray Tracer 1.5(textures) |
Due: ????? |
|
|
The new feature to our ray tracer is the ability to
texture diffuse/specular surfaces. I did not implement textures to materials
of type metal or dielectric. It just doesn’t make any sense to me to texture
mirror-like surfaces or see-through ones. A given 2D image is mapped on the
3D geometry by determining the offset onto the image from the point of
intersection. For triangles, this is given by using barycentric coordinates.
For spheres, we use polar coordinates to determine the offset onto the
function. The scene to your left contains 4 point-light sources, and 2
textured spheres. They are textured with a water texture I found. |
||
Ray Tracer 1.6(Fog) |
Due: ????? |
|
|
This feature was not part of the specifications for
the class. I’m just hoping tricks like these can get me a few extra
points. J Anyways… this new feature supports fog
rendering. It simply determines how far away from the camera the
ray-intersection occurred, and the further away, the more “fog color” is
blended to the output color. This can be interpolated in several ways… I did
it the easy way, so it’s interpolated linearly, but there is room for
improvement. I believe this is such a cool effect, that it deserves an extra
2.5 points. j/k |
||
Ray Tracer 1.7(Grids)/(Uniform Spatial Subdivisions) |
Due: ????? |
|
|
This is a speed optimization similar to the bounding
volume hierarchy (BVH). The data structure divides the space in a 3D grid of
boxes, where each box holds information about overlapping geometry. Ray/scene
intersections are sped up by avoiding unnecessary tests with geometry that do
not come close to crossing the ray’s path. For some reason, my BVH generally
performs better than my grid structure.
L At any rate,
this new feature allowed me to render the image on the left (59,000
triangles, 2 point lights) in about 20 secs. |
||
Ray Tracer 1.8(aerial light sources) |
Due: ????? |
|
|
The next feature to the ray tracer is spherical
(aerial) light sources. A light is no longer defined by an infinitely small point
in space. In order to render soft shadows (as a result from an aerial light
source), we must sample the light source throughout its surface several times
before computing the final color. The image to the right sampled the
spherical light 75 times per shadow-test.
I coded the equations exactly as they are in the book. Equation 15.4 from pg. 120, and those from
pages 123 and 124. Since I have yet to program tone-mapping, I had to hard
code some “damping” operator to keep my colors somewhat under control. |
||
Ray Tracer 1.9(tone mapping) |
Due: ????? |
|
|
Our next improvement consists of the support for
tone mapping. For testing purposes, I use a scene made up of 3 lights, where
all lights are RGB(1,1,1). Without tone mapping, our final image would look
either flat shaded (if colors are cropped), or completely messed up if
nothing is done to correct it (shown left). I implemented the basic tone
mapping operator and the slightly less complicated operator. I played around
with the alpha value, to obtain the
results shown to the left (click to enlarge). |
||