Forcing Color Correction for all player, even if disabled

ficool2

L4: Comfortable Member
Oct 28, 2017
161
232
There exists an entity named color_correction which as the name suggests, applies color correction to each player. However, the downside is that players can toggle this effect off in their graphic options, hence making it worthless if you want all players to see the effect. This hacky workaround will force the effect to display for all players, even if they have it disabled:

1: Create and setup a color_correction entity as usual
2: Create a logic_auto entity and fire the Disable input onto the color_correction entity, this will prevent players with color correction enabled from having the effect stacked twice
UPDATE: Disabling the color correction entity can cause flickering on certain maps. With VScript this can be fixed another way. Instead of disabling the entity, the color correction weight can be set to a near-zero value, which achieves the same practical effect without flickering problems. Example output on a logic_auto entity:

OnMapSpawn | color_correction | RunScriptCode | NetProps.SetPropFloat(self, `m_flCurWeight`, 0.000001)

3: Download this .vmt and add it to your custom files, preferrably inside a folder named 'hud'. This material will display the color correction (Remember to pack it into the .bsp too)
4: Apply the .vmt to players via env_screenoverlay or point_clientcommand -> r_screenoverlay (the latter will allow you to apply color correction per-player and not globally)
UPDATE: With VScript there is now a second easier overlay that can be used. Apply the .vmt to players via the SetScriptOverlayMaterial material. For example:

OnStartTouch | !activator | SetScriptOverlayMaterial | hud/colorcorrect

Players will now have their screen applied with color correction

Unfortunately, this comes with some caveats:
  • Players using DirectX 8 will not see the effect (DX8 does not support color correction at all)
  • Afterburn, jarate, uber and bleeding will remove the overlay. To workaround this, re-apply the screenoverlay to all players every tick by using a timer
UPDATE: No longer an issue with SetScriptOverlayMaterial, which uses an independent overlay that does not get overriden by other effects.
  • This consumes a screenoverlay, meaning you can't stack other screenoverlays ontop of the color correction
UPDATE: A second overlay can be stacked using the old method of env_screenoverlay or point_clientcommand -> r_screenoverlay
  • color_correction entity inputs don't affect the color correction, the color correction can only be toggled via disabling the overlay or material proxies

To adjust the strength of the color correction, modify the $WEIGHT parameters in the .vmt
A custom "input" texture can be specified but I have not tested what this does. To try it out, set $USE_FB_TEXTURE in the vmt to 0, and uncomment $INPUT_TEXTURE.

UPDATE: Updated VMT download after a discovery that setting $WEIGHT_DEFAULT to a value higher than 0.0 will cause graphical glitches, this is now set to 0.0. This also fixes the color correction being slightly inaccurate
21/09/23 UPDATE: Updated guide with content available after VScript
 
Last edited:

adam2

(no affiliation with adam1)
aa
Jan 2, 2020
35
46
is the dx8 issue still a thing with the recent 64-bit update
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,259
999
Said VMT
Code:
"ColorCorrection"
{
    "$WEIGHT_DEFAULT" "0.0"
    "$WEIGHT0" "1.0"
    "$WEIGHT1" "1.0"
    "$WEIGHT2" "1.0"
    "$WEIGHT3" "1.0"
    "$NUM_LOOKUPS" "1"
    "$USE_FB_TEXTURE" "1"
    // Set USE_FB_TEXTURE to 0 if you want to use this
    // $INPUT_TEXTURE "test/test123mat"
    
    // For DirectX 8 users, this will just make the material display nothing
    "<dx90"
    {
        "$no_draw" "1"
    }
}