Back of the Business Card Ray Tracers

Basic ray tracing is a simple algorithm. As sometimes given as proof, there are two business card ray tracers I know of: Paul Heckbert’s and Andrew Kensler’s. You can see Andrew’s explanation here (as well as links to ports), the leet code here, and an involved revisit and optimization and CUDA-ization of this code by Fabien Sanglard here.

Andrew’s dates from somewhere during 2005-2009, when he was avoiding writing his thesis. Paul’s dates from 1987, including tricks he learned from Darwyn Peachey and Joe Cychosz. His links are here, the code’s here and unminimized here, and the whole thing is written up in Graphics Gems IV. Which I wish was free on the (legal) web at this point… But through the miracle of Google Books, you can find most of the article here and missing page 379 (just the code listing) here.

Yesterday I realized I likely had never seen the output of Paul’s ray tracer. I installed Ghostscript to look at his file, but it was pretty beat:

Yeah, definitely ray tracing, or something

So I compiled Paul’s minimized code, finding a few small syntax errors that VS 2019 didn’t like so much. Adding a PPM header to the image file dumped, it’s this:

32 x 32

So, better, I can see spheres. I upped the resolution – it took a whole 10 seconds to run on a single CPU:

1024 x 1024

Not stunning, but now I know!

And today I ran across a set of lecture slides from the University of Utah which shows both of these business-card ray tracers’ results, page 22 on. Oddly, the image shown there has different colors – maybe gamma correction or something?

Anyway, now you can say you’ve seen it, too. And here’s the back of my copy of Paul’s business card, in the flesh, as it were:

Me, I was thrilled that 34-year-old code basically still ran, with minimal messing about.