Class LightManager.ShadowCascades

  • Enclosing class:
    LightManager

    public static class LightManager.ShadowCascades
    extends java.lang.Object
    • Constructor Detail

      • ShadowCascades

        public ShadowCascades()
    • Method Detail

      • computeUniformSplits

        public static void computeUniformSplits​(@NonNull @Size(min=1L)
                                                float[] splitPositions,
                                                @IntRange(from=1L,to=4L)
                                                int cascades)
        Utility method to compute LightManager.ShadowOptions.cascadeSplitPositions according to a uniform split scheme.
        Parameters:
        splitPositions - a float array of at least size (cascades - 1) to write the split positions into
        cascades - the number of shadow cascades, at most 4
      • computeLogSplits

        public static void computeLogSplits​(@NonNull @Size(min=1L)
                                            float[] splitPositions,
                                            @IntRange(from=1L,to=4L)
                                            int cascades,
                                            float near,
                                            float far)
        Utility method to compute LightManager.ShadowOptions.cascadeSplitPositions according to a logarithmic split scheme.
        Parameters:
        splitPositions - a float array of at least size (cascades - 1) to write the split positions into
        cascades - the number of shadow cascades, at most 4
        near - the camera near plane
        far - the camera far plane
      • computePracticalSplits

        public static void computePracticalSplits​(@NonNull @Size(min=1L)
                                                  float[] splitPositions,
                                                  @IntRange(from=1L,to=4L)
                                                  int cascades,
                                                  float near,
                                                  float far,
                                                  float lambda)
        Utility method to compute LightManager.ShadowOptions.cascadeSplitPositions according to a practical split scheme.

        The practical split scheme uses uses a lambda value to interpolate between the logrithmic and uniform split schemes. Start with a lambda value of 0.5f and adjust for your scene.

        See: Zhang et al 2006, "Parallel-split shadow maps for large-scale virtual environments"
        Parameters:
        splitPositions - a float array of at least size (cascades - 1) to write the split positions into
        cascades - the number of shadow cascades, at most 4
        near - the camera near plane
        far - the camera far plane
        lambda - a float in the range [0, 1] that interpolates between log and uniform split schemes