Clamp ReflectionProbe Max Distance to 262,144 to fix rendering issues

This commit is contained in:
Hugo Locurcio 2023-09-27 02:19:59 +02:00
parent 251fb83d53
commit ce421da908
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 3 additions and 2 deletions

View File

@ -68,8 +68,9 @@ Color ReflectionProbe::get_ambient_color() const {
} }
void ReflectionProbe::set_max_distance(float p_distance) { void ReflectionProbe::set_max_distance(float p_distance) {
max_distance = p_distance; max_distance = CLAMP(p_distance, 0.0, 262'144.0);
RS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance); // Reflection rendering breaks if distance exceeds 262,144 units (due to floating-point precision with the near plane being 0.01).
RS::get_singleton()->reflection_probe_set_max_distance(probe, max_distance);
} }
float ReflectionProbe::get_max_distance() const { float ReflectionProbe::get_max_distance() const {