summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/billboardPainter.frag
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-02-26 18:04:06 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-02-28 13:41:37 +0000
commit1e08193a1678675ac5869b76e8a2339f6de5b773 (patch)
treec9a47be9f06f69a06be2f43d371a88e1c507669e /gfx/gl/shaders/billboardPainter.frag
parentTidy the preFrame logic into a single function in SceneRenderer (diff)
downloadilt-1e08193a1678675ac5869b76e8a2339f6de5b773.tar.bz2
ilt-1e08193a1678675ac5869b76e8a2339f6de5b773.tar.xz
ilt-1e08193a1678675ac5869b76e8a2339f6de5b773.zip
Support for the BillboardPainter
Based on the ShadowStenciller, creates flattened images of a model for simplified mass use in a scene.
Diffstat (limited to 'gfx/gl/shaders/billboardPainter.frag')
-rw-r--r--gfx/gl/shaders/billboardPainter.frag22
1 files changed, 22 insertions, 0 deletions
diff --git a/gfx/gl/shaders/billboardPainter.frag b/gfx/gl/shaders/billboardPainter.frag
new file mode 100644
index 0000000..354f2ab
--- /dev/null
+++ b/gfx/gl/shaders/billboardPainter.frag
@@ -0,0 +1,22 @@
+#version 460 core
+
+layout(binding = 0) uniform sampler2D textureAlbedo;
+layout(location = 0) out vec4 bNormal;
+layout(location = 1) out vec4 bAlbedoSpec;
+
+include(`materialDetail.glsl')
+include(`materialCommon.glsl')
+in vec2 gTexCoords;
+in vec3 gNormal;
+in vec4 gColour;
+flat in MaterialDetail gMaterial;
+
+void
+main()
+{
+ vec4 textureColour = getTextureColour(gMaterial, gTexCoords);
+ float opaque = step(0.5, mix(textureColour.a, 1, gColour.a));
+ bNormal = vec4(gNormal, opaque);
+ gl_FragDepth = mix(1.0, gl_FragCoord.z, opaque);
+ bAlbedoSpec = mix(textureColour, vec4(gColour.rgb, 1), gColour.a);
+}