From 7b7cd007a0047da276e65b625f67ceb5c66f170d Mon Sep 17 00:00:00 2001 From: Elias Hasle Date: Fri, 24 Mar 2023 12:35:55 +0100 Subject: [PATCH] FOG_EXP2: Modify order of multiplications to avoid possible over-/underflow on mediump --- src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js index 2b4f28252cd610..c0ae885ca4e78c 100644 --- a/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js @@ -3,7 +3,7 @@ export default /* glsl */` #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + float fogFactor = 1.0 - exp( - pow2( fogDensity * vFogDepth ) ); #else