This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
api8/shaders/tag.fs
2023-05-21 10:19:04 +02:00

23 lines
547 B
GLSL

#version 330
in vec3 vsoNormal;
in vec4 vsoModPos;
in vec2 vsoTexCoord;
out vec4 fragColor;
uniform sampler2D tex0;
uniform mat4 viewMatrix;
uniform vec4 lumPos;
void main(void) {
const vec3 Vu = vec3(0, 0, -1);
vec4 lumPosv = viewMatrix * lumPos;
vec3 Ld = normalize(vsoModPos - lumPosv).xyz;
vec3 reflexion = normalize(reflect(Ld, vsoNormal));
float ispec = pow(clamp(dot(-Vu, reflexion), 0., 1.), 20);
float phongIL = clamp(dot(-Ld, vsoNormal), 0., 1.);
fragColor = phongIL * texture(tex0, vsoTexCoord) + ispec * vec4(1);
}