ShadowCascades

Utility methods for computing cascaded shadow map split positions. Use these to populate ShadowOptions.cascadeSplitPositions.

Functions

Link copied to clipboard
fun computeLogSplits(splitPositions: FloatArray, cascades: Int, near: Float, far: Float)

Compute logarithmic split positions (more resolution near camera). Better distribution of resolution than uniform for typical scenes.

Link copied to clipboard
fun computePracticalSplits(splitPositions: FloatArray, cascades: Int, near: Float, far: Float, lambda: Float)

Compute practical split positions (interpolates between log and uniform schemes). Provides fine-grained control over resolution distribution. See: Zhang et al 2006, "Parallel-split shadow maps for large-scale virtual environments"

Link copied to clipboard
fun computeUniformSplits(splitPositions: FloatArray, cascades: Int)

Compute uniform split positions (equal distance along camera Z axis). Simple but may waste resolution in areas where it's less needed.