From 900d19a41bc1886e7a809d99d6119b12235a4f0a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jul 2024 10:57:17 +0100 Subject: Initial commit of basic shadow depth map creation --- gfx/gl/shaders/shadowStencil.fs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gfx/gl/shaders/shadowStencil.fs (limited to 'gfx/gl/shaders/shadowStencil.fs') diff --git a/gfx/gl/shaders/shadowStencil.fs b/gfx/gl/shaders/shadowStencil.fs new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From f737aada2b7164683303beb3bb490c30a4949fb0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 21 Jul 2024 02:33:24 +0100 Subject: Use texture alpha in shadow stencil --- gfx/gl/shaders/shadowStencil.fs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gfx/gl/shaders/shadowStencil.fs') diff --git a/gfx/gl/shaders/shadowStencil.fs b/gfx/gl/shaders/shadowStencil.fs index e69de29..f149c23 100644 --- a/gfx/gl/shaders/shadowStencil.fs +++ b/gfx/gl/shaders/shadowStencil.fs @@ -0,0 +1,16 @@ +#version 330 core +#extension GL_ARB_shading_language_420pack : enable + +layout(binding = 0) uniform sampler2D textureAlbedo; + +include(`materialInterface.glsl') +include(`materialCommon.glsl') + +void +main() +{ + if (getTextureColour(Material, TexCoords).a < 0.5) { + discard; + } + gl_FragDepth = gl_FragCoord.z; +} -- cgit v1.2.3 From f22f79330f9b8851cda76d1e11555877cbb72d80 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 3 Sep 2024 01:37:03 +0100 Subject: Populate all layers of the stencil texture Albeit with the same projection --- gfx/gl/shaders/shadowStencil.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gfx/gl/shaders/shadowStencil.fs') diff --git a/gfx/gl/shaders/shadowStencil.fs b/gfx/gl/shaders/shadowStencil.fs index f149c23..1164cc9 100644 --- a/gfx/gl/shaders/shadowStencil.fs +++ b/gfx/gl/shaders/shadowStencil.fs @@ -3,13 +3,15 @@ layout(binding = 0) uniform sampler2D textureAlbedo; -include(`materialInterface.glsl') +include(`materialDetail.glsl') include(`materialCommon.glsl') +in vec2 gTexCoords; +flat in MaterialDetail gMaterial; void main() { - if (getTextureColour(Material, TexCoords).a < 0.5) { + if (getTextureColour(gMaterial, gTexCoords).a < 0.5) { discard; } gl_FragDepth = gl_FragCoord.z; -- cgit v1.2.3