jGame-Pathfinder/assets/shader/default.fsh.glsl

22 lines
529 B
Text
Raw Normal View History

2023-07-28 21:04:54 +02:00
#version 100
precision mediump float;
varying vec2 texcoord;
varying vec3 v_normal;
varying float v_position;
uniform sampler2D u_image0;
uniform vec2 fog;
void main() {
float fogAmount = smoothstep(fog.x, fog.y, v_position);
float light = -dot(vec3(0.0, -1.0, 0.0), v_normal) / 3.0 + 1.0 + (1.0/3.0);
gl_FragColor =
texture2D(u_image0, texcoord)
* vec4(1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount)
* vec4(light, light, light, 1.0);
if(gl_FragColor.a < 0.0000001)
discard;
}