Michael Belshaw

Home | About | Contact
Computer Vision |3D Tic-Tac-Toe | Fairings | Hover Craft | Portal Engine | Ray Tracing | Robotics | Star Tracker | Tube Guitar Amp
Long Exposures
Music Sequencing
subglobal5 link | subglobal5 link | subglobal5 link | subglobal5 link | subglobal5 link | subglobal5 link | subglobal5 link
subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link
subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link

Ray Tracing

small logo

Intro

The summer of 2002 I designed and coded a Raytracer. My main mission was to understand how this 3D rendering method worked.

In December 2004 I was trying to learn more about C++ and decided to write another Raytracer. This Raytracer allows for reflection rays to collect reflected light from the object, unlike the Java version. I decided to write some 24bit bitmap reading and writing function to make the code a little more straight forward. Here is an exe for you to run. Raytracer.zip

 

 

 

Images from C++ Raytracer

So far this C++ Raytracer has motion blur, texture maping, antialiasing, depth of field, reflections. I would like to build a key framer to produce anamations.

 

Here is an animated gif of a sphere moving. (click image above)

This image shows multiple reflections, different coloured lights, and different coloured spheres.

Motion Blur was used on the smaller middle sphere. Also,antialiasing was performed using oversampling with random variations in the initial ray direction (camera jitter).

Depth of field was added by using a focuse distance point, the point where objects in initial rays path should be in complete focus, and perturbing the camara point. A new ray from perturbed camera point to focus point was sent to raytracer function for each pixel on screen. Oversamping was also used to create smoother imiges This is an animated GIF in the below linked picture showing different focuse distances. The moving sphere has more speed in these rendered images compared to the previous one to the left.

Figure above shows focus point being chosen and camara being jittered to create depth of field errect.

Texture maps have been added to create the image above. Textures are stored in bitmap files and are used instead of the objects colour. This image also has a camara with a short depth of field focusing on the upper right sphere.

 

 

Images from Design and Testing Java Raytracer

 

Features Coded into Java Ray Tracer:

  • seens load from file
  • multiple lights
  • texture mapping (simple implementation with only one texture)
  • bump mapping - (simple iplementation using randoming functions)
  • intencity reduction dependent on distance from camara
  • reflections (errer in this feature caused by objects reflecting off themself)

 

Future Improvments and Modifications in Java raytracer:
  • fix reflection rutean
  • allow plane object to displayed with normal pointing in all directions (currently only visible if oreanted with normal towards camara)
  • add fall off distance from lights
  • add reflective attribuetes to objects
  • design a "keyframer" to produce anamations
1. Diffuse Shading Only – light at infinite distance

2. Diffuse Shading Only – point light

3. Diffuse and Specular– note shadows present

4. Multi Objects – plane introduced as second object type

5. Same as previous with different light positions

Frame

6. Experimenting with different planes and lights

Frame

7. This is a close to eclipse rendering – Light is in the top left of the image almost behind the center sphere

Frame

8. Error with light ray intersection found – left picture has light directly behind green sphere (seen on right). When checking for intersection, algorithm did not check if the direction of object was the same direction as the light ray.

9. Multi lights added – note problem with shadows - full shadow for one light only

10. Simple textures were applied

11. A larger, more complex rendering of previous

12. Differently colored lights and objects

13. Final image obtained - some random bump mapping is present

Skirt segments attached

 

About | Contact Michael Belshaw | ©2008