Thursday, August 8, 2013

[Michael] Radiosity Update

So I spent the morning and a portion of the afternoon reading different sources on radiosity and implementing a new feature in G3D: automatic subdivision of triangles until a threshold edge length is met by all edges. See it here on the Cornell Box with a threshold of  0.45 meters (all edges are less than that).
The next thing I worked on was the "form factor" part of the radiosity algorithm (described here). It basically describes the fraction of energy that leaves one patch of surface and arrives at another, given that the energy scatters diffusely. I treat each triangle in the scene as a patch, and compute form factors between all patches. I then multiply the form factor by the visibility function (which I treat as 1 or 0 for now, depending on whether the center of the patches are visible from each other. To get more accurate results, I can either subdivide the triangles more or implement a stochastic approximation of visibility.

Anyway, I can visualize the form factors for any given patch. I diplay the patch values as GL_POINTS in the center of the patch. The red dot is the center of the patch I am currently visualizing the form factors for, and the other dots represent the magnitude of the form factor for the other patches paired with the selected patch. Brighter means higher form factors.

Note the values aren't purely form factors, I also combine with visibility before display: see how the back left is all black where the tall box blocks the line-of-sight to the red patch.

Finally, I actually implemented radiosity... I chose a progressive variant that evaluates a bounce at a time.

Here's a gif of 0-3 bounce illumination using this technique (displayed in the same way as the form factors... as GL_POINTS at the center of the patches).

You can see it starts out with almost everything black (besides a few patches in the top at the emitter, which are hard to see over the bloom of the direct light). The first bounce is direct illumination, and illuminates most areas (though not those in direct shadow. After the next bounce, you can start to see color bleeding on the sides of the boxes.

Next up: pushing the radiosity values out to vertices and doing a full render.

No comments:

Post a Comment