Working background blend on haze

This commit is contained in:
Olivier Prat 2018-07-05 17:15:39 +02:00
parent 4b7b14f4d3
commit d2763841be
2 changed files with 4 additions and 4 deletions

View file

@ -177,9 +177,9 @@ void Haze::setHazeBaseReference(const float hazeBaseReference) {
void Haze::setHazeBackgroundBlend(const float hazeBackgroundBlend) {
auto& params = _hazeParametersBuffer.get<Parameters>();
if (params.hazeBackgroundBlend != hazeBackgroundBlend) {
_hazeParametersBuffer.edit<Parameters>().hazeBackgroundBlend = hazeBackgroundBlend;
auto newBlend = 1.0f - hazeBackgroundBlend;
if (params.hazeBackgroundBlend != newBlend) {
_hazeParametersBuffer.edit<Parameters>().hazeBackgroundBlend = newBlend;
}
}

View file

@ -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;