varying vec3  eyeDir;
varying vec3  normal;
varying vec3  up;
varying float fog;

uniform sampler2D Color0;
uniform sampler2D Color1;
uniform sampler2D Color2;

float depth;

void main()
{
  vec3 e = normalize( eyeDir );
  vec3 n = normalize( normal );
  vec3 l = normalize( up );
  
  // fade out towards top and bottom of screen
  float mixVal = abs( e.y );

  float nDotL = dot( n, l );
  
  nDotL = max( nDotL, 0.2 );
  
  vec4 color = mix( texture2D( Color0, gl_TexCoord[0].st ), texture2D( Color2, gl_TexCoord[0].st ), mixVal );
  color = nDotL * color;
  color = mix( vec4( 0.5, 0.3, 0.5, 1.0 ), color, fog );
    
  // debug
  gl_FragColor = color;
  
  //gl_FragColor = vec4( n.x, n.y, n.z, 1.0 );
}
