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

24 lines
547 B
Forth
Raw Normal View History

2023-05-19 13:14:48 +02:00
#version 330
2023-05-21 10:19:04 +02:00
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);
2023-05-19 13:14:48 +02:00
}