UDN
Search public documentation
LightEnvironments
Light Environments
Document Summary: Light Environments are used to optimize dynamic object lighting and simplify dynamic lighting setup. Document Changelog: Created by Daniel Wright; updated by Andrew Scheidecker.- Light Environments
- Overview
- Why Light Environments are Needed
- How Light Environments Work
- Settings
- Light
- Primitive's LightEnvironment
- DynamicLightEnvironmentComponent
- AmbientGlow
- AmbientShadowColor
- AmbientShadowSourceDirection
- bCastShadows
- bDynamic
- bFreeze
- BouncedLightingIntensity
- BouncedLightingDesaturation
- bSynthesizeDirectionalLight
- bSynthesizeSHLight
- InvisibleUpdateTime
- LightDesaturation
- LightDistance;
- LightShadowMode
- MinTimeBetweenFullUpdates
- ModShadowFadeoutExponent
- ModShadowFadeoutTime
- NumVolumeVisibilitySamples
- ShadowDistance
- ShadowFilterQuality
- LightEnvironmentComponent
- DynamicLightEnvironmentComponent
- Limitations
- Relevant Discussion Threads
Overview
Light environments provide Level Designers with an automated way of controlling dynamic lighting by approximating the effect of relevant static lights. Together with modulated shadows, light environments were used on all characters and vehicles and most other dynamic objects in Gears of War and Unreal Tournament 3.Why Light Environments are Needed
Without light environments, Level Designers are forced to maintain at least 2 sets of lights, static-only lights and lights affecting dynamic objects. Overlapping between these is often not possible because too many lights affecting the dynamic objects incurs a performance hit, and only using some of the static lights on dynamic objects results in incorrect lighting on dynamic objects and reduces the flexibility of the lighting system.How Light Environments Work
A light environment gathers the static and dynamic lights that affect its subject, and reproduces those lights on the subject with a fixed rendering cost. It approximates all the lights affecting the character with a spherical harmonic light and a directional light. The environment culls lights that wouldn't affect the character due to shadowing by using a ray check from the light to a point in the subject's bounds. By default, only one ray is used, but the DynamicLightEnvironmentComponent's NumVolumeVisibilitySamples can be used to specify that multiple rays should be checked to allow for fractional visibility. For each light the environment finds that affects the character, it projects that light into a low order spherical harmonic basis. The projection maintains the light intensity and color, but blurs the angle they are incident on the subject from. The information lost in the blurring is essential to the spherical harmonic basis's ability to represent an unlimited number of lights in a fixed set of spherical harmonic coefficients. Once the environment has projected all relevant lights into the spherical harmonic basis, it approximates the bounced lighting from those direct lights that would affect the subject. The approximation is to simply take a fraction of the direct lighting, saturate it, reflect the angle it comes from, and add it with the direct lighting to get the total lighting. The bounced lighting approximation is controlled by DynamicLightEnvironment's BouncedLightingIntensity and BouncedLightingDesaturation members. The directional light is used to synthesize the lighting coming from the dominant lighting angle, where the dominant lighting angle is the angle that has the highest luminance in the spherical harmonic projection of the lighting incident on the subject. The spherical harmonic light is used to synthesize all the light that the directional light doesn't account for. Because of the angular blurring of the spherical harmonic basis used to represent the composite lighting, the SH light cannot accurately reproduce high frequency specular reflections, so specular reflections from the SH light are ignored entirely as an optimization. Light environments also optionally cast a single modulated shadow from a composite of the subset of the lights affecting the environment that have bCastCompositeShadow=True. The environment's spherical harmonic light isn't affected by the environment's modulated shadow, but the environment's directional light is.Settings
Light
These are the relevant settings available to each light:
bCastCompositeShadow
For a light to affect the shadow direction it must have bCastCompositeShadow=True. The default is true for all light types; prior to Epic changelist 208754 it was false by default on point lights and spot lights. For lights with this set to false they will be used to affect the light environment's composite lighting but not its composite shadow. bCastCompositeShadow also controls whether non-light-mapped lights are affected by modulated shadows; a dynamic light with bCastCompositeShadow=False won't be affected by modulated shadows from any light. bCastCompositeShadow is ignored on light-mapped lights, since the light will be rendered as part of the composite light-map; all light-mapped lights are affected by modulated shadows.CompositeDynamic channel
All lights are in the CompositeDynamic channel by default, however you still need to have lights in the dynamic lighting channel if you have any primitives which don't use the composite light environment. Note that the CompositeDynamic channel is a separate flag from the Dynamic lighting channel as an optimization. There will typically be many lights that are CompositeDynamic but not Dynamic, and lights in the Dynamic lighting channel need to be checked for relevance whenever a primitive is reattached to the scene.Primitive's LightEnvironment
These are the settings available in the LightEnvironment, which can be set on SkeletalMeshActors for example.
