Confessions of a researchaholic

November 20, 2011

Ray tracing

Filed under: Real — liyiwei @ 6:43 pm
Tags: ,

Many mentors have their own favorite entry level project for both training and sieving purposes. And mine is ray tracing.

Read + code

Read the following books and implement your own ray tracer from scratch.
Yes, I mean writing every single line of the code yourself, except for standard libraries like iostream and cmath. And yes, I recommend c++ as the programming language.

Ray tracing in one weekend, by Peter Shirley.
Path tracing with soft phenomena. Very short and cute introduction to ray tracing in particular and computer graphics in general. Full of hidden gems and wisdom, but beginners might not appreciate all the nuances.

An introduction to ray tracing, by Eric Haines, Pat Hanrahan, Rob Cook, Jim Arvo, David Kirk, Paul Heckbert, and (edited by) Andrew Glassner.
Whitted-style ray tracing with hard phenomena. More comprehensive than the book above.

You should read the books (especially the first one) on a computer and code along. Do not just read; it is less fun and less effective.
Software engineer your code from the very beginning; ray tracing is nicely object oriented with natural object-like components such as rays, shapes, materials, colors, motions, and cameras.


Produce your own ray traced images. Start with something simple, like mirrors and glasses for basic reflections and refractions. Ultimately, I want to see 2 things:

  • Produce ray traced animations from the BART benchmark. (If you can reach this stage, I consider your training complete. If you cannot even get to this point for whatever reason, you have no chance to survive in our future projects.)
  • Design your own favorite scene, and ray trace it. Show me your creativity and artistic + scientific blend. You can find examples from prior Stanford cs348b rendering competitions.
    (This part can be good for a group project, even though I expect everyone to complete everything else individually.)


I did ray tracing as part of Stanford CS348b image synthesis, and I would say this is perhaps the class that I have learned the most from.
First, ray tracing is a superb training for coding and software engineering; it is inherently modular and suitable for object oriented programming, and the amount of coding is non-trivial (actually, quite hefty for new-comers, especially if you code from scratch).
Second, ray tracing is a superb introduction to image formation, and you will learn the fundamentals of physics, computer graphics, computer vision, and image processing.
Third, and perhaps most importantly, it is heck of fun. It is beyond words for me to describe the satisfaction I (and many people I heard from) derived from producing my first ray traced image. I am not an artist, but I can paint with algorithms.


There is another excellent book for ray tracing: Physically based rendering, by Matt Pharr and Greg Humphreys, but I personal opinion is that you should read it as your second, not first, ray tracing book.


  1. why coding everything from scratch? It is well known that one should not waste time reinventing the wheels.

    Comment by loser — August 18, 2012 @ 7:06 pm | Reply

    • Personally speaking, an engineer only use other’s work, but a scientist should know how to be creative, and he should know this.

      Comment by Zhiyuan Wang — September 9, 2012 @ 5:58 pm | Reply

  2. […] of pure experimentation, I offered ray tracing for FYP. 5 students, divided into two teams, took the […]

    Pingback by » Final year project Confessions of a researchaholic — June 3, 2013 @ 2:09 am | Reply

  3. The BART address does not work now, it is changed to

    Comment by Jia Chen — August 11, 2013 @ 5:38 pm | Reply

    • Thanks. I have corrected the link in the post.

      Comment by liyiwei — August 19, 2013 @ 8:39 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Theme: Rubric. Get a free blog at