env_sun

From Source Entities
Jump to navigation Jump to search

Code classes:

env_sun is a point entity present in all Source games. It places a glowing sun effect in the skybox where it does not parallax, giving the impression that it is nearly infinitely far away. The entity does not contribute any actual lighting; it is merely a visual representation of the Sun. Use light_environment to provide actual sunlight for your map.

Bug: The sun has been known to flicker in some games. A fix is not known. It's been seen to not happen when there is no sky_camera in the map.

Bug: If the 3D skybox is using tools/toolsskybox2d instead of tools/toolsskybox, the skybox may disappear when looking at the sun.

Keyvalues[edit | edit source]

Material Name (material) <sprite>
Texture to show for the sun.
Overlay Material Name (overlaymaterial) <sprite>
Texture to show over the sun when the viewer is looking directly towards it.
Size (size) <integer>
Size of the sun.
Overlay Size (overlaysize) <integer>
How big the overlay material is. If -1, uses a default value.
Sun Color (R G B) (rendercolor) <color255>
Color of the sun. The effect is additive with the sky: a pure yellow sun with a bright blue sky will appear white in-game; change the color to account for this.
Overlay Color (R G B) (overlaycolor) <color255>
Color of the sun overlay.
UseAngles (use_angles) <boolean>
The old way to orient env_sun is to use Viewer entity. The new way is by Pitch Yaw Roll. If you want to use the new way, set this property to YES.
Viewer entity (target) <target_destination>
Name of an entity (probably sky_camera) used to determine where the sun is in the skybox. The resulting sun sprite will be positioned based on a line starting from the Viewer entity towards the env_sun.
Pitch (pitch) <float>
This value sets the pitch position of the sun. It overrides the Pitch in Pitch Yaw Roll, even if left at 0, so it needs to be specified. This Pitch is reverse of the normal, so 90 is straight up, while -90 is straight down (directly overhead).
Bug: Sun does not show when pointed straight down.
Yaw (Not in FGD) (angle) <float>
Override for Yaw? Crashes the game on map load if specified.
HDR color scale (HDRColorScale) <float>
No effect.
Glow Distance Scale (glowDistanceScale) <float> (only available in Csgo-small.png)
Scales the distance used to test for sun glow occlusion. If the player can see any part of the skybox within this range, the overlay will render.

Inputs[edit | edit source]

TurnOn
Enable sun rendering.
TurnOff
Disable sun rendering.
SetColor <color255>
Sets Sun Color.