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

env_sun

From Valve Developer Community
Jump to: navigation, search
English (en)русский (ru)中文 (zh)
... Icon-Important.png
Example of env_sun working with sky_day01_04_hdr skybox. (LDR (left) HDR (right))
Env sun(gmod).png
class hierarchy
CSun defined in sun.cpp
CBaseEntity

env_sun is a point entity available in all Source 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.

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.

When the sun is looked at directly, it will transition to the properties of an "overlay".

Icon-Bug.pngBug:Centering the player's view perfectly on the sun will render it invisible, even if there is no crosshair. This has been fixed since Left 4 Dead.
Note.pngFix:A fix for this bug can be found here
Note.pngNote:Deprecated in Black Mesa Black Mesa in favor or env_lensflare with newLight_Dir.
Tip.pngTip:As env_sun doesn't affect lighting, the map's light_environment should use the same angles as env_sun. If using multiple env_sun entities, use the average angles of all suns for the sunlight angle.

Keyvalues


Targetname:
Name (targetname) <string>
The targetname that other entities refer to this entity by.
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) <targetname>
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.
Yaw (angle) <float> !FGD
Override for Yaw in Pitch Yaw Roll, similar to Pitch.
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.
Size (size) <integer>
Size of the sun.
Overlay Size (overlaysize) <integer>
A value of -1 means the overlay will act the old way[Clarify].
Material Name (material) <sprite>
Material of the inner glow.
Overlay Material Name (overlaymaterial) <sprite>
Material of the overlay glow.
HDR color scale (HDRColorScale) <float>
Color multiplier when in HDR mode.
Glow Distance Scale (glowDistanceScale) <float> (in all games since Counter-Strike: Global Offensive)
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

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

See also