From 6521df3739796963bc41973872a9b338a3926ef3 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/ex2x.shader | 2 +- scripts/exx.shader | 20 +++---- scripts/logos.shader | 84 +++++++++++++++--------------- scripts/map_catharsis.shader | 2 +- scripts/map_warfare.shader | 4 +- scripts/model_desertfactory.shader | 10 ++-- scripts/model_tree.shader | 2 +- scripts/phillipk2x.shader | 8 +-- 8 files changed, 66 insertions(+), 66 deletions(-) diff --git a/scripts/ex2x.shader b/scripts/ex2x.shader index 5ca03aac..0e4d2187 100644 --- a/scripts/ex2x.shader +++ b/scripts/ex2x.shader @@ -57,7 +57,7 @@ textures/ex2x/base-chainlink { map textures/ex2x/base/base_chainlink.tga - alphafunc GE128 + alphaFunc GE128 } { map $lightmap diff --git a/scripts/exx.shader b/scripts/exx.shader index 2c42daa8..8e6903e6 100644 --- a/scripts/exx.shader +++ b/scripts/exx.shader @@ -420,7 +420,7 @@ textures/exx/floor-grate01 { map textures/exx/floor/floor_grate01.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -444,7 +444,7 @@ textures/exx/floor-grate01-cull { map textures/exx/floor/floor_grate01.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -469,7 +469,7 @@ textures/exx/floor-grate02 { map textures/exx/floor/floor_grate02.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -493,7 +493,7 @@ textures/exx/floor-grate02-cull { map textures/exx/floor/floor_grate02.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -518,7 +518,7 @@ textures/exx/floor-grate03 { map textures/exx/floor/floor_grate03.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -542,7 +542,7 @@ textures/exx/floor-grate03-cull { map textures/exx/floor/floor_grate03.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -567,7 +567,7 @@ textures/exx/floor-grate04 { map textures/exx/floor/floor_grate04.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -592,7 +592,7 @@ textures/exx/floor-grate04-cull { map textures/exx/floor/floor_grate04.tga - alphaFunc GT0 + alphaFunc GE128 } { map $lightmap @@ -1035,7 +1035,7 @@ textures/exx/panel-grate01 nomipmaps { map textures/exx/panel/panel_grate01.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen vertex } { @@ -1063,7 +1063,7 @@ textures/exx/panel-grate01-cull nomipmaps { map textures/exx/panel/panel_grate01.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen vertex } { diff --git a/scripts/logos.shader b/scripts/logos.shader index b0e72c22..07cd7b36 100644 --- a/scripts/logos.shader +++ b/scripts/logos.shader @@ -13,7 +13,7 @@ textures/logos/logo01_black { map textures/logos/logo01/logo01_black.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -34,7 +34,7 @@ textures/logos/logo01_blue { map textures/logos/logo01/logo01_blue.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -55,7 +55,7 @@ textures/logos/logo01_blue_glowy { map textures/logos/logo01/logo01_blueg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -76,7 +76,7 @@ textures/logos/logo01_cyan { map textures/logos/logo01/logo01_cyan.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -97,7 +97,7 @@ textures/logos/logo01_cyan_glowy { map textures/logos/logo01/logo01_cyang.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -118,7 +118,7 @@ textures/logos/logo01_red { map textures/logos/logo01/logo01_red.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -139,7 +139,7 @@ textures/logos/logo01_red_glowy { map textures/logos/logo01/logo01_redg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -160,7 +160,7 @@ textures/logos/logo01_green { map textures/logos/logo01/logo01_green.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -181,7 +181,7 @@ textures/logos/logo01_green_glowy { map textures/logos/logo01/logo01_greeng.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -202,7 +202,7 @@ textures/logos/logo01_purple { map textures/logos/logo01/logo01_purple.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -223,7 +223,7 @@ textures/logos/logo01_purple_glowy { map textures/logos/logo01/logo01_purpleg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -243,7 +243,7 @@ textures/logos/logo01_white { map textures/logos/logo01/logo01_white.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -264,7 +264,7 @@ textures/logos/logo01_yellow { map textures/logos/logo01/logo01_yellow.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -285,7 +285,7 @@ textures/logos/logo01_yellow_glowy { map textures/logos/logo01/logo01_yellowg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -306,7 +306,7 @@ textures/logos/logo02_red { map textures/logos/logo02/logo02_red.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -327,7 +327,7 @@ textures/logos/logo02_red_glowy { map textures/logos/logo02/logo02_redg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -347,7 +347,7 @@ textures/logos/logo02_black { map textures/logos/logo02/logo02_black.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -368,7 +368,7 @@ textures/logos/logo02_blue { map textures/logos/logo02/logo02_blue.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -389,7 +389,7 @@ textures/logos/logo02_blue_glowy { map textures/logos/logo02/logo02_blueg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -410,7 +410,7 @@ textures/logos/logo02_cyan { map textures/logos/logo02/logo02_cyan.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -431,7 +431,7 @@ textures/logos/logo02_cyan_glowy { map textures/logos/logo02/logo02_cyang.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -452,7 +452,7 @@ textures/logos/logo02_green { map textures/logos/logo02/logo02_green.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -473,7 +473,7 @@ textures/logos/logo02_green_glowy { map textures/logos/logo02/logo02_greeng.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -494,7 +494,7 @@ textures/logos/logo02_purple { map textures/logos/logo02/logo02_purple.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -515,7 +515,7 @@ textures/logos/logo02_purple_glowy { map textures/logos/logo02/logo02_purpleg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -535,7 +535,7 @@ textures/logos/logo02_white { map textures/logos/logo02/logo02_white.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -556,7 +556,7 @@ textures/logos/logo02_yellow { map textures/logos/logo02/logo02_yellow.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -577,7 +577,7 @@ textures/logos/logo02_yellow_glowy { map textures/logos/logo02/logo02_yellowg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -597,7 +597,7 @@ textures/logos/logo03_black { map textures/logos/logo03/logo03_black.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -618,7 +618,7 @@ textures/logos/logo03_blue { map textures/logos/logo03/logo03_blue.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -639,7 +639,7 @@ textures/logos/logo03_blue_glowy { map textures/logos/logo03/logo03_blueg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -660,7 +660,7 @@ textures/logos/logo03_cyan { map textures/logos/logo03/logo03_cyan.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -681,7 +681,7 @@ textures/logos/logo03_cyan_glowy { map textures/logos/logo03/logo03_cyang.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -702,7 +702,7 @@ textures/logos/logo03_green { map textures/logos/logo03/logo03_green.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -723,7 +723,7 @@ textures/logos/logo03_green_glowy { map textures/logos/logo03/logo03_greeng.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -744,7 +744,7 @@ textures/logos/logo03_purple { map textures/logos/logo03/logo03_purple.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -765,7 +765,7 @@ textures/logos/logo03_purple_glowy { map textures/logos/logo03/logo03_purpleg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -786,7 +786,7 @@ textures/logos/logo03_red { map textures/logos/logo03/logo03_red.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -807,7 +807,7 @@ textures/logos/logo03_red_glowy { map textures/logos/logo03/logo03_redg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -827,7 +827,7 @@ textures/logos/logo03_white { map textures/logos/logo03/logo03_white.tga - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -848,7 +848,7 @@ textures/logos/logo03_yellow { map textures/logos/logo03/logo03_yellow.tga blendFunc filter - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } @@ -869,7 +869,7 @@ textures/logos/logo03_yellow_glowy { map textures/logos/logo03/logo03_yellowg.tga blendFunc GL_SRC_ALPHA GL_ONE - alphaFunc GT0 + alphaFunc GE128 rgbgen identity } } diff --git a/scripts/map_catharsis.shader b/scripts/map_catharsis.shader index f05f609b..6d5be894 100644 --- a/scripts/map_catharsis.shader +++ b/scripts/map_catharsis.shader @@ -90,7 +90,7 @@ textures/map_catharsis/chain { map textures/map_catharsis/chain.tga tcMod scale 2 2 - alphafunc GE128 + alphaFunc GE128 } { map $lightmap diff --git a/scripts/map_warfare.shader b/scripts/map_warfare.shader index bf16eba4..e84971e0 100644 --- a/scripts/map_warfare.shader +++ b/scripts/map_warfare.shader @@ -57,7 +57,7 @@ textures/map_warfare/floor_panel polygonoffset { map textures/map_warfare/floor_panel - alphafunc GT0 + alphaFunc GE128 } { map $lightmap @@ -100,7 +100,7 @@ textures/map_warfare/cactus cull none { map textures/map_warfare/cactus - alphafunc GT0 + alphaFunc GE128 } { map $lightmap diff --git a/scripts/model_desertfactory.shader b/scripts/model_desertfactory.shader index 14989e53..13682f9a 100644 --- a/scripts/model_desertfactory.shader +++ b/scripts/model_desertfactory.shader @@ -51,7 +51,7 @@ models/desertfactory/textures/shaders/grates01 surfaceparm nomarks { map models/desertfactory/textures/metal/grates01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -65,7 +65,7 @@ models/desertfactory/textures/shaders/grass01 cull none { map models/desertfactory/textures/misc/grass01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -79,7 +79,7 @@ models/desertfactory/textures/shaders/grass02 cull none { map models/desertfactory/textures/misc/grass02.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -93,7 +93,7 @@ models/desertfactory/textures/shaders/vines01 cull none { map models/desertfactory/textures/misc/vines01.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } @@ -107,7 +107,7 @@ models/desertfactory/textures/shaders/sign_ladder_dirty qer_editorimage models/desertfactory/textures/shaders/sign_ladder_dirty.tga { map models/desertfactory/textures/signs/ladder_dirty.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } diff --git a/scripts/model_tree.shader b/scripts/model_tree.shader index 5aff9ff3..1aa00cac 100644 --- a/scripts/model_tree.shader +++ b/scripts/model_tree.shader @@ -11,7 +11,7 @@ models/grass02 deformVertexes wave 128 sin 0 1 0 0.1 { map models/grass02.tga - alphaFunc GT0 + alphaFunc GE128 rgbGen vertex } } diff --git a/scripts/phillipk2x.shader b/scripts/phillipk2x.shader index c86f4bac..f8e3ab7f 100644 --- a/scripts/phillipk2x.shader +++ b/scripts/phillipk2x.shader @@ -683,7 +683,7 @@ textures/phillipk2x/floor-pk02_floor07-trans cull none { map textures/phillipk2x/floor/pk02_floor07 - alphafunc GT0 + alphaFunc GE128 } { map $lightmap @@ -805,7 +805,7 @@ textures/phillipk2x/floor-pk02_floor10-trans cull none { map textures/phillipk2x/floor/pk02_floor10 - alphafunc GT0 + alphaFunc GE128 } { map $lightmap @@ -911,7 +911,7 @@ textures/phillipk2x/floor-pk02_floor13a-trans cull none { map textures/phillipk2x/floor/pk02_floor13a - alphafunc GT0 + alphaFunc GE128 } { map $lightmap @@ -957,7 +957,7 @@ textures/phillipk2x/floor-pk02_floor13b-trans cull none { map textures/phillipk2x/floor/pk02_floor13b - alphafunc GT0 + alphaFunc GE128 } { map $lightmap -- 2.39.2