Env sun: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Removing Russian youtube advertising.)
(updates)
Line 1: Line 1:
{{otherlang2
{{lang|Env sun}}
|zh-cn=Env_sun:zh-cn
{{base point|env_sun}} It places a glowing sun effect [[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 {{ent|light_environment}} to provide actual sunlight for your map.
}}


{{base point|env_sun}}  
{{PreservedEnt}}


==Entity description==
When the sun is looked at directly, it will transition to the properties of an "overlay".
It places a Sun or Moon effect (glow sprite) in the [[skybox]] where it does not parallax, giving the impression that it is nearly infinitely far away. The env_sun 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. Use [[shadow_control]] for dynamic shadows except in CSGO where Shadow Control is extraneous and may interfere with cascade lighting.


To set up the env_sun: Set the Pitch Yaw Roll. Pitch will be how far up and down the Sun will be in the sky. Yaw is how far left and right it will be. Roll is extraneous and is not necessary to set. An info_player_start can be used to visualize where the Sun will be; you can set its angles and imagine a line coming out its back pointing to the sky and that is where the Sun will be in game. Then copy and paste its pitch, yaw and roll into the env_sun (remember to delete the info_player_start after using it like this). Set Use Angles to Yes (This means it will use the Pitch Yaw Roll settings). Set Pitch as a negative number of the actual pitch (This number overrides the pitch in the Pitch Yaw Roll key value). Sun Color is the base color of the sun. Overlay Color is the color of the transition material. The overlay provides a nice transition to the full glare of the sun and smooths the popping in and out the Sun does when it comes into view. Size is the size of the sun. Set this smaller than the Overlay Size; 16 is a tiny sun and 256 is a huge sun. Set Overlay Size larger than sun.
{{code class|CSun|sun.cpp}}
 
{{map_properties}}
 
* You can also send inputs to the env_sun entity by directing them to "env_sun" instead of using a target name.
* 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.


==Keyvalues==
==Keyvalues==
{{KV|Viewer entity|target_destination|Name of an entity used to determine where the sun is in the skybox. The sun should be lined up on a line from this entity to the env_sun entity.}}
{{KV|UseAngles (use_angles)|boolean|The old way to orient <code>env_sun</code> 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.}}
{{KV|UseAngles|boolean|The old way to orient env_sun is to point it at a target. The new way is to specify the angles. If you use the new way, set this property to YES.}}
{{KV|Viewer entity (target)|target_destination|Name of an entity (probably {{ent|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 <code>env_sun</code>.}}
{{KV|Pitch|integer|This value sets the pitch position of the sun. It overrides the pitch value in the angles keyvalue, even if left at 0, so it needs to be specified. Contrary to the angles keyvalue, the rotation of this pitch is measured counter-clockwise from the horizontal, so that 90 is straight up, while -90 is straight down. (It's simply the negative of a normal pitch value.) }}
{{KV|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.}}
{{KV|Sun Color (R G B)|color255|Color of the sun.}}
{{KV|Yaw (angle)|nofgd=1|float|Override for '''Yaw''' in '''Pitch Yaw Roll''', similar to '''Pitch'''.}}
{{KV|Overlay Color (R G B)|color255|A value of 0 0 0 will act the old way. {{todo|Explain what the old way is.}}}}
{{KV|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.}}
{{KV|Size|integer|Size of the sun.}}
{{KV|Overlay Color (R G B) (overlaycolor)|color255|Color of the sun overlay.}}
{{KV|Overlay Size|integer|A value of -1 means the overlay will act the old way.}}
{{KV|Size (size)|integer|Size of the sun.}}
{{KV|Material Name|sprite|Material of the inner glow.}}
{{KV|Overlay Size (overlaysize)|integer|A value of -1 means the overlay will act the old way.}}
{{KV|Overlay Material Name|sprite|Material of the overlay glow.}}
{{KV|Material Name (material)|sprite|Material of the inner glow.}}
{{KV|HDR color scale.|float|float value to multiply sprite color by when running in HDR mode.}}
{{KV|Overlay Material Name (overlaymaterial)|sprite|Material of the overlay glow.}}
{{KV Targetname}}
{{KV|HDR color scale (HDRColorScale)|float|Color multiplier when in [[HDR]] mode.}}
{{KV|Glow Distance Scale (glowDistanceScale)|since=CSGO|float|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.}}
{{KV BaseEntity}}


==Inputs==
==Inputs==
{{IO|TurnOn|Enable sun rendering.}}
{{IO|TurnOn|Enable sun rendering.}}
{{IO|TurnOff|Disable sun rendering.}}
{{IO|TurnOff|Disable sun rendering.}}
{{IO|SetColor|Change the sun's color. Format: <Red 0-255> <Green 0-255> <Blue 0-255>|param=color255}}
{{IO|SetColor|param=color255|Sets '''Sun Color'''.}}
{{I Targetname}}
{{I BaseEntity}}


==Outputs==
==Outputs==
{{O Targetname}}
{{O BaseEntity|l4d=1}}

Revision as of 20:41, 2 October 2018

English (en)Русский (ru)中文 (zh)Translate (Translate)

Template:Base point It places a glowing sun effect 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.

Icon-Important.pngImportant:This is a preserved entity in Counter-Strike: SourceHalf-Life 2: DeathmatchDay of Defeat: SourceTeam Fortress 2Left 4 DeadLeft 4 Dead 2Portal 2Counter-Strike: Global Offensive.
If the game has round restart mechanics this entity may not behave as expected:
More info
  • On a new round entities with this classname 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".

C++ In code, it is represented by theCSunclass, defined in thesun.cppfile.

Keyvalues

UseAngles (use_angles) ([todo internal name (i)]) <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) ([todo internal name (i)]) <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) ([todo internal name (i)]) <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) ([todo internal name (i)]) <float> !FGD
Override for Yaw in Pitch Yaw Roll, similar to Pitch.
Sun Color (R G B) (rendercolor) ([todo internal name (i)]) <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) ([todo internal name (i)]) <color255>
Color of the sun overlay.
Size (size) ([todo internal name (i)]) <integer>
Size of the sun.
Overlay Size (overlaysize) ([todo internal name (i)]) <integer>
A value of -1 means the overlay will act the old way.
Material Name (material) ([todo internal name (i)]) <sprite>
Material of the inner glow.
Overlay Material Name (overlaymaterial) ([todo internal name (i)]) <sprite>
Material of the overlay glow.
HDR color scale (HDRColorScale) ([todo internal name (i)]) <float>
Color multiplier when in HDR mode.
Glow Distance Scale (glowDistanceScale) ([todo internal name (i)]) <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 <color255RedirectInput/color32>
Sets Sun Color.


Outputs