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.


Point light, with shadows
Enlarge
Point light, with shadows
  • Sampling (min, max):(0,0)
  • Rapid Motion Rate: 4
  • Motion Blur: Off
  • Resolution:(300, 300)
  • Time (hh:mm:ss):00:02:03


Point light, no shadows
Enlarge
Point light, no shadows
  • Sampling (min, max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:28


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.


Soft shadow from an area light. Note sharpness of shadow towards base of cylinder
Enlarge
Soft shadow from an area light. Note sharpness of shadow towards base of cylinder
  • Sampling (min,max): (1,2)
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:01:16


Soft shadow from shadow mapped light. Note shadow is still soft toward base of cylinder, giving the impression that the cylinder is floating over the floor
Enlarge
Soft shadow from shadow mapped light. Note shadow is still soft toward base of cylinder, giving the impression that the cylinder is floating over the floor
  • Sampling (min,max): (1,2)
  • Motion Blur : Off Resolution: (300, 300)
  • Time (hh:mm:ss): 00:01:34


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.


Map size 200, 12 seconds to render
Enlarge
Map size 200, 12 seconds to render
  • Sampling (min,max): (1,2)
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:12


Map size 4000, 1 minute 41 seconds to render
Enlarge
Map size 4000, 1 minute 41 seconds to render
  • Sampling (min,max): (1,2)
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:01:41


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.


Hair rendered with standard shadow map. Note shadow artifacts on hair self-shadowing as well as blockiness of shadow cast to floor. Shadow map size = 1024
Enlarge
Hair rendered with standard shadow map. Note shadow artifacts on hair self-shadowing as well as blockiness of shadow cast to floor. Shadow map size = 1024
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:01:15



Close up of render to left. Increase in render time is largely due to increased size of rendered hair area in shot
Enlarge
Close up of render to left. Increase in render time is largely due to increased size of rendered hair area in shot
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:02:34


For comparison, close up of scene rendered using Standard ray*traced shadow. Coloured hair strands indicate transparency in the hair. Note also the increased Render time
Enlarge
For comparison, close up of scene rendered using Standard ray*traced shadow. Coloured hair strands indicate transparency in the hair. Note also the increased Render time
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:05:59


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.


Map size 4096.
Enlarge
Map size 4096.
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:03:45


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.


Softness 0.00617, map size 1024
Enlarge
Softness 0.00617, map size 1024
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:02:37



Softness 0.00617, map size 4096
Enlarge
Softness 0.00617, map size 4096
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:03:09


Softness 0.068085, map size 4096
Enlarge
Softness 0.068085, map size 4096
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:04:12


Shadow Map Settings

Map resolution Sets the size of the map generated for shadows. Low resolution = low quality, high resolution = higher quality.


Standard shadow map, resolution = 50
Enlarge
Standard shadow map, resolution = 50
  • Sampling (min,max): (1,2)
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:13




Standard shadow map, resolution = 1024
Enlarge
Standard shadow map, resolution = 1024
  • Sampling (min,max): (1,2)
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:15


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


Shadow map, softness = 0.110638, bias = 0. Note shadow bleed around base and top of cylinder
Enlarge
Shadow map, softness = 0.110638, bias = 0. Note shadow bleed around base and top of cylinder
  • Sampling (min,max): (1,2)
  • Motion Blur: Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:16



Softness 0.110638, bias –0.021. Shadow is moved away from base, removing bleed
Enlarge
Softness 0.110638, bias –0.021. Shadow is moved away from base, removing bleed
  • Sampling (min,max): (1,2)
  • Motion Blur: Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:00:14


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.


Volumic shadow map, map size 1024, softness 0. Still not good but better than non-volumic
Enlarge
Volumic shadow map, map size 1024, softness 0. Still not good but better than non-volumic
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:02:33


Non volumic shadow map, map size 1024, softness 0
Enlarge
Non volumic shadow map, map size 1024, softness 0
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:02:34


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.


Softness 0.002008, map size 1024. In this image the shadow type has been set to intensity only, hence the lack of colour in the shadow. Note also the improved quality of self-shadowing in the hair.
Enlarge
Softness 0.002008, map size 1024. In this image the shadow type has been set to intensity only, hence the lack of colour in the shadow. Note also the improved quality of self-shadowing in the hair.
  • Sampling (min,max): (0,0)
  • Rapid Motion Rate: 4
  • Motion Blur : Off
  • Resolution: (300, 300)
  • Time (hh:mm:ss): 00:02:18

This page was last modified 12:09, 25 Aug 2006.
This page has been accessed 15614 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy