Monthly Archives: October 2021

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.

New Graphics Books, Fall 2021

Short version: see new book releases here.

Long version: All credit goes to Ibrahim Belabbaci for bringing these new books to our attention. Beyond Ray Tracing Gems II, he sent on five new titles released since June. One’s entirely free to download, and there are nice long excerpts of the rest on Google Books. You’ll see all the links on our page.

I was particularly happy to see that Lee Stemkoski coauthored the free one, Developing Graphics Frameworks with Python and OpenGL. Years ago he put up a marvelous website of three.js demos with clean source code, showing how to do each operation. It’s also nice to see that MIT Press is publishing more books on computer graphics. Anyway, go take a look at the updated page. Covers below.