Ray Tracer

This ray tracer was a project for my Computer Graphics II course. I implemented a number of optional features, such as supersampling and additional lighting models. I also extended the project by adding support for multithreading.

Features

  • Reflective & Refractive Surfaces
  • Procedural Textures
  • Supersampling*
  • Texture Mapping From Image*
  • Phong, Blinn-Phong*, and Strauss* Lighting Models
  • Multiple Light Sources*
  • Spheres, Planes, Cylinders*, and Triangles*
  • Multi-Threaded Rendering* (through Task Parallel Library)

(*) denotes an optional feature that was implemented

Implementation (C#)

I chose to implement the ray tracer in C# 4.0, and I use the Task Parallel Library to support rendering on multiple threads. The scene is rendered to a Bitmap, and then displayed in a WinForm. I use Bitmap.LockBits() to obtain a pointer to the bitmap data so that it can be modified directly. This avoids the overhead of repeatedly calling Bitmap.SetPixel().

Media