Skip to content

Commit

Permalink
Merge pull request #82415 from Calinou/reflectionprobe-fix-high-max-d…
Browse files Browse the repository at this point in the history
…istance-rendering-2

Clamp ReflectionProbe Max Distance to 262,144 to fix rendering issues
  • Loading branch information
akien-mga committed Oct 26, 2023
2 parents 9f20a4a + ce421da commit 79e9e20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scene/3d/reflection_probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ Color ReflectionProbe::get_ambient_color() const {
}

void ReflectionProbe::set_max_distance(float p_distance) {
max_distance = p_distance;
RS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance);
max_distance = CLAMP(p_distance, 0.0, 262'144.0);
// 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 {
Expand Down

0 comments on commit 79e9e20

Please sign in to comment.