Search public documentation:
Document Changelog: Created by Daniel Wright.
- Modulated Shadows
Modulated shadows were introduced to solve some of the performance problems with normal shadows, and to give artists more control over shadow appearances. Throughout this doc, 'normal shadows' simply means non-modulated shadows, and does not imply anything about the filtering technique. Note that modulated shadows work with both projected shadow buffers as well as shadow volumes.
ModShadowFadeoutTime functionality was introduced in QA_APPROVED_BUILD_JUNE_2007, but shadows didn't fade in as well until QA_APPROVED_BUILD_AUGUST_2007. The Modulate-Better shadow mode was added in QA_APPROVED_BUILD_JAN_2008.
- LightShadow_Normal - the default behavior and requires a mesh to be dynamically lit by the shadow casting light in order to receive shadows from that light. This is a very important implication because it means lightmapped geometry cannot receive normal shadows if the lightmap contains the contribution from the shadow casting light. Normal shadows are very expensive on Xbox 360 as they require extra render target space which requires other render targets to be saved out and restored afterwards.
- LightShadow_Modulate - enables modulated shadows from this light source, which cast on any opaque or masked object. This is the cheapest mode. Modulated shadows operate by multiplying scene color instead of masking out a certain light.
An object's dynamic shadows are drawn for each light that uses Normal Shadows. Shadows in this sense are the absence of light coming from the current light source. This is a more physically correct model, however it has some serious implications. A typical scene will have several lights in the same area, but only one of these lights casting dynamic shadows for performance reasons. In this case, shadow color is totally dependent on the lights affecting the shadowed surface. The shadow will be very dim because the shadow-casting light source only contributes a fraction of the total light on the surface, and the shadow is simply the absence of that light. It would be very difficult for an artist to tweak the shadow color and make it darker in this case, because that would require making the shadow-casting light brighter (or closer, less attenuation etc), which may ruin the lighting in the scene.
Normal shadows do not cast onto static geometry once its lightmap has been built. Modulated shadows cast on the entire scene and so solve this problem.
A scene with 3 lights affecting the character, only one of them casting normal shadows. Note that the shadow is very dim.
This is where modulated shadows come into the picture. In short, modulated shadows allow the artist to have only one shadow per dynamic object and control that shadow color without changing the lighting properties of the shadow-casting light source.
Modulated shadows are much less physically correct than normal shadows, however in most cases this is offset by the performance and user control benefits. In each lighting pass the shadows have ModShadowColor applied, and then they are rendered to an attenuation buffer, instead of being used to mask out the current light. When all the lights have been rendered, the attenuation buffer is multiplied with the scene color. The result is that shadows will be darker no matter how many lights are affecting a surface, because shadows from one light source affect the light from all light sources, instead of just the shadow-casting light source.
The same scene with 3 lights affecting the character, only one of them casting modulated shadows. Note that the shadow is still strong.
Modulated shadows for point lights have a radial attenuation based on the light's radius. This is also true for spot lights except that the falloff is also affected by the inner and outer cones. For directional lights there is no distance attenuation.
AttachingActors#b_ShadowParented for how to shadow parent in content. To shadow parent in code use the PrimitiveComponent's SetShadowParent method. LightEnvironments. In some cases this can be alleviated through the use of ModShadowFadeoutTime. Shadows on backfaces can be avoided with the Modulate-Better shadow mode.
The only way to really avoid these projection artifacts is to use normal shadows. However, normal shadows are considerably more expensive than modulated shadows for the most part. There's one exception to this: DominantLights. Dominant lights allow you to have one light casting normal shadows for cheap. ShadowBufferFilteringOptions and ShadowBufferFilteringTech for more info.