Pretty Pictures #

hacking, November 13th 2009

Update 2009-11-14: since the snapshot linked below turned out to be broken on x86, you may be better off with the git repos instead.

My first ever Common Lisp project was a raytracer. Unsurprisingly, it wasn't too great. Over time I started thinking about how I would make one that was more lispy, and during last couple of years I've been hacking on one every once and a while.

It's called Raylisp, and while I'm not planning on ever properly releasing it — this is purely a personal toy project — I figured I might still make a snapshop available: it may prove useful to someone wanting to do something like this in earnest.

The tarball contains:

Snapshop of another work-in-progress: SB-CGA, a computer graphics algebra library for SBCL — most suited for x86-64, since there it implements things like matrix multiplication using SIMD instructions. Raylisp uses it, but unlike Raylisp this one may even see a release some day...

Raylisp itself, including: reasonably efficient KD-tree construction and traversal code very very hacky code for reading subsets of .ply and .obj files basic raytracing stuff a simple CLIM frontend on top of the raytracing library



In addition to the KD-tree code, which may be worth stealing and polishing off, I'm putting this up to demonstrate some techniques which may be non-obvious to new-but-performance-conscious Lisp hackers: stack allocation (all over the place), using CLOS objects for the parts that need flexibility and closures for the parts that need to be fast (rendering protocol), and packing data into specialized vectors to avoid GC overhead (KD tree construction.)

(Last time I touched this code was in August, so all the details are not too fresh on my mind — hence the vague tone in this post. I had inteded to do this then, but didn't get around to it until now.)

All the code is under MIT-style license, as usual.