Blog Archive About

Psychopath Renderer

a slightly psychotic path tracer

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.

For splitting, I stored the results directly in the scene's acceleration structure (in Psychopath's case, a BVH), modifying the structure in the process.

(If you're confused when I talk about "splitting" and "dicing", I recommend reading the original Reyes paper by Cook et al., which explains the concepts and how they are used together.)

You might notice that there isn't any lighting. That's because at this point Psychopath only did visibility testing. The two different patch colors represent whether the surface normal is facing towards or away from the camera.

It's interesting to see that even in this early version I implemented motion blur. I think that's because I'm an animator. When I think of "important" rendering features, motion blur pops to the top of my list pretty quickly. It always frustrates me to see an otherwise feature-complete renderer that I could never use for character animation, simply because it doesn't support deformation motion blur. So I made that a core part of the renderer from the beginning. (There is, in fact, deformation motion blur going on in that image, though it's masked by the extreme camera motion blur.)

Anyway... so this is pretty much the beginnings of Psychopath. It took me quite a while to even get to this point. I wish I still had the early ray-triangle intersection tests I did, because it's not as if I just sat down and spit this out in a weekend. Even getting this far was a large undertaking that involved a lot of learning and trial-and-error. But this was the point where I really reached my first goal with Psychopath: micropolygon ray tracing.