Some time ago I came across an excellent analysis of Andrew Kensler’s minimal ray tracer (a.k.a the business card ray tracer) whose entire source code could fit on the backside of a business card. The output is shown below:
Being stuck at home, sick with a debilitating cold, I thought I’d have a go at building my own business card ray tracer. From the onset, I opted for a path tracer rather than the Cook-style distributed ray tracing approach seen in Kensler’s renderer. Starting from scratch and developing everything from first principles, it took 5 to 6 hours of coding to get to the image below. Admittedly, in my version there is none of the clever stuff that made the original so damn good.
The program is almost twice the size of Kensler’s ray tracer … so probably, unless your business cards are the size of an iPad, you won’t have much luck fitting the path tracer on their back.
There’s still some cruft to be removed from the source code – towards the end, I seemed to be caring less about making the program as compact as possible and more about getting it over with. I can certainly shave off a good deal of space by simplifying the scene to just the ground and lettering. I will have to revisit it eventually. Soon. Hopefully. The source code is available on GitLab and Pastebin.
The slideshow below shows some variations in the lettering I experimented with during the development of the BCPT.