From 6029f910f2940ff45af201f377559856c1d83052 Mon Sep 17 00:00:00 2001 From: SomaZ <17459161+SomaZ@users.noreply.github.com> Date: Tue, 14 May 2024 00:58:52 +0200 Subject: [PATCH] [rend2] Fix korriban shaders with multiply blend stages Stages that are used to get some more detail shouldnt be collapsed with lighting because it will multiply lighting again and again which leads to incorrect darkening --- shared/rd-rend2/tr_shader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/rd-rend2/tr_shader.cpp b/shared/rd-rend2/tr_shader.cpp index 1f6556b5b0..74510362b1 100644 --- a/shared/rd-rend2/tr_shader.cpp +++ b/shared/rd-rend2/tr_shader.cpp @@ -3372,6 +3372,14 @@ static qboolean CollapseStagesToGLSL(void) if (pStage->bundle[0].tcGen >= TCGEN_LIGHTMAP && pStage->bundle[0].tcGen <= TCGEN_LIGHTMAP3) continue; + if (i > 0) + { + int blendBits = pStage->stateBits & (GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS); + if (blendBits == (GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO) || + blendBits == (GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR)) + continue; + } + diffuse = pStage; parallax = qfalse; lightmap = NULL;