Blog Archive About

Psychopath Renderer

a slightly psychotic path tracer

2014 - 06 - 28

Low Discrepancy Sequences

As a follow-up to my post about random numbers, I'd like to ramble a bit about low discrepancy sequences.

Low discrepency sequences (or LDS's as I'll refer to them) are deterministic sequences of points in an n-dimensional space that attempt to be as well distributed and evenly spaced as possible. That's quite a mouthful, but the high-level idea is pretty simple. For a more complete introduction to LDS's I recommend reading chapter 7 of Physically Based Rendering: From Theory to Implementation by Matt Pharr and Greg Humphreys (it's an amazing book, by the way, which you should totally buy if you're at all interested in 3d rendering).

But, suffice it to say, LDS's are really useful. In many contexts they can be used as a drop-in replacement for random numbers to reduce variance. In my case, with a unidirectional path tracer like Psychopath, if I plug an LDS where I otherwise would use random numbers, I get some nice reductions in noise.

Random numbers @ 16spp:

Low discrepency sequence @ 16spp:

2014 - 06 - 26

Ray Tracing Micropolygons

I feel like I have a lot of catching up to do blogging-wise. I've been working on Psychopath for quite a while now, and I've learned a lot in the process already. I'd like to write about some of that stuff, so for starters I'm going to make a few posts covering how Psychopath's ray tracing kernel has evolved so far.

As I mentioned in my first post, I started Psychopath with the goal of building a proof-of-concept micropolygon path tracer. From the very beginning that goal guided me to make some atypical choices with Psychopath's architecture, and I've continued to make a few atypical choices as the architecture has evolved.

Here's a fun picture: Colorful Patches

This is an early render from Psychopath. In fact, if you build the earliest commit in the github repo and run the resulting executable, it will produce this image.

But what the hell is it?

It's a bunch of bilinear patches, rendered by first dicing them into sub-pixel-sized polygons and then tracing rays against them. The rendering architecture at this point was basically a direct (but simplified) implementation of the approach described in "Ray Differentials and Multiresolution Geometry Caching for Distribution Ray Tracing in Complex Scenes". It traced one ray at a time, and used a geometry cache to store the results of dicing for use by later rays.

2014 - 06 - 25

Random Numbers

(I'm copying this post over from my personal blog, as it seems relevant. Note that C++11 actually defines a quite robust RNG suite that includes the Mersenne twister. Nevertheless, having a simple, robust, purpose-made RNG class can still be handy.)

For most simulation applications (global illumination rendering being a good example) the included random functions in e.g. most C or C++ standard libraries are insufficient. Moreover, it is important to be able to guarantee that the RNG you are using is consistent across platforms and satisfies specific properties of randomness. Therefore it is generally a good idea, in these applications, to include a custom RNG implementation and use that.

The go-to RNG for such purposes these days is the Mersenne Twister, and as such that is the RNG I've been using in Psychopath up to this point. But the code for it is quite complex. And as it turns out, there are other RNG's out there that are pretty much just as good, but have far simpler code.

Several such RNG's are covered in the short and accessible paper "Good Practice in (Pseudo) Random Number Generation for Bioinformatics Applications" by David Jones. I have opted to use his JKISS generator, which is a variation on George Marsaglia's KISS (Keep It Simple Stupid) RNG.

2014 - 06 - 24

Welcome! And a Little History

A little over three years ago I read the paper "Ray Differentials and Multiresolution Geometry Caching for Distribution Ray Tracing in Complex Scenes" by Christensen et al.

I was inspired.

I was (and am) a huge fan of the Reyes rendering architecture, but the industry was clearly moving away from Reyes towards global illumination ray tracing. I didn't see that as a bad thing—ray tracing clearly has a lot of benefits over Reyes. But Reyes has a lot of cool properties that are lost in that move to ray tracing.

Reading that paper by Christensen et al. gave me the idea that it might be possible to merge both worlds: ray tracing and on-the-fly micropolygons. And I was curious how a renderer built on that paper's algorithms would perform when used as the basis for a path tracer. So I set out to write a simple proof-of-concept, just to see if I could make it work. The idea seemed kind of crazy, so I decided to call the renderer "Psychopath", for "Psychotic Path Tracer". I was just tinkering for fun, after all.

Three years later and I'm still working on it. It's been long enough (and addictive enough) that I'm pretty sure I'm not going to stop any time soon. So I'm making a website for it.