zenyx-engine/shaders/shader.frag

19 lines
794 B
GLSL

#version 450
layout(location = 0) in vec2 tex_coords;
layout(location = 1) in vec3 normal;
layout(set = 1, binding = 0) uniform texture2D t_diffuse;
layout(set = 1, binding = 1) uniform sampler s_diffuse;
layout(location = 0) out vec4 out_color;
// layout(group = 0, binding = 0) out texture2D;
void main() {
float ambient = 0.2;
vec3 light_dir = normalize(vec3(0.5, 1.0, 0.5));
float diffuse = clamp(dot(normalize(normal), light_dir), 0.0, 1.0);
float brightness = ambient + (1.0 - ambient) * diffuse;
out_color = texture(sampler2D(t_diffuse, s_diffuse), tex_coords);
out_color.r = clamp(out_color.r * 0.6 * brightness, 0.0, 1.0);
out_color.g = clamp(out_color.g * 0.6 * brightness, 0.0, 1.0);
out_color.b = clamp(out_color.b * 0.9 * brightness, 0.0, 1.0);
}