From 4e25976b3ca3fae25fe93f2eceb7fd95a8ba037d Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Thu, 9 Jan 2020 10:27:03 +0100 Subject: [PATCH] DarkPlaces does not support alphaFunc GT0 and uses GE128 instead By making this change, we ensure the materials look the same on DarkPlaces and other engines, even in the case it's wrong on DarkPlaces because Xonotic mappers now expect the wrong behavior. Darkplaces only supports one alphaFunc operation, it only reads the alphaFunc keyword and does not read the function name: https://gitlab.com/xonotic/darkplaces/blob/324a5329d33ef90df59e6488abce6433d90ac04c/model_shared.c#L1875-1876 It then uses the GE128 operator unconditionally: https://gitlab.com/xonotic/darkplaces/blob/0ea8f691e05ea968bb8940942197fa627966ff99/render.h#L95 People may silently introduce regressions in their textures designed for GT0 by compressing them using a lossy picture format like Jpg. Xonotic texture known to trigger this bug (in xonotic-maps): models/desertfactory/textures/shaders/grass01.jpg Using GE128 hides Jpeg artifacts while it's possible a TGA version worked with GT0. Xonotic texture that may benefit from GT0 if supported (in xonotic-maps): models/desertfactory/textures/shaders/sign_ladder_dirty.jpg By storing this texture in lossless format and making sure the frame is pure black and the ladder is a bit less black than pure black, only the frame would be transparent. Unfortunately, after years of GE128 usagen displaying the texture with GT0 operation would be a regression. Note: I also renamed some `alphafunc` to `alphaFunc` even if it was already GE128. --- scripts/electro.shader | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/electro.shader b/scripts/electro.shader index f87b86c8d..8901438e8 100644 --- a/scripts/electro.shader +++ b/scripts/electro.shader @@ -10,7 +10,7 @@ electro_plasma_hull { { map textures/electro_plasma_hull.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen Vertex } } @@ -22,4 +22,4 @@ electro map textures/electronew.tga rgbgen lightingDiffuse } -} \ No newline at end of file +} -- 2.39.2