Depth of field and Perlin noise

This weekend I added depth of field to the ray tracer. Basically it involves perturbing each camera ray slightly based on a lens radius and a focal distance. It doesn't require a lot of code to add it to a working path tracer, and the result is pretty nice:

I also added Perlin noise and created a procedural marble-like texture for the statues:


Just for fun

Just for fun I did a render where the only light sources in the scene are the Lucy statues. With ray tracing this is really simple, I just set the emissive term of the material used for the model to some value, and render the scene using path tracing. The result was kind of cool so I decided to share it:


Albedo correction

Someone commented that the lighting was a bit off in the previous render, and it turns out the albedo was too low on both the statue and terrain. I increased the terrain's albedo to be closer to the 0.25 of green grass, and set the statue's albedo to 0.5. This made the render look a lot more natural and removed the hard shadows:

Note: I lowered the height of the statues a bit to make the scene less crowded (there are still 36 million statues). The increased amount of indirect lighting caused more noise, so for this render I used 2000 samples per pixel giving a render time of 9 hours.


And... a quadrillion

I did some optimizations to the model representation to avoid wasting space, and managed to squeeze the memory requirements for the Lucy model down to 535 MB. I then increased the number of instances to 36 million, reaching an impressive amount of a quadrillion (1e15) polygons. The result (with global illumination):

In this render I've also perturbed the sun ray randomly to give smoother shadows, and added a decal texture to the terrain for more detail (thanks to Mirchiss for complaining about the boring ground). I also added PNG export to the raytracer (earlier I just used KSnapshot), and made a movie zooming in on a single statue from afar: lucy_terrain.avi. The movie is made from 400 frames which are exported separately as PNGs, and then converted to an avi by mencoder. Each frame took approximately one minute to render with 50 samples per pixel.


18 trillion triangles

Just got 2 more gigs of RAM (giving 4g, though only 3.3g are visible due to using a 32-bit OS at the moment), so I had to come up with a nice render to take advantage of it. The scene below contains 640000 instances of the Lucy statue at 28 million triangles, giving roughly 18 trillion triangles (that is ~1.796e13 triangles). Due to the nice O(log N) properties of the BIH however, it only took about 10 minutes to render without any global illumination. Not all triangles are visible in the current viewport though. The entire scene consumes around 2.7g, 960m for the terrain and the rest for the Lucy statue.

Below is another render of the same scene, this time with global illumination through path tracing. This render took 8 hours, though the difference from the render above isn't that big. This is due to the sharp direct illumination from the sun, exaggerated further from treating the sun as a point light.


Natural looking sky

I've now added skylight and sunlight to the ray tracer based on the approach in "A Practical Analytic Model for Daylight". I currently treat the sun as a point light source though, which is not physically correct. Without bilinear path tracing or metropolis light transport though, having such a small and intense light source would lead to large amount of noise in the rendering, so it'll have to do for now. The image below shows an example scene with skylight and sunlight. It's a more detailed version of the terrain used before. I added support for 16-bit greyscale PNGs recently, meaning I could finally load the 16385 x 16385 Puget Sound height map. It's not terribly slow compared to the 4097 x 4097 version, though due to the memory requirements I have to cut off the kd-tree before it reaches the maximum depth, causing each leaf node to have 32 triangles. The code currently intersects the ray against all the triangles in the leaf node, which is a bit inefficient, so I should probably optimize it at some point. At this size the height map consumes 512 MB and the kd tree consumes 384 MB of memory. I'm still using the 4096 x 4096 texture, since the highest resolution would consume 1 GB of memory.

A Practical Analytic Model for Daylight