Class CascadeShadowMap
java.lang.Object
gaiasky.util.gdx.model.gltf.scene3d.scene.CascadeShadowMap
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Manager for cascaded shadow maps.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleCamera far value for the cascaded shadow maps.doubleCamera near value for the cascaded shadow maps.protected final intprotected Matrix4DAttributes used for the CSM camera, which does not cover the same range as the full camera.protected FrustumDoublefinal com.badlogic.gdx.utils.Array<DirectionalShadowLight> protected Matrix4DAttributes used for the CSM camera, which does not cover the same range as the full camera.protected final DoubleArrayprotected Matrix4DAttributes used for the CSM camera, which does not cover the same range as the full camera. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DirectionalShadowLightcreateLight(int width, int height) Allow subclass to use their own shadow light implementation.voiddispose()doublegetSplitDistance(int layer) voidsetCascades(ICamera sceneCamera, DirectionalShadowLight baseLight, double lightDepthFactor, double splitDivisor) Setup base light and extra cascades based on scene camera frustum.voidsetCascades(ICamera sceneCamera, DirectionalShadowLight base, double lightDepthFactor, DoubleArray splitRates) Setup base light and extra cascades based on scene camera frustum.protected voidCreate or recreate, if necessary ,extra cascades with same resolution as the default shadow light.voidupdateCSM(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3D position, Vector3D direction, Vector3D up)
-
Field Details
-
lights
-
attribute
-
cascadeCount
protected final int cascadeCount -
splitRates
-
projection
Attributes used for the CSM camera, which does not cover the same range as the full camera. -
view
Attributes used for the CSM camera, which does not cover the same range as the full camera. -
combined
Attributes used for the CSM camera, which does not cover the same range as the full camera. -
frustum
-
CAM_NEAR_CSM
public double CAM_NEAR_CSMCamera near value for the cascaded shadow maps. -
CAM_FAR_CSM
public double CAM_FAR_CSMCamera far value for the cascaded shadow maps.
-
-
Constructor Details
-
CascadeShadowMap
public CascadeShadowMap(int cascadeCount) - Parameters:
cascadeCount- How many extra cascades.
-
-
Method Details
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
getSplitDistance
public double getSplitDistance(int layer) -
setCascades
public void setCascades(ICamera sceneCamera, DirectionalShadowLight baseLight, double lightDepthFactor, double splitDivisor) Setup base light and extra cascades based on scene camera frustum. With automatic split rates.- Parameters:
sceneCamera- The camera used to render the scene (frustum should be up-to-date).baseLight- The default shadow light, used for far shadows.lightDepthFactor- Shadow box depth factor, depends on the scene. Must be >= 1. Greater than 1 means more objects cast shadows but less precision. A 1 value restricts shadow box depth to the frustum (only visible objects by the scene camera).splitDivisor- Describe how to split scene camera frustum. . With a value of 4, far cascade covers the range: 1/4 to 1/1, next cascade, the range 1/16 to 1/4, and so on. The closest one covers the remaining starting from 0. When used with 2 extra cascades (3 areas), split points are: 0.0, 1/16, 1/4, 1.0.
-
setCascades
public void setCascades(ICamera sceneCamera, DirectionalShadowLight base, double lightDepthFactor, DoubleArray splitRates) Setup base light and extra cascades based on scene camera frustum. With user defined split rates.- Parameters:
sceneCamera- The camera used to render the scene (frustum should be up-to-date).base- The default shadow light, used for far shadows.lightDepthFactor- Shadow box depth factor, depends on the scene. Must be >= 1. Greater than 1 means more objects cast shadows but less precision. A 1 value restricts shadow box depth to the frustum (only visible objects by the scene camera).splitRates- Describe how to split scene camera frustum. The first 2 values define near and far rate for the closest cascade, Second and third value define near and far rate for the second cascade, and so on. When used with 2 extra cascades (3 areas), 4 split rates are expected. Eg: [0.0, 0.1, 0.3, 1.0].
-
syncExtraCascades
Create or recreate, if necessary ,extra cascades with same resolution as the default shadow light.- Parameters:
base- The default shadow light.
-
createLight
Allow subclass to use their own shadow light implementation.- Returns:
- a new directional shadow light.
-
updateCSM
-