ho3/resources/shaders/directlight.fragment
2024-06-08 20:55:56 +03:00

23 lines
502 B
Plaintext

uniform sampler2D Texture;
uniform float FogBeginDistance;
uniform float FogEndDistance;
varying vec2 texCoord;
varying vec3 vertexPos;
void main()
{
vec4 texColor = texture2D(Texture,texCoord).rgba;
vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0);
float fogDistCoef = (vertexPos.z - FogBeginDistance) / (FogEndDistance - FogBeginDistance);
fogDistCoef = clamp(fogDistCoef, 0.0, 1.0);
vec4 resultColor = mix(texColor, fogColor, fogDistCoef);
gl_FragColor = vec4(resultColor.rgb, 1.0);
}