UDN
Search public documentation:
ModulatedShadows
日本語訳
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
Modulated Shadows
Document Changelog: Created by Daniel Wright.
Overview
Versions
Relevant Settings

LightShadowMode
Controls the type of shadowing used for this light source.- 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.
ModShadowColor
This controls the color of modulated shadows.ShadowFalloffExponent
Rate at which the shadows falloff based on distance for spot lights and point lights. A higher value means that the falloff will occur more quickly. A value of 1.0 equals linear falloff.ModShadowFadeoutExponent
This controls the fade-out and fade-in curves when ModShadowFadeoutTime is greater than zero.ModShadowFadeoutTime
If this is greater than zero, then the modulated shadow will fadeout based on the time that the caster was last visible. It will also fade in based on the time that the caster first became visible. This can be used to fade out shadows on characters in other rooms, whose shadows would otherwise be seen through the wall. Make sure you have realtime update on in the editor or it will not work correctly. The fade is framerate dependent so hitches may cause undesired artifacts.Why use modulated shadows
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.

How modulated shadows work
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.

Limitations
Double shadowing
Since modulated shadows simply modulate against scene color, areas where shadows overlap will be double shadowed. The workaround for this is to shadow parent nearby primitives. For example, in Gears of War 1 all weapons are shadow parented to their pawns to avoid double shadowing there. See AttachingActors#b_ShadowParented for how to shadow parent in content. To shadow parent in code use the PrimitiveComponent's SetShadowParent method.Emissive artifacts
Modulative shadows are multiplied against the scene color, including emissive light, which should not be shadowed. The workaround is to use the Modulate-Better shadow mode, which will prevent modulated shadows from affecting pixels whose emissive component is > 1 for any channel.Casting through geometry
In the current implementation, mod shadows cast through geometry. The most obvious cases of this will have to be avoided through careful light placement. Avoiding these situations through manual light tweaking can be very difficult, but can be made significantly easier by using 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.