ho3/resources/shaders/directlight.fragment

23 lines
502 B
Plaintext
Raw Permalink Normal View History

2024-06-06 13:25:38 +00:00
uniform sampler2D Texture;
uniform float FogBeginDistance;
uniform float FogEndDistance;
varying vec2 texCoord;
varying vec3 vertexPos;
void main()
{
2024-06-08 17:55:56 +00:00
vec4 texColor = texture2D(Texture,texCoord).rgba;
2024-06-06 13:25:38 +00:00
2024-06-08 17:55:56 +00:00
vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0);
2024-06-06 13:25:38 +00:00
2024-06-08 17:55:56 +00:00
float fogDistCoef = (vertexPos.z - FogBeginDistance) / (FogEndDistance - FogBeginDistance);
2024-06-06 13:25:38 +00:00
2024-06-08 17:55:56 +00:00
fogDistCoef = clamp(fogDistCoef, 0.0, 1.0);
2024-06-06 13:25:38 +00:00
2024-06-08 17:55:56 +00:00
vec4 resultColor = mix(texColor, fogColor, fogDistCoef);
2024-06-06 13:25:38 +00:00
2024-06-08 17:55:56 +00:00
gl_FragColor = vec4(resultColor.rgb, 1.0);
2024-06-06 13:25:38 +00:00
}