Tweak ReflectionProbe roughness according to hit distance when box projection is used #104585
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.












This improves the realism of reflections when box projection is enabled. This works by scaling the roughness according to the hit distance between the bounds of the reflection and the fragment being shaded.
Additionally, this makes reflection sampling in Compatibility use the same perceptual roughness formula (
sqrt(roughness)) as Forward+/Mobile for better visual consistency.Testing project: test_improved_box_projected_reflections.zip
Press B to toggle box projection.
Preview
Forward+
Videos with varying roughness:
Before
roughness_before_forward_plus.mp4
After
There's a stretching effect that occurs (also without this PR) and becomes more noticeable at higher roughness values. It does not occur when using Compatibility, despite the code changes between both renderers being the same. I don't know why this is happening. (Is this an approximation of anisotropy that's not present in Compatibility?)
roughness_after_forward_plus.mp4
Mobile
Compatibility
Roughness before this PR wasn't using the perceptual roughness formula (
sqrt(roughness)), so it appeared to be too low compared to other renderers. Was this intentional? cc @BastiaanOlijVideos with varying roughness:
Before
roughness_before_compatibility.mp4
After
roughness_after_compatibility.mp4