#'(lambda () 'alexander-fw-lehmann)

Writing a simple raytracer in Common Lisp

Dec 24th, 2008

After stumbling upon Marco Baringer's and Rainer Joswig's Lisp related screencasts I realized how interesting, helpful and informative their contributions have been to me (thanks a lot!) and hence considered creating a comprehensive screencast/tutorial myself.

As I think that screencasts are a great idea to give someone a first insight into a particular topic and because (recently) on reddit there's been lots of discussions about Lisp being only for quantum physicists and the like, I eventually decided to create a tutorial on writing a simple raytracer in Common Lisp.

In my humble opinion, writing a raytracer shouldn't be too sophisticated for novices but allows for unveiling a reasonable amount of the programming language. And as far a the relatively easy mathematics and in particular the background of raytracing are concerned, I have included explanatory slides which will be thoroughly discussed during the tutorial.

Unfortunately I have only very limited time and hence couldn't finish each and everything that I would have liked to see in the tutorial. At the end of the provided screencasts, however, the raytracer is at a stage where basic raytracing and lighting do work.

As the creation of the screencasts and slides really was a lot of work and as I do not claim to be a Lisp uber-professional, I'd of course like to hear from you yet also ask you in advance to forgive me my (lispy) mistakes. The ones that I know about have been mentioned in the subsequent movie respectively. Also, please note that the first part is a neccessary prerequisite to its successors, yet the more interesting stuff starts from Part 2.

Now, the following downloads finally conclude this longish description:

Topic Duration Size Related slides
Part 1 - Linear Algebra 1:10h 142 MB PDF
Part 2.1.0 - Basic Raytracing 1:28h 169 MB PDF
Part 2.1.1 - Basic Raytracing 1:09h 150 MB PDF
Part 2.1.2 - Basic Raytracing 1:54h 289 MB PDF


These two images show examples of what was rendered at the end of the above screencasts (click to enlarge).

Cube Image Sphere Image


The next images are supposed to serve as teasers and show examples of what the raytracer will finally be capable of.

Bunny Raw Image Bunny Smooth Image
Cubes and Sphere Image Textured Airplane Image