Make the default directional light shadow cascade settings similar to those of other engines. (#17552)

Currently, our default maximum shadow cascade distance is 1000 m, which
is quite distant compared to that of Unity (150 m), Unreal Engine 5 (200
m), and Godot (100 m). I also adjusted the default first cascade far
bound to be 10 m, which matches that of Unity (10.05 m) and Godot (10
m). Together, these changes should improve the default sharpness of
shadows of directional lights for typical scenes.

## Migration Guide

* The default shadow cascade far distance has been changed from 1000 to
150, and the default first cascade far bound has been changed from 5 to
10, in order to be similar to the defaults of other engines.
This commit is contained in:
Patrick Walton 2025-01-26 17:48:57 -08:00 committed by GitHub
parent eb04f8a476
commit 8620cd783c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,27 +246,25 @@ impl CascadeShadowConfigBuilder {
impl Default for CascadeShadowConfigBuilder {
fn default() -> Self {
if cfg!(all(
feature = "webgl",
target_arch = "wasm32",
not(feature = "webgpu")
)) {
// Currently only support one cascade in webgl.
Self {
num_cascades: 1,
minimum_distance: 0.1,
maximum_distance: 100.0,
first_cascade_far_bound: 5.0,
overlap_proportion: 0.2,
}
} else {
Self {
num_cascades: 4,
minimum_distance: 0.1,
maximum_distance: 1000.0,
first_cascade_far_bound: 5.0,
overlap_proportion: 0.2,
}
// The defaults are chosen to be similar to be Unity, Unreal, and Godot.
// Unity: first cascade far bound = 10.05, maximum distance = 150.0
// Unreal Engine 5: maximum distance = 200.0
// Godot: first cascade far bound = 10.0, maximum distance = 100.0
Self {
// Currently only support one cascade in WebGL 2.
num_cascades: if cfg!(all(
feature = "webgl",
target_arch = "wasm32",
not(feature = "webgpu")
)) {
1
} else {
4
},
minimum_distance: 0.1,
maximum_distance: 150.0,
first_cascade_far_bound: 10.0,
overlap_proportion: 0.2,
}
}
}