# Area-light approximation in 2D

I’m trying to render a 2D image something like this:

…where an arbitrary shape has its border illuminated by a line in a relatively physically accurate way, i.e. with less illumination reaching the shape at points that the line is farther away from. I’m generally familiar with some of the existing approximations in 3D, e.g. linearly transformed cosines; as far as I can tell, though, there’s no literature on ways to do the same in 2D. It seems like there might even be a way to solve the actual integral analytically, but I’m not sure where to start. Any ideas?

## 1 Answer

Found a solution—it may not be strictly accurate for 2D, but it produces the look that I’m after. “Linear Light Shading with Linearly Transformed Cosines”, in section 1.3, describes a closed-form solution to this integral; transforming the line’s endpoints into a space local to the surface and then running them through the I_diffuse_line function from listing 1.6 (modified to use 2-component vectors) yields reasonable-looking lighting.

There’s a copy of the paper available here.