From a5893023485654e29e71338b05c95eb8847f455d 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/nexcompat-desertfactory.shader | 40 +++++++++++++------------- scripts/nexcompat-eX.shader | 2 +- scripts/nexcompat-evil1_grates.shader | 2 +- scripts/nexcompat-evil5.shader | 4 +-- scripts/nexcompat-evil6_floors.shader | 18 ++++++------ scripts/nexcompat-evil6_support.shader | 8 +++--- scripts/nexcompat-evil6_walls.shader | 8 +++--- scripts/nexcompat-kaznexctf2.shader | 2 +- scripts/nexcompat-mflag.shader | 2 +- scripts/nexcompat-reaper.shader | 2 +- scripts/nexcompat-strength.shader | 2 +- scripts/nexcompat-trak4.shader | 20 ++++++------- scripts/nexcompat-tree.shader | 10 +++---- 13 files changed, 60 insertions(+), 60 deletions(-) diff --git a/scripts/nexcompat-desertfactory.shader b/scripts/nexcompat-desertfactory.shader index 3515923..7120d4c 100644 --- a/scripts/nexcompat-desertfactory.shader +++ b/scripts/nexcompat-desertfactory.shader @@ -83,7 +83,7 @@ textures/desertfactory_shaders/grates01 surfaceparm nomarks { map textures/desertfactory_metal/grates01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -97,7 +97,7 @@ textures/desertfactory_shaders/grass01 cull none { map textures/desertfactory_misc/grass01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -111,7 +111,7 @@ textures/desertfactory_shaders/grass02 cull none { map textures/desertfactory_misc/grass02.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -125,7 +125,7 @@ textures/desertfactory_shaders/vines01 cull none { map textures/desertfactory_misc/vines01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -138,7 +138,7 @@ textures/desertfactory_shaders/sign_above_clean qer_editorimage textures/desertfactory_shaders/sign_above_clean.jpg { map textures/desertfactory_signs/above_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -148,7 +148,7 @@ textures/desertfactory_shaders/sign_explosion_clean qer_editorimage textures/desertfactory_shaders/sign_explosion_clean.jpg { map textures/desertfactory_signs/explosion_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -158,7 +158,7 @@ textures/desertfactory_shaders/sign_ladder_clean qer_editorimage textures/desertfactory_shaders/sign_ladder_clean.tga { map textures/desertfactory_signs/ladder_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -168,7 +168,7 @@ textures/desertfactory_shaders/sign_radioactive_clean qer_editorimage textures/desertfactory_shaders/sign_radioactive_clean.tga { map textures/desertfactory_signs/radioactive_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -178,7 +178,7 @@ textures/desertfactory_shaders/sign_shock_clean qer_editorimage textures/desertfactory_shaders/sign_shock_clean.tga { map textures/desertfactory_signs/shock_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -188,7 +188,7 @@ textures/desertfactory_shaders/sign_toxic_clean qer_editorimage textures/desertfactory_shaders/sign_toxic_clean.tga { map textures/desertfactory_signs/toxic_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -198,7 +198,7 @@ textures/desertfactory_shaders/sign_warning_clean qer_editorimage textures/desertfactory_shaders/sign_warning_clean.tga { map textures/desertfactory_signs/warning_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -208,7 +208,7 @@ textures/desertfactory_shaders/sign_wires_clean qer_editorimage textures/desertfactory_shaders/sign_wires_clean.tga { map textures/desertfactory_signs/wires_clean.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -218,7 +218,7 @@ textures/desertfactory_shaders/sign_above_dirty qer_editorimage textures/desertfactory_shaders/sign_above_dirty.tga { map textures/desertfactory_signs/above_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -228,7 +228,7 @@ textures/desertfactory_shaders/sign_explosion_dirty qer_editorimage textures/desertfactory_shaders/sign_explosion_dirty.tga { map textures/desertfactory_signs/explosion_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -238,7 +238,7 @@ textures/desertfactory_shaders/sign_ladder_dirty qer_editorimage textures/desertfactory_shaders/sign_ladder_dirty.tga { map textures/desertfactory_signs/ladder_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -248,7 +248,7 @@ textures/desertfactory_shaders/sign_radioactive_dirty qer_editorimage textures/desertfactory_shaders/sign_radioactive_dirty.tga { map textures/desertfactory_signs/radioactive_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -258,7 +258,7 @@ textures/desertfactory_shaders/sign_shock_dirty qer_editorimage textures/desertfactory_shaders/sign_shock_dirty.tga { map textures/desertfactory_signs/shock_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -268,7 +268,7 @@ textures/desertfactory_shaders/sign_toxic_dirty qer_editorimage textures/desertfactory_shaders/sign_toxic_dirty.tga { map textures/desertfactory_signs/toxic_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -278,7 +278,7 @@ textures/desertfactory_shaders/sign_warning_dirty qer_editorimage textures/desertfactory_shaders/sign_warning_dirty.tga { map textures/desertfactory_signs/warning_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -288,7 +288,7 @@ textures/desertfactory_shaders/sign_wires_dirty qer_editorimage textures/desertfactory_shaders/sign_wires_dirty.tga { map textures/desertfactory_signs/wires_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } diff --git a/scripts/nexcompat-eX.shader b/scripts/nexcompat-eX.shader index c55041c..79b1e86 100644 --- a/scripts/nexcompat-eX.shader +++ b/scripts/nexcompat-eX.shader @@ -154,7 +154,7 @@ textures/eX/eX_floor_grate03 map textures/exx/floor/floor_grate01.tga rgbGen identity depthWrite - alphafunc GT0 + alphaFunc GE128 } { map $lightmap diff --git a/scripts/nexcompat-evil1_grates.shader b/scripts/nexcompat-evil1_grates.shader index 6a86f7a..b02caa3 100644 --- a/scripts/nexcompat-evil1_grates.shader +++ b/scripts/nexcompat-evil1_grates.shader @@ -10,7 +10,7 @@ textures/evil1_grates/flrgrt_h { map textures/evil1_grates/flrgrt_h.tga //depthWrite - alphaFunc GT0 + alphaFunc GE128 rgbgen vertex } } diff --git a/scripts/nexcompat-evil5.shader b/scripts/nexcompat-evil5.shader index d48ebd7..baa661d 100644 --- a/scripts/nexcompat-evil5.shader +++ b/scripts/nexcompat-evil5.shader @@ -37,12 +37,12 @@ textures/evil5_floor/tekconfllr_fx { map textures/evil5_floor/tekconfllr_fx.tga tcmod scroll 0 .9 - alphafunc GE128 + alphaFunc GE128 depthwrite } { map textures/evil5_floor/tekconfllr.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { diff --git a/scripts/nexcompat-evil6_floors.shader b/scripts/nexcompat-evil6_floors.shader index d21be28..06c7928 100644 --- a/scripts/nexcompat-evil6_floors.shader +++ b/scripts/nexcompat-evil6_floors.shader @@ -7,7 +7,7 @@ textures/evil6_floors/e6bsegrtflr128_s cull none { map textures/evil6_floors/e6bsegrtflr128.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -26,7 +26,7 @@ textures/evil6_floors/e6bsegrtflr256_s cull none { map textures/evil6_floors/e6bsegrtflr256.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -45,7 +45,7 @@ textures/evil6_floors/e6grate_flr_b_s cull none { map textures/evil6_floors/e6grate_flr_b.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -64,7 +64,7 @@ textures/evil6_floors/e6grate_flr_s cull none { map textures/evil6_floors/e6grate_flr.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -83,7 +83,7 @@ textures/evil6_floors/e6grtfloorceil_s cull none { map textures/evil6_floors/e6grtfloorceil.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -102,7 +102,7 @@ textures/evil6_floors/e6grate2_flr_s cull none { map textures/evil6_floors/e6grate2_flr.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -121,7 +121,7 @@ textures/evil6_floors/e6grate2_flr_b_s cull none { map textures/evil6_floors/e6grate2_flr_b.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -301,7 +301,7 @@ textures/evil6_floors/e6xgratebasic_b_s cull none { map textures/evil6_floors/e6xgratebasic_b.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -320,7 +320,7 @@ textures/evil6_floors/e6xgratebasic_s cull none { map textures/evil6_floors/e6xgratebasic.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { diff --git a/scripts/nexcompat-evil6_support.shader b/scripts/nexcompat-evil6_support.shader index aa15961..c15c883 100644 --- a/scripts/nexcompat-evil6_support.shader +++ b/scripts/nexcompat-evil6_support.shader @@ -7,7 +7,7 @@ textures/evil6_support/e6h_support_s cull none { map textures/evil6_support/e6h_support.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -26,7 +26,7 @@ textures/evil6_support/e6holestrip_s cull none { map textures/evil6_support/e6holestrip.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -81,7 +81,7 @@ textures/evil6_support/e6x_supprt_s cull none { map textures/evil6_support/e6x_supprt.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -100,7 +100,7 @@ textures/evil6_support/e6xrst_supprt_s cull none { map textures/evil6_support/e6xrst_supprt.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { diff --git a/scripts/nexcompat-evil6_walls.shader b/scripts/nexcompat-evil6_walls.shader index 59dd9e2..350aea3 100644 --- a/scripts/nexcompat-evil6_walls.shader +++ b/scripts/nexcompat-evil6_walls.shader @@ -11,7 +11,7 @@ textures/evil6_walls/e6girdergrate_s cull none { map textures/evil6_walls/e6girdergrate.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -32,7 +32,7 @@ textures/evil6_walls/e6girdergrate2b_s cull none { map textures/evil6_walls/e6girdergrate2b.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -53,7 +53,7 @@ textures/evil6_walls/e6girdersupport_s cull none { map textures/evil6_walls/e6girdersupport.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { @@ -74,7 +74,7 @@ textures/evil6_walls/e6indsdoor_s cull none { map textures/evil6_walls/e6indsdoor.tga - alphafunc GE128 + alphaFunc GE128 depthwrite } { diff --git a/scripts/nexcompat-kaznexctf2.shader b/scripts/nexcompat-kaznexctf2.shader index 7ff1c03..c0af773 100644 --- a/scripts/nexcompat-kaznexctf2.shader +++ b/scripts/nexcompat-kaznexctf2.shader @@ -174,7 +174,7 @@ textures/kaznexctf2/grate3 { map textures/kaznexctf2/grate3.tga //depthWrite - alphaFunc GT0 + alphaFunc GE128 rgbgen vertex } } diff --git a/scripts/nexcompat-mflag.shader b/scripts/nexcompat-mflag.shader index bfa2f3e..6c236f7 100644 --- a/scripts/nexcompat-mflag.shader +++ b/scripts/nexcompat-mflag.shader @@ -5,7 +5,7 @@ mflagshader tessSize 32 { map models/mflag/flag.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } diff --git a/scripts/nexcompat-reaper.shader b/scripts/nexcompat-reaper.shader index ffeeac5..444f9bb 100644 --- a/scripts/nexcompat-reaper.shader +++ b/scripts/nexcompat-reaper.shader @@ -98,7 +98,7 @@ textures/shad/shad surfaceparm trans { map *default - alphaFunc GT0 + alphaFunc GE128 alphagen const 0.0 } } diff --git a/scripts/nexcompat-strength.shader b/scripts/nexcompat-strength.shader index 67f6bbd..d8fe960 100644 --- a/scripts/nexcompat-strength.shader +++ b/scripts/nexcompat-strength.shader @@ -472,7 +472,7 @@ textures/evil6_walls/e6girdergrate2b-trans map textures/evil6_walls/e6girdergrate2b-trans.tga rgbGen identity depthWrite - alphafunc GE128 + alphaFunc GE128 } { map $lightmap diff --git a/scripts/nexcompat-trak4.shader b/scripts/nexcompat-trak4.shader index 9492ed0..724359d 100644 --- a/scripts/nexcompat-trak4.shader +++ b/scripts/nexcompat-trak4.shader @@ -8,7 +8,7 @@ textures/trak4/northwing surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -28,7 +28,7 @@ textures/trak4/southwing surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -48,7 +48,7 @@ textures/trak4/help surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -67,7 +67,7 @@ textures/trak4/pills surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -87,7 +87,7 @@ textures/trak4/theater1 surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -107,7 +107,7 @@ textures/trak4/theater2 surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -127,7 +127,7 @@ textures/trak4/exit surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -147,7 +147,7 @@ textures/trak4/iso1 surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -167,7 +167,7 @@ textures/trak4/iso2 surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { @@ -187,7 +187,7 @@ textures/trak4/iso3 surfaceparm nonsolid { map $lightmap - alphaFunc GT0 + alphaFunc GE128 rgbGen identity } { diff --git a/scripts/nexcompat-tree.shader b/scripts/nexcompat-tree.shader index f047b44..2ae5cc1 100644 --- a/scripts/nexcompat-tree.shader +++ b/scripts/nexcompat-tree.shader @@ -11,7 +11,7 @@ leaves2 deformVertexes wave 128 sin 0 1 0 0.4 { map textures/leaves2.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -29,7 +29,7 @@ cull none deformVertexes wave 128 sin 0 1 0 0.4 { map textures/leaves6.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -46,7 +46,7 @@ cull none deformVertexes wave 128 sin 0 1 0 0.2 { map textures/grass.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -64,7 +64,7 @@ grass02 deformVertexes wave 128 sin 0 1 0 0.1 { map textures/grass2.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -81,7 +81,7 @@ cull none deformVertexes wave 128 sin 0 1 0 0.5 { map textures/leaves7.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } -- 2.39.2