Page MenuHomeWildfire Games

prevent tree leaves from showing up as white in reflections
ClosedPublic

Authored by wraitii on Aug 3 2019, 11:35 AM.

Details

Summary

The game has been plagued by a weird bug for a while now (since 2016 in fact: rP18443) - tree leaves show up as extremely bright in reflections.

The reason for this is that they are overwriting the alpha for nice smooth transition from leaf to ground, which works well when over-ground, but makes them show the skybox (which is rather bright) in reflections.

Because trees are usually in the shade, this is particularly jarring. See screenshots:

Before:

After:

To fix this, the simplest solution is to reduce the blending effect so that leaves are mostly opaque.

Related to #5125, which it makes, I think, somewhat irrelevant

Test Plan

Look at the leaves.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Aug 3 2019, 11:35 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/295/display/redirect

wraitii edited the summary of this revision. (Show Details)Aug 3 2019, 11:49 AM

I couldn't find anything white in the reflections, you mean bright?

The solution sounds a bit like a hack as it only changes the bug quantitatively instead of qualitatively?

"Leaves" sounds only like one of arbitrary many cases.

I guess it only changes the number that was already there, but what's the best / most justifiable number?

In D2143#89458, @elexis wrote:

I couldn't find anything white in the reflections, you mean bright?

Yes.

The solution sounds a bit like a hack as it only changes the bug quantitatively instead of qualitatively?
"Leaves" sounds only like one of arbitrary many cases.
I guess it only changes the number that was already there, but what's the best / most justifiable number?

Whatever looks best™.
It needs to be a positive number, as otherwise the skybox won't show up at all. If the transparency is high enough, the skybox would dominate anyways, so the number can be arbitrarily low or high to show/hide the issue.

I'm taking better suggestions, but this looks much better as you can see in the screenshots above.

Your solution is honestly probably more correct. I figured out that the issue was due to translucency, although I still haven't figured out any way to get realistic levels of contrast in the reflections. :\ Real reflections tend to be very high contrast, particularly wrt shadows.

Your solution is honestly probably more correct. I figured out that the issue was due to translucency, although I still haven't figured out any way to get realistic levels of contrast in the reflections. :\ Real reflections tend to be very high contrast, particularly wrt shadows.

Should be doable by having the darkness of the reflection affect the fresnel. A problem is that reflection should be seen as additive, where as right now we mix both.

Should be doable by having the darkness of the reflection affect the fresnel. A problem is that reflection should be seen as additive, where as right now we mix both.

That was my basic idea, but I'm not sure that it'd work particularly well. Physically it's not quite additive either, but trying to translate that into raster graphics is not feasible for the same reason we don't use addition for bloom.

That was my basic idea, but I'm not sure that it'd work particularly well. Physically it's not quite additive either, but trying to translate that into raster graphics is not feasible for the same reason we don't use addition for bloom.

Indeed. At the end of the day it's all smoke and mirrors for graphics anyways.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 4 2019, 9:54 AM
This revision was automatically updated to reflect the committed changes.