opengl-deferred/assets/shader/deferred/deferred.vs
2024-10-11 18:38:21 +02:00

32 lines
639 B
GLSL

#version 460
struct material_t {
sampler2D albedo;
sampler2D normal;
sampler2D specular;
sampler2D rougness;
sampler2D metalic;
};
layout (std140) buffer material_buffer {
material_t materials[];
};
in vec3 pos;
in vec3 norm;
in vec2 tex;
in uint id;
out vec3 position;
out vec3 albedo;
out vec3 normal;
out vec3 material;
void main() {
position = pos;
albedo = texture(materials[id].albedo, tex).rgb;
normal = texture(materials[id].normal, tex).rgb;
material.x = texture(materials[id].specular, tex).x;
material.y = texture(materials[id].rougness, tex).y;
material.z = texture(materials[id].metalic, tex).z;
}