Class LightManager.ShadowOptions

  • Enclosing class:
    LightManager

    public static class LightManager.ShadowOptions
    extends java.lang.Object
    Control the quality / performance of the shadow map associated to this light
    • Field Summary

      Fields 
      Modifier and Type Field Description
      float blurWidth
      Blur width for the VSM blur.
      float[] cascadeSplitPositions
      The split positions for shadow cascades.
      float constantBias
      Constant bias in world units (e.g.
      int mapSize
      Size of the shadow map in texels.
      float maxShadowDistance
      Maximum shadow-occluder distance for screen-space contact shadows (world units).
      float normalBias
      Amount by which the maximum sampling error is scaled.
      boolean screenSpaceContactShadows
      Whether screen-space contact shadows are used.
      float shadowBulbRadius
      Light bulb radius used for soft shadows.
      int shadowCascades
      Number of shadow cascades to use for this light.
      float shadowFar
      Distance from the camera after which shadows are clipped.
      float shadowFarHint
      Optimize the quality of shadows in front of this distance from the camera.
      float shadowNearHint
      Optimize the quality of shadows from this distance from the camera.
      boolean stable
      Controls whether the shadow map should be optimized for resolution or stability.
      int stepCount
      Number of ray-marching steps for screen-space contact shadows (8 by default).
      int vsmMsaaSamples
      The number of MSAA samples to use when rendering VSM shadow maps.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShadowOptions()  
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mapSize

        public int mapSize
        Size of the shadow map in texels. Must be a power-of-two and larger or equal to 8.
      • shadowCascades

        @IntRange(from=1L,
                  to=4L)
        public int shadowCascades
        Number of shadow cascades to use for this light. Must be between 1 and 4 (inclusive). A value greater than 1 turns on cascaded shadow mapping (CSM). Only applicable to Type.SUN or Type.DIRECTIONAL lights.

        When using shadow cascades, cascadeSplitPositions must also be set.

        See Also:
        cascadeSplitPositions
      • constantBias

        public float constantBias
        Constant bias in world units (e.g. meters) by which shadows are moved away from the light. 1mm by default. This is ignored when the View's ShadowType is set to VSM.
      • normalBias

        public float normalBias
        Amount by which the maximum sampling error is scaled. The resulting value is used to move the shadow away from the fragment normal. Should be 1.0. This is ignored when the View's ShadowType is set to VSM.
      • shadowFar

        public float shadowFar
        Distance from the camera after which shadows are clipped. This is used to clip shadows that are too far and wouldn't contribute to the scene much, improving performance and quality. This value is always positive. Use 0.0f to use the camera far distance.
      • shadowNearHint

        public float shadowNearHint
        Optimize the quality of shadows from this distance from the camera. Shadows will be rendered in front of this distance, but the quality may not be optimal. This value is always positive. Use 0.0f to use the camera near distance. The default of 1m works well with many scenes. The quality of shadows may drop rapidly when this value decreases.
      • shadowFarHint

        public float shadowFarHint
        Optimize the quality of shadows in front of this distance from the camera. Shadows will be rendered behind this distance, but the quality may not be optimal. This value is always positive. Use std::numerical_limits::infinity() to use the camera far distance.
      • stable

        public boolean stable
        Controls whether the shadow map should be optimized for resolution or stability. When set to true, all resolution enhancing features that can affect stability are disabling, resulting in significantly lower resolution shadows, albeit stable ones.
      • screenSpaceContactShadows

        public boolean screenSpaceContactShadows
        Whether screen-space contact shadows are used. This applies regardless of whether a Renderable is a shadow caster. Screen-space contact shadows are typically useful in large scenes. (off by default)
      • stepCount

        public int stepCount
        Number of ray-marching steps for screen-space contact shadows (8 by default).

        CAUTION: this parameter is ignored for all lights except the directional/sun light, all other lights use the same value set for the directional/sun light.

      • maxShadowDistance

        public float maxShadowDistance
        Maximum shadow-occluder distance for screen-space contact shadows (world units). (30 cm by default)

        CAUTION: this parameter is ignored for all lights except the directional/sun light, all other lights use the same value set for the directional/sun light.

      • vsmMsaaSamples

        @IntRange(from=1L)
        public int vsmMsaaSamples
        The number of MSAA samples to use when rendering VSM shadow maps. Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns off MSAA. Higher values may not be available depending on the underlying hardware.

        Warning: This API is still experimental and subject to change.

      • blurWidth

        public float blurWidth
        Blur width for the VSM blur. Zero do disable. The maximum value is 125.
      • shadowBulbRadius

        public float shadowBulbRadius
        Light bulb radius used for soft shadows. Currently this is only used when DPCF is enabled. (2cm by default).
    • Constructor Detail

      • ShadowOptions

        public ShadowOptions()