For this assignment I extended pbrt. The objective was to make an area light source that varies spatially as well as directionally. I decided to implement a non-physical light source that has a virtual light inside/behind an area light. In other words, An area light that emits light as if there was a small light source at the light's local origin which is shining through the body. Here is a diagram:
This model computes the color at each point on the light (translucent filter color) by doing a lookup in a texture map. This color is then attenuated based on the originToSurfacePosition vector and the w vector. This is done such that looking straight through the surface at the origin yields the brightest spot, but other areas are also illuminated.
Doing this assignment I ran into two technical problems with pbrt. The first was that the pbrt distribution includes binary versions of the OpenEXR library. Unfortunately, these libraries do not work for gcc-4.x, so I needed to get the libraries separately installed and modify the pbrt build to use them. (trivial changes in the makefile). The other technical problem resulted from the fact that the AreaLight object needs to be the base class for any new AreaLight objects, but it is in a module and not automatically build into the system. This results in dynamic linker errors if one tries to load a base class without loading AreaLight first. One logical solution to this was to move area.cpp from lights/ to core/ and thus have it always included. This unfortunately breaks the use of AreaLight elsewhere, but allowed me to safely sub-class it.
Note: area.cpp must be moved from lights/ to core/ for this to work. Read the above problems section for a description of why.
source code