Halflife: A bug with brightness allows to almost completely get rid of the shadows

Created on 22 Apr 2019  路  6Comments  路  Source: ValveSoftware/halflife

It seems that this happens because cvar brightness, unlike cvar gamma, has no restrictions on the range of acceptable values [0; 2].

Step-by-step reproduction:

  1. After starting client of game, we need to spawn any map, for example, execute the string map de_dust
  2. Select team and skin, spawn on map and executes following string in client console brightness 999;kill;wait;disconnect
  3. Next we connect to any game server and see the difference:

Before:
https://i.imgur.com/Whqs7Rk.jpg

After:
https://i.imgur.com/lxlewwY.jpg

Fix proposed

Most helpful comment

So, the limits will now be:
For CS:
lightgamma = 2.5
texgamma = 2.0
1.8 <= gamma <= 3.0
0.0 <= brightness <= 2.0

For non-CS multiplayer:
1.8 <= gamma/lightgamma/texgamma <= 3.0
0.0 <= brightness <= 2.0

For singleplayer:
1.8 <= gamma/lightgamma/texgamma <= 3.0
0.0 <= brightess <= 100.0

All 6 comments

The brightness cvar value is clamped internally but the cvar string value is not updated to reflect this.

However you are correct in that it is not reset properly to counter cheating. The function BuildGammaTable does this:

if ( g_bIsCStrike && sv_cheats.value == 0.0 )
{
  Cvar_DirectSet(&v_lightgamma, "2.5");
  Cvar_DirectSet(&v_texgamma, "2.0");
}

All cvars that can affect lighting in a way that can be used to cheat should be either clamped or forced to a hardcoded value to prevent abuse. Note that brightness and gamma both have sliders in the Video options dialog, so this may already be working as intended.

I agree, just like forcing the gamma and texgamma for CS I'll also force the brightness to its default of 0. I'll also fix setting the cvar value to instead Cvar_DirectSet so the string is updated as well.

Actually, I take that back. Since brightness and gamma are accessible via the settings they should probably be left in as configurable within that range unless there are more reports that they need to be fixed at certain values.

So, the limits will now be:
For CS:
lightgamma = 2.5
texgamma = 2.0
1.8 <= gamma <= 3.0
0.0 <= brightness <= 2.0

For non-CS multiplayer:
1.8 <= gamma/lightgamma/texgamma <= 3.0
0.0 <= brightness <= 2.0

For singleplayer:
1.8 <= gamma/lightgamma/texgamma <= 3.0
0.0 <= brightess <= 100.0

Fixed in beta 'Exe build: 11:12:36 May 21 2019 (8244)'.

I confirm, fixed. Now brightness is reset to valid ranges of values when trying to play multiplayer.

Was this page helpful?
0 / 5 - 0 ratings