From d2763841bece7509958164e2a9a60d03eff6530c Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 5 Jul 2018 17:15:39 +0200 Subject: [PATCH] Working background blend on haze --- libraries/graphics/src/graphics/Haze.cpp | 6 +++--- libraries/render-utils/src/Haze.slh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/graphics/src/graphics/Haze.cpp b/libraries/graphics/src/graphics/Haze.cpp index d5a060b90b..ded48429ba 100644 --- a/libraries/graphics/src/graphics/Haze.cpp +++ b/libraries/graphics/src/graphics/Haze.cpp @@ -177,9 +177,9 @@ void Haze::setHazeBaseReference(const float hazeBaseReference) { void Haze::setHazeBackgroundBlend(const float hazeBackgroundBlend) { auto& params = _hazeParametersBuffer.get(); - - if (params.hazeBackgroundBlend != hazeBackgroundBlend) { - _hazeParametersBuffer.edit().hazeBackgroundBlend = hazeBackgroundBlend; + auto newBlend = 1.0f - hazeBackgroundBlend; + if (params.hazeBackgroundBlend != newBlend) { + _hazeParametersBuffer.edit().hazeBackgroundBlend = newBlend; } } diff --git a/libraries/render-utils/src/Haze.slh b/libraries/render-utils/src/Haze.slh index 06c55bb398..7854ad08ca 100644 --- a/libraries/render-utils/src/Haze.slh +++ b/libraries/render-utils/src/Haze.slh @@ -187,7 +187,7 @@ vec4 computeHazeColor(vec3 fragPositionES, vec3 fragPositionWS, vec3 eyePosition const float BLEND_DISTANCE = 27000.0f; vec4 outFragColor = potentialFragColor; if (distance > BLEND_DISTANCE) { - outFragColor.a = 1.0 - hazeParams.backgroundBlend; + outFragColor.a *= hazeParams.backgroundBlend; } return outFragColor;