UNC-CH Comp238 RayTracer

Written by Bill Baxter 9/9/1999-10/07/1999

Phase 2 (The Assignment)

I'm really pooped right now, so please just read the README. Or browse the source. Here are some images and links to corresponding scene files:

This image shows basic full-scene antialiasing. It was rendered using 9 samples per pixel. Compare with the similar scenes done without anti-aliasing which are at the bottom of this page.

This image exhibits some faint bainding on the ground plane. This happened because at the time I had some code that adding things together AFTER switching to integer values, instead of keeping things in floating point until the very end. So it ended up doing some bucketing. I fixed this, but I thought it was interesting to see what can go wrong with one very slight variation to the code.

An extended light source plus a directional light source. Although behaving precisely as programmed, the directional light appears to cast way too abrupt a shadow, ruining the realism of the soft shadow from the extended light.
Check out the scene file: basicext1.xml

Again the extended light source scene. This time shadowing with the directional light is disabled. Ahh. Much nicer.
Check out the scene file: basicExt_noDirShadow.xml

Texture on triangles. The ground is made of two textured triangles. And of course the triangle standing up is textured too.
Check out the scene file: basic_tritex2.xml

A scene with a glossy reflection. The gloss coeffecient is 0.95. A coeffecient of 1.0 is perfect mirror reflection, while 0.0 is completely blurry. The aliasing towards the horizon shows the painful lack of any sort of mip-mapping
Check out the scene file: basic_gloss1.xml

A slightly better example of glossy reflection, this object has a glossy coefficient of 0.87. The noisyness of the reflection tells us A) that we aren't using a very good sampling function, and B) we could have used more samples (this was 16 samples/pixel).
Check out the scene file: basic_gloss_87.xml

This one shows the effect of varying the glossyness. The sphere on the left has a glossyness of 0.84 and that increases toward 1.0 with the sphere on the far right. Here we used 25samples/pixel.
Check out the scene file: basic_gloss_varying.xml

What happens if you add too many lights!
Check out the scene file: test1.xml

A test of the "noshadow" option. It worked! Nothing is casting a shadow.
Check out the scene file: test2.xml

The textures used as input:

San from Mononoke Hime:

A simple checkerboard:

Phase 1

The first phase in this project was to create a classic ray tracer which is to say one that includes primary, reflected, and refracted rays.  At any particular intersection at most two new rays are spawned: one in the reflected direction, one in the refracted direction.  At this point the only requirements for types of geometry are spheres and triangles.

Here are some images that my ray tracer generated (they are in PNG format so you will need a modern browser that can handle them):

If you (or your browser) don't like PNG then you can find other versions here.

Version 1 Code

Version 2 Code