ADD: Receiver plane depth bias

This commit is contained in:
2025-10-28 13:38:32 +09:00
parent ed9a8ff474
commit 4a47936414
3 changed files with 48 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ inline constexpr float kShadowCascadeRadiusScale = 1.1f;
inline constexpr float kShadowCascadeRadiusMargin = 10.0f;
// Clipmap shadow configuration (used when cascades operate in clipmap mode)
// Base coverage radius of level 0 around the camera (world units). Each level doubles the radius.
inline constexpr float kShadowClipBaseRadius = 30.0f;
inline constexpr float kShadowClipBaseRadius = 20.0f;
// When using dynamic pullback, compute it from the covered XY range of each level.
// pullback = max(kShadowClipPullbackMin, cover * kShadowClipPullbackFactor)
inline constexpr float kShadowClipPullbackFactor = 2.5f; // fraction of XY half-size behind center

View File

@@ -157,7 +157,7 @@ void SceneManager::update_scene()
const glm::vec3 eye = center - L * pullback;
const glm::mat4 V = glm::lookAtRH(eye, center, up);
const float zNear = 0.1f;
const float zNear = 0.2f;
const float zFar = pullback + cover * kShadowClipForwardFactor + kShadowClipZPadding;
const glm::mat4 P = glm::orthoRH_ZO(-cover, cover, -cover, cover, zNear, zFar);