Methods and Techniques for Lighting Hair: Point Lights, Spot Lights and Shadow Maps
Author: Kim Aldis (http://www.aldis.org.uk)
In my previous post, it became clear that area lights with shadows aren't much good for hair unless you simply want a single frame for a "beauty shot" or you can afford the render times. Point lights are cheaper than area lights but give hard shadows that are often undesirable. You could use shadow maps with point lights, but they tend to give a hard light to the surface. Also, shadow map usage with point lights mean that the size of the umbra doesn’t vary with the distance of object to the shadow receiving surface, which can lead to a the object appearing to float above the surface. A better choice for shadow maps is spot lights, which I discuss a little later.
Instead of using shadow maps with point lights, you could use a rectangular grid of lights, which can help diminish the floating effect as well as give a softer overall surface light. Although the increased light count will lead to increased render times it’s still more efficient than area lights, making point lights an acceptable compromise to area lights.
|
|
It’s worth noting that in the case of both soft and hard lights it’s the shadow calculation that really pushes up the render times although considerably more so in the case of soft lights. Soft light shadowing increases render time by a factor of 22, whereas point lights only increase render times by 4 when compared to the same lighting method without shadows.
Spot lights are identical to point lights and area lights, except that the spot light limits the area illuminated. Spot lights are particularly effective in helping to reduce map sizes when shadow maps are used, which is discussed below.
Shadow Maps
Shadow maps work by creating an occlusion map of the scene from the point of view of the light, applying a softening to the map prior to using it to occlude light on the scene. On the plus side, a shadow map is fast. On the minus side the standard shadow map doesn’t consider transparency in the scene, nor does it vary size of umbra with distance of casting object to shadowed object.
|
|
In general shadow maps work better with spot lights because spot lights limit the affected area of light allowing for a smaller shadow map and so lower memory conception. Point lights need to create a shadow map that covers the full 360 degree cast of the light. Volumetric shadow maps in particular seem to give incorrect results with point lights.
You can decrease grain in the cast light by increasing the map resolution but remember that map size affects render time, as illustrated below. Remember also that by default XSI sets motion blur on for rendering shadow maps. If you have motion-blurred items in your scene this will have a significant effect on frame times.
|
|
With respect to hair, shadow maps render considerably faster than area lights. But, as already mentioned, standard shadow maps ignore transparency and since the hair geometry shader makes extensive use of transparency, shadows cast from hair using standard shadow maps don’t generally look good, as evidenced by the image below, rendered with a standard shadow map light with softness set to 0.
|
|
|
The blockiness in the shadows is caused in part by shadows ignoring transparency in the hair, partly by the resolution of the map. Extra detail can be realised by increasing the map size but self*shadowing of the hair still isn’t ideal, again because of the lack of transparency in the shadows. There’s also a limit to which the shadow map size can practically be increased. In the shots below the map size is 4096, artefacts are still visible in the cast shadow and the self*shadowing is still quite ugly. Render time is proportionally greater.
|
Of course, the examples above all use shadow maps with zero softness, shadow maps are more suited to soft shadowing and to some degree the artifacts shown above become less apparent when the map is softened.
|
|
|
Shadow Map Settings
Map resolution Sets the size of the map generated for shadows. Low resolution = low quality, high resolution = higher quality.
|
|
Bias Makes allowance for shadow bleed caused around contact points caused by softening the shadow. As with anything done with shadow maps, this still isn’t a perfect solution
|
|
Samples Sets the number of samples calculated within the region of the shadow map. Use a combination of this setting and map resolution to minimise grain in the shadow area.
Volumic Shadow Maps
Volumic shadow maps are shadow maps that are calculated by marching rays through the scene storing transparency values with each hit until the ray hits an opaque object. A volumic shadow map cast from hair generally appears to hold better detail for the same size of map because the hair transparency appears in the shadow. Self-shadowing on hair also tends to look better. Volumic shadow maps can be made take colour into consideration or not, according to preference so colour in the shadow may be turned off easily.
Note, in the examples below, although the detail to the left looks better than that on the right, the degree of pixelation is identical and it’s the transparency in the shadows that gives the appearance of better detail with little difference in render time.
|
|
As with standard shadow maps, pixel artefacts may be reduced with softening of the map but in the case of volumic shadow maps less softening is needed to hide them.
|

