The radiosity algorithm we've chosen to model involves raytracing a hemicube around every patch, in the direction of the patch's normal. A hemicube is a 2 steradian view of the world - half of the surrouding environment, corresponding to all that is visible on one side of some polygon (or in our case, patch). The algorithm we're modelling choses to do this by rendering five seperate rectangles that make up half a cube centered at the patch, and then weight them to make up for the deformations from using a cube. Our technique will differ slightly in that rather than rendering a conceptual hemicube, we'll render a hemisphere. To store the hemisphere, we'll use a single image with the hemisphere projected onto it.

We'll need to map direction vectors on the unit hemisphere to (x,y) coordinates in our projection of the hemisphere for our radiosity algorithm. This means mapping some v = <x,y,z> to some p = (x,y). Here are the relationships we've come up with. (s is the size of the projection)

```
v = < x, y, z >   =>   p = ( ((x / ||v||) + 1) * (s-1) / 2,
((y / ||v||) + 1) * (s-1) / 2 )

p = ( x, y )   =>   v = < (x * 2 / (s-1)) - 1,
(y * 2 / (s-1)) - 1,
1 - sqrt( ((x * 2 / (s-1)) - 1)^2 + ((y * 2 / (s-1)) - 1)^2 ) >

```

UPDATE: 6/24/02

Unfortunately, this doesn't provide a uniform mapping between the hemisphere and the plane, and gives us bad distortion around the peripherary that was unacceptable. Instead, we're doing angular fisheye calculations, as explained in Computer Generated Angular Fisheye Projections, by Paul Bourke.

All materials copyright 2002 Harvey Mudd College