22 lines
534 B
GLSL
22 lines
534 B
GLSL
#version 330
|
|
|
|
in vec3 fragNormal;
|
|
in vec3 fragPosition;
|
|
|
|
uniform vec4 albedo;
|
|
uniform vec3 lightDir;
|
|
out vec4 fragColor;
|
|
|
|
void main() {
|
|
// Use uniform light direction, with fallback
|
|
vec3 light = normalize(lightDir);
|
|
float bandCount = 3.0;
|
|
|
|
vec3 normal = normalize(fragNormal);
|
|
|
|
float intensity = max(dot(normal, light), 0.0);
|
|
intensity = floor(intensity * bandCount) / bandCount;
|
|
intensity = max(intensity, 0.3); // Minimum visibility
|
|
|
|
fragColor = vec4(albedo.rgb * intensity, albedo.a);
|
|
} |