CS688 Final
Project: Ray Tracer
Jie Xu
CGL, University of
Waterloo
Statement
Based on the assignment 4, I
implemented a ray tracer and used it to render a scene. To render a
scene of Escher's impossible world, I'll use CSG modeling to construct
the buildings, apply texture mapping and bump mapping to the surfaces
of
walls, floors etc. Soft shadow and fuzzy reflection will be used to
improve the result. I'll also implement fish eye to provide especial
effects.
Objective 1: New primitives
I add such new primitives: cylinder,
cone, torus.

Objective 2: Hierarchical bounding box
To improve the performance, a new
property bounding box is added. The bounding boxes of all objects in
the
scene are composed of a tree, I travers the tree from root to leaf.

To render the forward scene, it will
cost 1120 seconds without bounding box, and 16.72 seconds with bounding
box. There are 25000 rays, and only 275 rays intersect with the model.
To speed up the processing, I'll set the bounidng box on to render the
following objects.
Objective 3: Aniti-aliasing
Using super sampling and stochastic
sampling to anti-aliasing. I first sampling the four corner sub-pixels
of a pixel. If their color values aren't equal then I randomly select 5
sub-pixels in this pixel, and average the result value.


The first one without anti-aliasing,
it costs 11.02 seconds. The second one with anti-aliasing, it costs
70.23 seconds
Objective 4: CSG modeling
Using CSG modeling to construct
complicate models. And the CSG operations can be composed to a CSG tree.

Objective 5: Fuzzy reflection
I use distribute ray tracing to
generate fuzzy reflection. For each reflection ray, I add ten random
rays around it to trace.


The first one is sharp reflection. The second one is fuzzy reflection.
The chess board texture is generated using solid texture method. Stone
texture is mapped to the pillar object.
Objective 6: Texture mapping
An image can be mapped to an object.
Solid texture is also implemented. I use Perlin
noise function to generate texturel.
I
mapped such images to objects.

I use 3D Perlin noise function to
generate marble texture.

The following figure is refraction
with solid texture.

Objective 7: Bump mapping
Using bump mapping to simulate the
texture of walls, ground. I first transfer a bump image to
grayscale image. then compute its gradient. The axis of parametric
surface can be computed by rotating standard coordinate. The following
is stair rendered using bump mapping and texture mapping.

Objective 8: Fish eye
The view plane is a hemi-sphere. It
will distort the scene.

Objective 9: Soft shadow
Using area light to get soft shadow.
I use a sphere light source. There are 15 point light sources
distributing on the sphere surface equally.
The tower is rendered with texture mapping and soft shadow.

The following scene is rendered with soft shadow, texture mapping and
bump mapping.

Objective 10: Final scene -- Escher's
impossible world
My Final scene is rendering a scene
that is similar with the Escher's impossible world "ascending and
decending".
Escher's scene is the following figure:

First, I construct the models of different buildings.
The following building is rendered using texture mapping and soft
shadow.

This building is rendered using texture mapping and bump mapping.


Now, this is my final scene. It is very similar with Escher's painting.
It is rendered using all features.

another result is using fish eye. It gives us an exaggerated scene.

Now, we view the scene from another viewpoint so we can find where is
the trick.

Extension: Distortion
Though the fish eye can distort the scene, the result isn't quite good,
because it changes the whole scene. The following figure is a
painting of Escher. It only distorts the centre of the scene.

To implement it, I first select project the centre part to a sphere.
The following is the result:

But we can see it is poor at the edge of the sphere. So I select
another curve surface:

The result shows that it is similar with Escher's painting.
