-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.fs
More file actions
executable file
·32 lines (24 loc) · 802 Bytes
/
Copy pathbasic.fs
File metadata and controls
executable file
·32 lines (24 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#version 330 core
in vec2 UV;
in vec3 normal;
in vec3 fragPos;
out vec4 color;
uniform vec3 lightPos;
uniform vec3 viewPos;
uniform sampler2D texture_sampler;
void main() {
float ambientStrength = 0.1f;
float specularStrength = 0.6f;
vec3 lightColor = vec3(1.0, 1.0, 1.0);
// diffuse
vec3 lightDir = normalize(lightPos - fragPos);
vec3 diff = max(dot(normal, lightDir), 0.0) * lightColor;
// Specular
vec3 viewDir = normalize(viewPos - fragPos);
vec3 reflectDir = reflect(-lightDir, normal);
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);
vec3 specular = specularStrength * spec * lightColor;
//color = vec4((ambientStrength + diff + specular)/* * normal.xyz*/, 1.0);
color = vec4(normal, 0.0);
//color = texture(texture_sampler, UV);
}