A spherical light source can provide more realistic illumination than a traditional point light because it gives the light an actual size and shape. The usual way to render a sphere light is to use an area light shader with sphere geometry. That approach works, but it has some drawbacks:
- Render time can be significantly slower because the area light shader must be evaluated at many different locations on the sphere to produce a smooth result.
- Some software (such as Massive) does not provide an interface for area lights.
To address those drawbacks we’ve put together a spherelight light shader that can be used to simulate the effect of a spherical light source using a standard point-type light. Download the shader and sample scene files here:
http://www.sitexgraphics.com/spherelight.zip
The shader is very similar to the pointlight shader included with Air. There is a new lightradius parameter for the radius of the (virtual) spherical light source. The shader uses the light radius in a couple computations that approximate the effects of a spherical source:
- Shadows are blurry close to the source and sharper farther away. The shader simulates this effect by computing a shadow blur angle based on the distance to the light source and the light radius:
lenL=max(sqrt(L.L),radius); blur = abs(atan(radius,sqrt(lenL*lenL-radius*radius)));
- For locations close to the sphere surface, the light source no longer behaves as an idealized point light. The shader accounts for this by supersampling the sphere surface (in the spherefactor() function) to account for the variation in incoming illumination from different parts of the sphere surface.
The images below compare the results for a true spherical area light (top) with 64 light samples and the spherelight shader (bottom) using 64 shadow rays.