shooter/SFML/examples/island/resources/terrain.frag

12 lines
397 B
GLSL
Raw Normal View History

2021-10-09 13:41:12 +03:00
varying vec3 normal;
uniform float lightFactor;
void main()
{
vec3 lightPosition = vec3(-1.0, 1.0, 1.0);
vec3 eyePosition = vec3(0.0, 0.0, 1.0);
vec3 halfVector = normalize(lightPosition + eyePosition);
float intensity = lightFactor + (1.0 - lightFactor) * dot(normalize(normal), normalize(halfVector));
gl_FragColor = gl_Color * vec4(intensity, intensity, intensity, 1.0);
}