Move the fogCoord calculation to the shader to limit the number of varyings to 7
This commit is contained in:
parent
281445e31e
commit
16c73c0e5e
3 changed files with 2 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue