Raytracer


I have been working on this project for a while now. I got my first positive results yesterday. For those who don’t know what a raytracer is, it is a light simulation program used in computer graphics to achieve a better and more realistic looking output as compared to the other techniques. A raytracer shoots a ray from a said view-point and through every pixel of a viewing plane. These rays return the color of the object they intersect with (black if no object is hit). After intersection with the object they trace the lights to find out if they are in the shadow region of another object. (Shadow region is the region where the light cannot reach the object due to another object in the direction of the light). On the basis of the material’s properties the ray further traces to check for reflections and refractions.

The raytracing algorithm has been criticized for being processor intensive and is hence combined with GPU computing.

I have hosted my project on github. The entire project has been written in C++. Unlike most raytracers, instead of rendering an image of the output, I have rendered it on the screen using OpenGL(2.x). The program also implements an .obj file importer and is capable of displaying the geometry in both, the raytracer output as well as the through OpenGL routines.
The importer uses the winged-edge data structure for the geometry.

The following resources came in pretty handy during the implementation. :

The following is the BSOD as mentioned in the first screen.

zero

The following output is the intersection map of the rays with the objects.

first

This is the output is the combine with the intersection map of the rays with the objects and the shading using the LAMBERT properties for the object materials.

second

Next in the pipeline:

  • Implementing the Ray-Quad intersections for planar objects
  • Reflections
  • Refractions
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s