Attila T. Áfra's blog about pixels, voxels and threads

Archive for July 2010

Shadows and global illumination

with 6 comments

I’ve been quite busy in the past few months writing my Master’s dissertation (which is about my real-time massive model visualization method), so I didn’t have time to update my blog.

First of all, I’ve implemented shadows in VoxLOD, which has thus become a ray tracer. Of course, level-of-detail is applied to the shadow rays too. For example, this is how the ray traced 354 million triangle Mandelbulb model looks like:

Currently, only point light sources are supported, which cast hard shadows. In the future, I would like to implement area lights too. It’s not easy to render soft shadows with ray tracing at high quality and speed, so I will have to do some research on this.

While shadows make the rendered image a lot more realistic, the parts in shadow are completely flat, devoid of any details, thanks to the constant ambient light. One possible solution is ambient occlusion, but I wanted to go further: global illumination in real-time.

GI in VoxLOD is very experimental and unoptimized for now. It’s barely interactive: it runs at only 1-2 fps at 640×480 on my dual-core Core i7 notebook. Fortunately, there are lots of optimization opportunities. Now let’s see an example image:

Note that most of the scene is not directly lit, and color bleeding caused by indirect lighting is clearly visible. There are two light sources: a point light (the Sun) and a hemispherical one (the sky). I use Monte Carlo integration to compute the GI with one bounce of indirect lighting. Nothing is precomputed (except the massive model data structure of course).

I trace only two GI rays per pixel, and therefore, the resulting image must be heavily filtered in order to eliminate the extreme noise. While all the ray tracing is done on the CPU, the noise filter runs on the GPU and is implemented in CUDA. Since diffuse indirect lighting is quite low frequency, it is adequate to use low LODs for the GI rays.

Here are some more screenshots:

Written by Attila Áfra

July 25, 2010 at 6:14 pm