1
0
Fork 0

Move the fogCoord calculation to the shader to limit the number of varyings to 7

This commit is contained in:
Erik Hofman 2011-07-16 11:52:54 +02:00
parent 281445e31e
commit 16c73c0e5e
3 changed files with 2 additions and 5 deletions

View file

@ -7,7 +7,6 @@ varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 Normal;
varying vec4 constantColor;
varying float bump;
uniform sampler3D NoiseTex;
uniform sampler2D BaseTex;

View file

@ -12,7 +12,6 @@ varying vec3 reflVec;
varying vec4 Diffuse;
varying float alpha;
varying float fogCoord;
uniform samplerCube Environment;
uniform sampler2D Rainbow;
@ -58,6 +57,8 @@ void main (void)
// calculate the fog factor
const float LOG2 = 1.442695;
float fogCoord = abs(ecPosition.z);
// float fogCoord = abs(ecPosition.z / ecPosition.w);
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);

View file

@ -10,7 +10,6 @@ varying vec3 reflVec;
varying vec4 Diffuse;
varying float alpha;
varying float fogCoord;
uniform mat4 osg_ViewMatrixInverse;
@ -37,8 +36,6 @@ void main(void)
else
alpha = gl_Color.a;
fogCoord = abs(ecPosition.z);
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;