Skip to content

Commit

Permalink
Merge pull request #14633 from greggman/distance-fog
Browse files Browse the repository at this point in the history
distance fog
  • Loading branch information
mrdoob authored Aug 3, 2018
2 parents 10e1b75 + 54bebd9 commit 3ba7d2b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/renderers/shaders/ShaderChunk/fog_fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ifdef USE_FOG

float fogDepth = length(fogPosition);

#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 float fogDepth;
varying vec3 fogPosition;

#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 float fogDepth;
varying vec3 fogPosition;

#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,4 +1,4 @@

#ifdef USE_FOG
fogDepth = -mvPosition.z;
fogPosition = mvPosition.xyz;
#endif

0 comments on commit 3ba7d2b

Please sign in to comment.