Xenko

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • Manual
  • API
  • Release notes
    Show / Hide Table of Contents

    Directional lights

    Beginner Designer Artist

    Directional lights come uniformly from one direction. They're often used for simulating large, distant light sources such as the sun, and cast shadows. By default, new scenes you create in Xenko contain a directional light.

    media/DirectionalLightOverview.png

    The scene editor shows the position of directional lights with the following icon:

    media/DirectionalLight.png

    When you select a directional light, the gizmo displays the light's main direction:

    media/DirectionalLightSelected.png

    Properties

    media/DirectionalLightProperties.png

    Property Description
    Color The color of the light (RGB)
    Shadow See Shadow properties below
    Intensity The intensity of the light. The color is multiplied by this value before being sent to the shader. Note: negative values produce darkness and have unpredictable effects
    Culling Mask Defines which entity groups are affected by this light. By default, all groups are affected

    Shadows cast by directional lights

    Like point lights and spot lights, directional lights cast shadows. However, shadows cast by directional lights can spawn across a large view range, so they require special treatment to improve their realism.

    Directional lights use an additional technique, cascaded shadow mapping. This consists of rendering the depth of occluding objects from the point of view of the light to a texture, then rendering the scene taking the occluder information into account.

    This method slices the depth range from the camera's point of view into different sections or "cascades" of different resolutions. The nearer each cascade is to the camera, the higher resolution it has, and the higher-resolution its shadows are.

    media/ShadowMappingCascades.png

    Put simply, the closer shadows are to the camera, the better quality they are. This means you can spend more memory on shadows closer to the camera, where you can see them, and less on distant shadows.

    You can have one, two, or four cascades. The more cascades you use, the more memory you save, but the lower resolution your shadows become over distance.

    This an example of a shadow map generated from a directional light, using four cascades:

    FPS scene shadow map

    See shadow cascades in the scene editor

    In the property grid, under the Shadow properties, enable the Debug option.

    Cascades debug off Cascades debug on
    media/directional-lights-8.png media/directional-lights-9.png

    The different colors indicate the cascade for each distance range (Green: 0, Blue: 1, Purple: 2, Red: 3).

    Directional light shadow properties

    Property Description
    Filter Filtering produces soft shadows instead of hard shadows. Currently, the implemented technique is PCF (Percentage Closer Filtering)
    Size The size of the shadow map texture. For the directional light, this value is x1 by default, as a directional light has more visual impact than lights with shorter ranges
    Cascade Count The number of cascades used for slicing the range of depth covered by the light. Values are 1, 2 or 4 cascades; a typical scene uses 4 cascades
    Stabilization mode
    The technique used to reduce shadow map flickering. Flickering is a result of the potential aliasing introduced by the shadow map when a texel from the perspective of the light covers more space than a texel from the camera's perspective.

    Projection snapping tries to snap the projection matrix of the light to a texel dependent on the resolution of the shadow map texture

    View snapping tries to snap the target of the view matrix of the light (center of the camera view cascade frustum)

    Both projection and view snapping force the shadow matrix to cover a larger region, increasing the aliasing of the shadow map texture. Note that when using depth range camera is set to automatic, the stabilization mode is ignored
    Depth Range How the visible depth range from the camera's perspective is calculated. This directly affects how near and how far cascades splits occur
    Automatic If enabled, the visible depth range is read back from the actual depth buffer and the min and max view distance is calculated automatically
    Manual Min Distance The minimum depth in world units, valid when the automatic mode is disabled
    Manual Max Distance The maximum depth in world units, valid when the automatic mode is disabled
    Blend Cascades Smooths the transition between cascades
    Partition mode
    How the cascade split distance is determined.

    Manual: the split is defined manually for each cascade, in percentage of the visible depth range. A value of 0.1 for a cascade means that the cascade is rendered on the distance 0.1 * (VisibleDepthMax - VisibleDepthMin)

    Logarithmic: the split is automatically calculated using a logarithmic scale
    The PSSM factor lets you blend from a pure logarithmic scale (0.0f) to a pure uniform scale (1.0f)
    Bias Parameters Used to avoid some artifacts of the shadow map technique
    Depth Bias The amount of depth to add to the sampling depth to avoid the phenomenon of shadow acne
    Normal Offset Scale A factor multiplied by the depth bias toward the normal
    Debug Displays the shadow map cascades in the scene editor

    Light shafts

    Used with a light shaft component and a light shaft bounding volume, directional lights create light shafts.

    Light shafts

    For more information, see Light shafts.

    See also

    • Add a light
    • Point lights
    • Ambient lights
    • Skybox lights
    • Spot lights
    • Light probes
    • Light shafts
    • Shadows
    • Improve this Doc

    Back to top

    Copyright © 2016 Silicon Studio
    Generated by DocFX