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

27 lines
653 B
GLSL

#version 460 core
uniform sampler2D s_albedo;
uniform sampler2D s_normal;
uniform sampler2D s_specular;
uniform sampler2D s_roughness;
uniform sampler2D s_metalic;
in vec3 pos;
in vec3 norm;
in vec2 tex;
in mat3 TBN;
layout (location = 0) out vec3 albedo;
layout (location = 1) out vec3 normal;
layout (location = 2) out vec3 material;
layout (location = 3) out vec3 position;
void main() {
albedo = texture(s_albedo, tex).rgb;
normal = normalize(TBN * (texture(s_normal, tex).rgb * 2.0 - 1.0));
material.x = texture(s_specular, tex).x;
material.y = texture(s_roughness, tex).y;
material.z = texture(s_metalic, tex).z;
position = pos;
}