diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index 1eac87bb..8737f834 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -2493,7 +2493,7 @@ static qboolean CollapseStagesToGLSL(void) // convert any remaining lightmap stages to a lighting pass with a white texture // only do this with r_sunlightMode non-zero, as it's only for correct shadows. - if (r_sunlightMode->integer) + if (r_sunlightMode->integer && shader.numDeforms == 0) { for (i = 0; i < MAX_SHADER_STAGES; i++) { @@ -2502,6 +2502,9 @@ static qboolean CollapseStagesToGLSL(void) if (!pStage->active) continue; + if (pStage->adjustColorsForFog) + continue; + if (pStage->bundle[TB_DIFFUSEMAP].isLightmap) { pStage->glslShaderGroup = tr.lightallShader; @@ -2516,17 +2519,23 @@ static qboolean CollapseStagesToGLSL(void) } // convert any remaining lightingdiffuse stages to a lighting pass - for (i = 0; i < MAX_SHADER_STAGES; i++) + if (shader.numDeforms == 0) { - shaderStage_t *pStage = &stages[i]; - - if (!pStage->active) - continue; - - if (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE) + for (i = 0; i < MAX_SHADER_STAGES; i++) { - pStage->glslShaderGroup = tr.lightallShader; - pStage->glslShaderIndex = LIGHTDEF_USE_LIGHT_VECTOR; + shaderStage_t *pStage = &stages[i]; + + if (!pStage->active) + continue; + + if (pStage->adjustColorsForFog) + continue; + + if (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE) + { + pStage->glslShaderGroup = tr.lightallShader; + pStage->glslShaderIndex = LIGHTDEF_USE_LIGHT_VECTOR; + } } }