summaryrefslogtreecommitdiff
path: root/advanced_lighting/8.deferred_shading/shaders/gbuffer.frag
diff options
context:
space:
mode:
Diffstat (limited to 'advanced_lighting/8.deferred_shading/shaders/gbuffer.frag')
-rw-r--r--advanced_lighting/8.deferred_shading/shaders/gbuffer.frag23
1 files changed, 23 insertions, 0 deletions
diff --git a/advanced_lighting/8.deferred_shading/shaders/gbuffer.frag b/advanced_lighting/8.deferred_shading/shaders/gbuffer.frag
new file mode 100644
index 0000000..5f82c0b
--- /dev/null
+++ b/advanced_lighting/8.deferred_shading/shaders/gbuffer.frag
@@ -0,0 +1,23 @@
+#version 330 core
+
+in vert_t {
+ vec3 position;
+ vec3 normal;
+ vec2 tex_coords;
+} vert;
+
+layout (location = 0) out vec3 position;
+layout (location = 1) out vec3 normal;
+layout (location = 2) out vec4 color_specular;
+
+uniform sampler2D texture_diffuse;
+
+void main()
+{
+ position = vert.position;
+ normal = vert.normal;
+ color_specular.rgb = texture(texture_diffuse, vert.tex_coords).rgb;
+ // TODO(pryazha): add specular texture
+ // color_specular.a = texture(texture_specular, vert.tex_coords).r;
+ color_specular.a = 1;
+}