Experiments in Ray-Tracing, Part 1

I was bored the other evening, so I decided to knock together a little ray-tracing application in C#. I’ve always wondered a couple of things about ray-tracing:

  1. How fast can you make a ray-tracer?
  2. How easy is it to code a tracer that produces realistic images?

(You might think it’s a little odd to be trying to write a fast ray-tracer in C# – but realistically, a C++/assembler implementation would only be a few times faster – so I can get an idea of how fast it could potentially be, while keeping the fast development environment of .NET).

I’m going to write a series of articles about how I’ve coded it so far, but to answer those two questions first:

  1. I can render approximately 200,000 anti-aliased, ray-traced pixels per second in pure C#, and,
  2. Writing a ‘standard’ ray-tracer really is easy… writing an optimized one is trickier… and writing a photo-realistic one is going to take me more time.

Here’s where I’ll be going in the first set of articles:

(I’ve doubled the size of the pixels so you can get a better idea of what’s being produced).

Yes – it’s shiny balls on a chessboard. There’s a reason that’s the first image everyone produces in a ray-tracer – but I’ll get onto that later.

2 Responses to “Experiments in Ray-Tracing, Part 1”

  1. Part two is now available:

    http://www.hackification.com/2008/07/13/experiments-in-ray-tracing-part-2/

  2. [...] I’ve designed my materials to be nested, so that for example to produce the shiny balls in part one, I nest the materials as [...]

Leave a Reply