@@ -924,7 +924,11 @@ void Render_generic3D( shaderStage_t *pStage )
924
924
colorGen_t rgbGen = SetRgbGen ( pStage );
925
925
alphaGen_t alphaGen = SetAlphaGen ( pStage );
926
926
927
- gl_genericShader->SetUniform_ColorModulate ( rgbGen, alphaGen );
927
+ // Here, it's safe to multiply the overbright factor for vertex lighting into the color gen`
928
+ // since the `generic` fragment shader only takes a single input color. `lightMapping` on the
929
+ // hand needs to know the real diffuse color, hence the separate u_LightFactor.
930
+ bool mayUseVertexOverbright = pStage->type == stageType_t::ST_COLORMAP && tess.bspSurface ;
931
+ gl_genericShader->SetUniform_ColorModulate ( rgbGen, alphaGen, mayUseVertexOverbright );
928
932
929
933
// u_Color
930
934
gl_genericShader->SetUniform_Color ( tess.svars .color );
@@ -1121,7 +1125,8 @@ void Render_lightMapping( shaderStage_t *pStage )
1121
1125
gl_lightMappingShader->SetUniform_Time ( backEnd.refdef .floatTime - backEnd.currentEntity ->e .shaderTime );
1122
1126
1123
1127
// u_LightFactor
1124
- gl_lightMappingShader->SetUniform_LightFactor ( tr.mapLightFactor );
1128
+ gl_lightMappingShader->SetUniform_LightFactor (
1129
+ lightMode == lightMode_t::FULLBRIGHT ? 1 .0f : tr.mapLightFactor );
1125
1130
1126
1131
// u_ColorModulate
1127
1132
gl_lightMappingShader->SetUniform_ColorModulate ( rgbGen, alphaGen );
@@ -2565,6 +2570,11 @@ void Tess_ComputeColor( shaderStage_t *pStage )
2565
2570
}
2566
2571
}
2567
2572
2573
+ if ( pStage->type == stageType_t::ST_STYLELIGHTMAP || pStage->type == stageType_t::ST_STYLECOLORMAP )
2574
+ {
2575
+ tess.svars .color *= tr.mapLightFactor ;
2576
+ }
2577
+
2568
2578
// alphaGen
2569
2579
switch ( pStage->alphaGen )
2570
2580
{
0 commit comments