## CS779: Assignment 2

You may work in pairs.

### Overview

For this assignment you are required to implement the progressive radiosity algorithm for solving the classic radiosity equation. You should extend your assignment 1 raytracer to do this assignment - we have deliberately designed the details to make that possible. Details of the math behind the algorithm appear in the lecture notes, as well as the notes for lecture 8. We will give you ate least one scene file (in the same format as assignment 1) designed for use with this assignment. You have succeeded if you can generate an image that has all of the hallmarks of a radiosity solution for the scene. In this case look for color bleeding, soft shadows and illumination on the ceiling.

### Details

The scene we give you will consist only of diffuse surfaces and area light sources. It will be highly triangulated, so you can work directly with the mesh we give you. (For better results, however, you can implement an adaptive algorithm.)

You should augment your raytracer to include fields for the residual and radiosity estimate at each triangle, and the means to store radiosity at vertices (which will be explained below).

Implement the version of progressive radiosity that shoots from areas to vertices, and then averages vertices to get patch (triangle) radiosities. Hence the need to stroe radiosities at vertices.

You should use the monte-carlo ray casting method to estimate form factors. The form factors required will be from receiving vertices to the source patch at each iteration of the algorithm. Shirley's book "Fundamentals of Computer Graphics" includes methids for sampling points inside triangles for the purpose of choosing the rays to cast. Your raytracer should provide the remaining infrastructure.

Generate the final image by ray-tracing the triangles and interpolating the vertex radiosities. Or, for great results implement the gather operation for each visible point.

Get the basic version working first. Then consider ways to improve it if you are interested. Adaptive meshing is probably the best extension to try. Look for places where the radiosity varies greatly across a triangle, and subdivide it for the purposes of receiving. Consult Prof Chenney before trying this.

### Supplied Materials

You can get the test scene here.

We are also providing a progressive radiosity previewer.  The rendering is in OpenGL not ray traced but it will give you an idea of what the lighting should look like.  Please note that the previewer ignores vertex normals and uses the polygon winding order (clockwise in this case) to determine front vs back faces.  The previewer takes the scene file to render and the horizontal resolution of the output as arguments.

The previewer may need to run for several minutes before the lighting effects can be seen.  There is a rendering that required the better part of an hour to produce here.