Skip to content

Port env_fog_controller - #287

Merged
marchc1 merged 4 commits into
SourceDotNET:mainfrom
Yahzy:fix/fog-controller
Nov 20, 2026
Merged

marchc1 merged 4 commits into
SourceDotNET:mainfrom
Yahzy:fix/fog-controller

Conversation

@Yahzy

@Yahzy Yahzy commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Map fog never showed up: env_fog_controller was only a network table on the server, its keyvalues were never read and InitFogController was commented out, so the player never got a fog controller. The client and shader side were already there. This ports the rest from the 2013 SDK:

  • FogController: keyfields (fogcolor, fogcolor2, fogdir, fogenable, fogblend, fogstart, fogend, fogmaxdensity, farz, foglerptime, fogradial, use_angles), all the inputs (TurnOn, TurnOff, SetColor, SetStartDist, SetRadial, SetColorLerpTo, StartFogTransition...), Spawn, Activate, UpdateTransmitState and DrawDebugTextOverlays
  • FogSystem: picks the master fog controller on level load, and forces radial fog on official maps like the SDK
  • SkyCamera: the fogradial keyvalue, and radial skybox fog forced on official maps like the SDK
  • GameRules.IsOfficialMap, false by default as in the SDK
  • BasePlayer.InitFogController on spawn and the SetFogController input

GMod also has fogcolor_hdr, fogcolor2_hdr, HDRColorScale, SetColorHDR, SetColorSecondaryHDR and SetMaxDensityLerpTo, which aren't in the 2013 SDK or Obsoletium, so they're left out of this PR.

Inputs changing the fog after the map has loaded need #286 to reach the client.

Tested: all four configurations build, Source.Common.Tests and Game.Server.Tests pass. With #286, SetRadial 1/0 on the map's controller switches between radial and planar fog, matching fog_radial 1/0 pixel for pixel.

@marchc1
marchc1 merged commit 3818afb into SourceDotNET:main Nov 20, 2026
32 checks passed
@Yahzy
Yahzy deleted the fix/fog-controller branch November 21, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants