This article's documentation is for anything that uses the Source engine. Click here for more information.


From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)
... Icon-Important.png
Sky camera.png Missing entity icon.png Missing entity icon (blue).png
TypePoint entity
EngineSource Source Source 2 Source 2
AvailabilityIn all games
class hierarchy
CSkyCamera defined in SkyCamera.cpp

sky_camera is a point entity available in all Source Source games. It is used to mark the position of the map's origin inside the 3D Skybox. As your position changes relative to the maps origin it will be scaled and applied relative to the sky_camera.

When the map is compiled, the areas containing sky_camera(s) are skipped during vis calculations. This can be overridden by -forceskyvis on VBSP.

By default, only one sky_camera may be active at a time and it cannot move.

  • There is a trick to emulate multiple or moving 3D Skyboxes in any game. More info here.
  • Duplicate your main env_fog_controller and then turn that into a sky_camera so that the fog settings will be carried over.
Note.pngNote:fog values on sky_camera cannot be changed through inputs (unlike env_fog_controller) and the max density keyvalue is missing from the FGD by default.
Cpp-16px.pngCode:There is some leftover code for multiple sky_camera entities which can be restored in mods. Half-Life 2: Downfall has restored this feature and the work involved is open-source. Downfall's repository can be found here. Mapbase Mapbase uses the aforementioned Downfall code and also adds native support for moving (and rotating) skyboxes. Mapbase's repository can be found here.
Note.pngNote:This is a preserved entity in Counter-Strike: SourceHalf-Life 2: DeathmatchDay of Defeat: SourcePortalTeam Fortress 2Left 4 DeadLeft 4 Dead 2Portal 2Counter-Strike: Global Offensive.
  • On a new round, its properties including its position will intentionally not reset. You can use logic_auto to emulate resetting it.
  • Killing it removes it forever, as it is not respawned on a new round.
  • It cannot be spawned with a point_template.
  • Parenting this with non preserved entities may have undesirable effects.


Name (targetname) <string> !FGD
The targetname that other entities refer to this entity by.
3D Skybox scale (scale) <integer>
This number determines how large objects in your skybox will seem relative to the map.
For example, at a skybox scale of 16, an object 1 unit high in the skybox will seem to be 16 units high to player.
Fog Enable (fogenable) <boolean>
Enable Fog in the Skybox by Default
Fog Blend (fogblend) <boolean>
This will enable blending between two fog colors, based on the direction the player is looking. If the player's viewpoint is equal to the fogdir vector, the fog will be drawn with the secondary color; if facing in the complete opposite direction, the fog will be drawn with the primary color.
This can be used to approximate the aesthetic effect of diffuse light filtering through the fog, but since the fog effect color is changed for the entire rendered scene, it is best to keep the two colors relatively close to make the blending less obvious.
For example, sunlight with a yaw of 45 degrees and a pitch of -45 degrees could be enhanced using a fogdir of '-1 -1 1', a fogcolor of '120 110 100' and a fogcolor2 of '80 70 60'.
Use Angles for Fog Dir (use_angles) <boolean>
Primary Fog Color (fogcolor) <color255>
The Primary Color of the Fog in the Skybox
Secondary Fog Color (fogcolor2) <color255>
The Secondary Color of the Fog in the Skybox that will be blended to
Primary Fog Dir (fogdir) <string>
A vector (given by three space-separated numbers X Y Z) which points from the secondary fog color fogcolor2 towards the primary fog color fogcolor.
Fog Start (fogstart) <string>
How far from the point-of-view the fog should start. Generally, this should be the same setting as your env_fog_controller.
Fog End (fogend) <string>
How far from the point-of-view the view should be completely fogged. Generally, this should be the same setting as your env_fog_controller.
Fog Max Density ([confirm]) <float> !FGD
Fog Max Density [0..1].
Clip 3D sky near plane to world far plane (clip_3D_skybox_near_to_world_far) <boolean> (only in Left 4 Dead 2)
3D sky near plane offset (clip_3D_skybox_near_to_world_far_offset) <float> (only in Left 4 Dead 2)
Offset for the near clip plane for the 3D sky in world units. This is only used if the above field is true. Negative values to pull closer, etc.


ActivateSkybox  (in all games since Left 4 Dead 2) !FGD
Activates targeted sky_camera and disables rest.
Warning.pngWarning:Should your skyboxes have models or brushwork capable of throwing shadows, all shadows of all props from all skyboxes will compile shadows onto your map. Even when the skybox is switched, the shadows on your map will remain.

See also