opengl-deferred/assets/shader/deferred/deferred.vs

32 lines
639 B
Plaintext
Raw Normal View History

2024-10-11 16:38:21 +00:00
#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;
}