Skip to content

Commit

Permalink
Reverted distance fog. See #14736 and #14786.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Aug 30, 2018
1 parent 37fb1d0 commit 63f6d20
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/renderers/shaders/ShaderChunk/fog_fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#ifdef USE_FOG

// float fogDepth = length( vFogPosition );
// mediump support: divide then multiply by max component

vec3 fogPositionAbs = abs( vFogPosition );
float fogMaxComponent = max( fogPositionAbs.x, max( fogPositionAbs.y, fogPositionAbs.z ) );
float fogDepth = length( vFogPosition / fogMaxComponent ) * fogMaxComponent;

#ifdef FOG_EXP2

float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef USE_FOG

uniform vec3 fogColor;
varying vec3 vFogPosition;
varying float fogDepth;

#ifdef FOG_EXP2

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef USE_FOG

varying vec3 vFogPosition;
varying float fogDepth;

#endif
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/fog_vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef USE_FOG

vFogPosition = mvPosition.xyz;
fogDepth = -mvPosition.z;

#endif

0 comments on commit 63f6d20

Please sign in to comment.