opengl-deferred/assets/shader/deferred/deferred.fs

26 lines
632 B
Forth
Raw Normal View History

2024-10-11 16:38:21 +00:00
#version 460 core
2024-10-11 23:02:12 +00:00
uniform sampler2D s_albedo;
uniform sampler2D s_normal;
uniform sampler2D s_specular;
uniform sampler2D s_roughness;
uniform sampler2D s_metalic;
2024-10-11 16:38:21 +00:00
2024-10-11 23:02:12 +00:00
in vec3 pos;
in vec3 norm;
in vec2 tex;
2024-10-11 16:38:21 +00:00
2024-10-12 02:03:59 +00:00
layout (location = 0) out vec3 albedo;
layout (location = 1) out vec3 normal;
layout (location = 2) out vec3 material;
layout (location = 3) out vec3 position;
2024-10-11 16:38:21 +00:00
void main() {
2024-10-11 23:02:12 +00:00
position = pos;
albedo = texture(s_albedo, tex).rgb;
2024-10-15 14:52:21 +00:00
normal = normalize(texture(s_normal, tex).rgb * 2.0 - 1.0);
2024-10-11 23:02:12 +00:00
material.x = texture(s_specular, tex).x;
material.y = texture(s_roughness, tex).y;
material.z = texture(s_metalic, tex).z;
}