From 6a089be973b240ead39692c073896540ecc4521a Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Mon, 16 Apr 2018 12:15:08 +0200 Subject: [PATCH] Enabled haze to be vertically inverted (ceiling lower than base) --- libraries/graphics/src/graphics/Haze.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/graphics/src/graphics/Haze.h b/libraries/graphics/src/graphics/Haze.h index c38fadef94..59138319f4 100644 --- a/libraries/graphics/src/graphics/Haze.h +++ b/libraries/graphics/src/graphics/Haze.h @@ -57,7 +57,7 @@ namespace graphics { // limit range and altitude to no less than 1.0 metres static inline float convertHazeRangeToHazeRangeFactor(const float hazeRange) { return -LOG_P_005 / glm::max(hazeRange, 1.0f); } - static inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeHeight) { return -LOG_P_005 / glm::max(hazeHeight, 1.0f); } + static inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeHeight) { return -(LOG_P_005 * glm::sign(hazeHeight)) / glm::max(glm::abs(hazeHeight), 1.0f); } // Derivation (s is the proportion of sun blend, a is the angle at which the blend is 50%, solve for m = 0.5 // s = dot(lookAngle, sunAngle) = cos(a)