Skip to content

Commit

Permalink
fog_fragment: Simplify away whiteComplement
Browse files Browse the repository at this point in the history
None of the `exp`s can return >1 or <0 given the new, necessarily non-positive, arguments.
  • Loading branch information
EliasHasle committed Apr 12, 2023
1 parent 184e987 commit 8f6bf87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ export default /* glsl */`
#ifdef FOG_EXP2
vec3 scaledFogPosition = fogDensity * vFogPosition;
float fogFactor = whiteComplement( exp( - dot( scaledFogPosition, scaledFogPosition ) ) );
float fogFactor = 1.0 - exp( - dot( scaledFogPosition, scaledFogPosition ) );
#endif
#ifdef FOG_EXP
float fogDepth = precisionSafeLength( fogDensity * vFogPosition );
float fogFactor = whiteComplement( exp( - fogDepth ) );
float fogFactor = 1.0 - exp( - fogDepth );
#endif
Expand Down

0 comments on commit 8f6bf87

Please sign in to comment.