Team Fortress 2

Team Fortress 2

Unclamped Lightwarps Fix
16
2
4
2
2
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
142.583 KB
5 Mar, 2023 @ 12:19pm
9 Mar, 2023 @ 6:06am
1 Change Note ( view )

Would you like to see this item officially accepted and supported in Team Fortress 2?

Yes
No thanks /
Not interested
Ask me
again later
Description
Clamps most of the game's unclamped lightwarps (and some phongwarps)

Explanation:
Instead of using a flat dark-to-light gradient for lighting (as you would see in HL2 or Portal for example), Team Fortress 2 uses lightwarps for most things, which replaces the normal flat lighting gradient with unique lighting gradients that gives the game its stylized shading. By default, textures in the Source Engine are tiled and have texture filtering applied, which blends nearby colors together. The combination of tiling and texture filtering being applied to a lightwarp texture causes the leftmost pixel (usually a dark color) to bleed into the rightmost pixel (usually a light color) and vice versa. What you effectively end up with is a dark-to-light gradient that has 1 pixel of light at the far left, and one pixel of dark at the far right. This causes the shading of a model to actually have a light spot where it should be at its darkest, and a dark spot where the lighting is the most intense. By marking a texture as clamped, the texture is not tiled and this problem doesn't occur. Many lightwarps in the game are in fact already clamped and don't have this issue, but there are a lot of lightwarps that aren't correctly clamped. While it may be difficult to notice this in game, as only the brightest and darkest shaded parts of a model are affected, it's a problem nonetheless.

This submission marks most lightwarps as clamped, and, in a few special cases where a texture is used as a 2D phongwarp AND a lightwarp, adds a clamped copy of the texture(this way the clamped version can be used as a lightwarp and the unclamped version as a 2D phongwarp). In these cases, the materials that reference them are updated too. Some 1D phongwarps have been clamped for similar reasons.

I've included screenshots of some of the lightwarps that are affected by this

Fixed: "models/flag/flag_blue_lightwarp.vtf" "models/flag/flag_red_lightwarp.vtf" "models/lightwarps/rainblower_lightwarp.vtf" "models/lightwarps/robot_lightwarp.vtf" "models/lightwarps/xms_lightwarp.vtf" "models/player/demo/hwn_demo_lightwarp.vtf" "models/player/items/all_class/qc_lightwarp.vtf" "models/player/items/engineer/hwn_engineer_warp.vtf" "models/player/items/mvm_loot/all_class/fob_lightwarp.vtf" "models/player/soldier/hwn_soldier_lightwarp.vtf" "models/player/shared/ice_player_lightwarp.vtf" "models/props_foliage/cactus01_lightwarp.vtf" "models/props_halloween/halloween_lens_lightwarp.vtf" "models/weapons/c_items/c_fists_of_steel_lightwarp.vtf" "models/weapons/c_items/c_fists_of_steel_lightwarp_blue.vtf" "models/weapons/c_items/c_fists_of_steel_phongwarp.vtf" "models/weapons/c_items/c_fists_of_steel_phongwarp_blue.vtf" "models/weapons/c_items/c_pocket_watch_lightwarp.vtf" "models/weapons/c_items/c_pocket_watch_phongwarp.vtf" "models/weapons/c_items/c_pomson_phongwarp.vtf" "models/weapons/c_items/c_sr3_punch_lightwarp.vtf" "models/workshop/weapons/c_models/c_fists_of_steel/c_fists_of_steel_lightwarp.vtf" "models/workshop/weapons/c_models/c_fists_of_steel/c_fists_of_steel_lightwarp_blue.vtf" "models/workshop/weapons/c_models/c_fists_of_steel/c_fists_of_steel_phongwarp.vtf" "models/workshop/weapons/c_models/c_fists_of_steel/c_fists_of_steel_phongwarp_blue.vtf" "models/workshop/weapons/c_models/c_sr3_punch/c_sr3_punch_lightwarp.vtf" Added: "models/player/items/spy/hwn_spy_warp_clamped.vtf" "models/vgui/competitive_badge_sparkle_warp_clamped.vtf" Modified Materials: "models/player/items/spy/hwn_spy_misc1_glass.vmt" "models/vgui/competitive_badge_sparkle.vmt" Some unclamped warps weren't changed because they wouldn't benefit from it: "models/props_halloween/halloween_demoeye_lightwarp.vtf" (this texture is solid black, so it wouldn't benefit from being clamped) "models/player/items/soldier/soldier_hood_warp_red.vtf" (the left-end and right-end regions of the texture are both the same color, so it wouldn't benefit from being clamped) "models/player/items/soldier/soldier_hood_warp_blue.vtf" (the left-end and right-end regions of the texture are both the same color, so it wouldn't benefit from being clamped) "models/player/items/all_class/all_class_ring_warp.vtf" (this texture is color noise so it wouldn't benefit from being clamped) "models/player/items/heavy/sr3_heavy_warp" (this texture is black and white noise so it wouldn't benefit from being clamped)