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

Func precipitation: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(41 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{base brush|func_precipitation}} It creates rain, snow, or ash inside its volume.
{{Preserved entity}}
[[File:Func precipitation rain storm csgo.jpg|thumb|right|Rain particles created by func_precipitation in Counter-Strike: Global Offensive]]{{CD|CPrecipitation|file1=effects.cpp}}
{{this is a|brush entity|name=func_precipitation}} It creates rain, snow, or ash inside its volume.


===Rain Related Console Commands===
The collision code will attempt to block precipitation that collides with world brushes, allowing this entity to cover the entire map with a single brush. If this does not occur correctly, a {{ent|func_precipitation_blocker}}{{since|{{l4d}}}}{{also|{{gmod}}}} can be used to prevent precipitation in a selected area, if available in the target game.
There are a number of console commands that control '''func_precipitation''' rendering. 
* See also [[Precipitation issues]] - details various issues and workarounds involving the use of this entity.
:{| class=standard-table
! Command Name || Value || Description
|-
| r_RainParticleDensity || <[[float]]> || Set the density to enable or disable any precipitation particle. Value '''1''' to enable and '''0''' to disable. {{TODO|Appears to be invalid. Which Source game(s) feature this specific command?}}
|-
| r_rainalpha || <[[float]]> || Adjusts transparency of rain particles.
|-
| r_rainProfile || <[[bool]]> || Displays stats on rain rendering costs.
|-
| r_RainHack || <[[bool]]> || Overrides density values set in Hammer. Enabling will result in longer and more dense rain than at 100%. Can help solve visibility issues. {{note|Rain may fall through brushes when this command is enabled.}}
|-
| r_rainspeed || <[[float]]> || Lower values will cause rain to disappear sooner and fall slower. Default value is '''600.0f'''
|-
| r_RainSideVel || <[[float]]> || Controls sideways movement of the rain particles.
|-
| r_RainSimulate || <[[bool]]> || Toggles animation on the rain; freezes the rain when set to 0.
|-
| r_rainwidth || <[[float]]> || Widens the rain's alpha to desired value. Default value is '''0.5'''
|-
| r_RainRadius || <[[float]]> || Distance from the brush where the rain starts/stops rendering.
|-
| r_rainlength || <[[float]]> || Changes the length of the rain particles. Default value is '''0.1f'''
|-
| r_RainSplashPercentage || <[[float]]> || Percent chance of splash particles spawning when a particle is used.
|-
| r_raindensity || <[[float]]> || {{Bug|Appears to have no effect. Deprecated?}} {{Tip|Use '''r_RainParticleDensity''' instead.}}
|-
| r_rainalphapow || <[[float]]> || {{Bug|Appears to have no effect. Deprecated? }}
|}
 
{{TODO|The names of these seem descriptive enough for most of them, but what does ''r_raindensity'', and  ''r_rainalphapow'' do?}}
 
{{warning|Precipitation volumes shouldn't be placed in the same volume as [[func_smokevolume]] is. Otherwise engine may freeze at the end of loading the level. It is probably caused by some particle coding that do not accept this two types of sprites to render at once (in the same volume).}}


{{toc-right}}
==Keyvalues==
==Keyvalues==
{{KV|Density (0-100%)|integer|This is the amount of particles that fall down from top side of brush. However distance from first particle to second depends on a brush volume size!}}
{{KV|Color (R G B)|color255|Color added to sprites which are rendered transparently (probably rain and snow particles)}}
{{KV|Precipitation Type|choices|Precipitation type}}
:{| class=standard-table
! Value || Description || Description/Notes
|-
| <code>0</code> || Rain || Rain falling. The only official instance of this effect in use is found in the [[Counter-Strike: Source|CS:S]] map "<code>de_aztec</code>".
|-
| <code>1</code> || Snow || Identical to rain, Use "Snowfall" instead.
|-
| <code>2</code> || Ash || Used to great extent in [[Half-Life 2: Episode One|EP1]]. Appears with missing textures in most games other than EP1. Can be fixed by extracting materials/effects/fleck_ash1 to 3 VMTs and VTFs, and ember_swirling001.vtf from ep1_pak_dir.vpk. This issue is fixed in EP1 and onwards.
|-
| <code>3</code> || Snowfall || Snow falling. Used in the [[Day of Defeat: Source|DoD:S]] map "<code>dod_colmar</code>".
|-
| <code>4</code> || Particle Rain || {{L4D add}} Particle rain with slight refraction. Used in [[Left 4 Dead|Left 4 Dead's]] "No Mercy" campaign and the [[Counter-Strike: Global Offensive|CS:GO]] map "<code>de_aztec</code>".
|-
| <code>5</code> || Particle Ash || {{L4D add}} Particle ash with orange tint. Used in Left 4 Dead's "Dead Air" campaign.
|-
| <code>6</code> || Particle Rain Storm || {{L4D2 add}} Particle rain with higher density of streaks and impact particles. Used in [[Left 4 Dead 2|Left 4 Dead 2's]] "Hard Rain" and "The Passing" campaigns.
|-
| <code>7</code> || Particle Snow || {{CSGO add}} Particle snowfall. Used in the CS:GO map "<code>ar_monastery</code>".
|-
| <code>8</code> || Particle Bugs || {{L4D2 add}} Particle flying bugs. Used in Left 4 Dead 2's "Swamp Fever" campaign.
|-
| <code>9</code> || Particle Smoke || {{L4D2 add}} Particle smoke with view-obscuring density. Used in Left 4 Dead 2's "Dead Center" campaign.
|}
{{KV Targetname}}
{{KV Targetname}}
{{KV Parentname}}
{{KV|Density (0-100%)|intn=renderamt|integer|This is the amount of particles that fall down from the top side of the brush. However, distance from first particle to second depends on a brush volume size!}}
{{KV|Color (R G B)|intn=rendercolor|color255|Color added to sprites which are rendered transparently (probably rain and snow particles)}}
{{KV|Precipitation Type|intn=preciptype|integer choices|Precipitation type}}


==Inputs==
{{Table
{{IO|Alpha|Unlisted input. Changes the density of the rain, and may add additional particle effects like fog or leafs. It accepts inputs from -1 to 255.}}
| {{tr
{{I Targetname}}
| {{th|Value}} {{th| Type }} {{th| Availability}} {{th| Description }}
{{I Parentname}}
}}
{{tr
| {{td|0|dark=1}}{{td|Rain|dark=1}}
{{td| }}
{{td|Seen in {{css|2}} map {{mono|de_aztec}}}}
}}
{{tr
| {{td|1|dark=1}}{{td|Snow|dark=1}}
{{td| }}
{{td|Identical to Rain, use "Snowfall" instead. }}
}}
{{tr
| {{td|2|dark=1}}{{td|Ash|dark=1}}
{{td| }}
{{td|Seen throughout ''{{hl2ep1|2}}''
{{note|Appears with missing textures in most games. You may copy all <code>materials/effects/fleck_ash*</code> and <code>materials/effects/ember_swirling001</code> files from <code>ep1_pak_dir.vpk</code> and ship it with your game/map.}} }}
}}
{{tr
| {{td|3|dark=1}}{{td|Snowfall|dark=1}}
{{td| }}
{{td|Seen in ''{{dods|2}}'' map {{mono|dod_colmar}} }}
}}
{{tr
| {{td|4|dark=1}}{{td|Particle Rain|dark=1}}
{{td|{{since|{{l4d}}}} }}
{{td|Seen in [[Left 4 Dead|Left 4 Dead's]] "No Mercy" campaign, [[Counter-Strike: Global Offensive|CS:GO]] map {{csgomap|game=csgo|de_aztec}}<br>
Particle rain with slight mist and refraction. }}
}}
{{tr
| {{td|5|dark=1}}{{td|Particle Ash|dark=1}}
{{td|{{since|{{l4d}}}} }}
{{td|Seen in in Left 4 Dead's "Dead Air" campaign. }}
}}
{{tr
| {{td|6|dark=1}}{{td|Particle Rain Storm |dark=1}}
{{td|{{since|{{l4d2}}}} }}
{{td|Seen in [[Left 4 Dead 2|Left 4 Dead 2's]] "Hard Rain" and "The Passing" campaigns.<br>
Particle rain with no mist/refraction and more angled particles. Alpha values over 100 enable an additional flying leaves effect seen during the storm event. }}
}}
{{tr
| {{td|7|dark=1}}{{td|Particle Snow|dark=1}}
{{td|{{since|{{as}}}} }}
{{td|Seen in ''{{csgo|2|nt=0}}'' map {{csgomap|game=csgo|ar_monastery}} }}
}}
{{tr
| {{td|7|dark=1}}{{td|Particle Bugs|dark=1}}
{{td|{{only|{{l4d2}}}} }}
{{td|Seen in Left 4 Dead 2's "Swamp Fever" campaign.<br>
Particle flying bugs. In later games, this value is used by Particle Snow instead. }}
}}
{{tr
| {{td|8|dark=1}}{{td|Particle Smoke|dark=1}}
{{td|{{only|{{l4d2}}}} }}
{{td|Seen in Left 4 Dead 2's "Dead Center" campaign.<br>
Particle smoke with variable density.  }}
}}
}}
{{note|The "Particle" precipitation types are generated using the PCF files of a game, allowing users to alter the look of the precipitation in more ways than just the used material.}}


==Outputs==
== Inputs ==
{{O Targetname}}
{{I|Alpha|param=int|Changes the density of the rain, and may add additional particle effects like fog or leaves. It accepts inputs from -1 to 255.|nofgd=1}}


{{sfx_brush}}
{{sfx_brush}}
== Related Console Commands ==
There are a number of console commands that control precipitation rendering. See the [[Precipitation issues]] page for details on various issues and workarounds involving this entity.
{{Table
| {{tr
| {{th|Command Name}} {{th|Value}} {{th|Description}}
}}
{{tr
| {{td|r_RainParticleDensity {{as}}{{portal2}} |dark=1}}
{{td| <[[float]]> }}
{{td| Set the density to enable or disable any precipitation particle. Value '''1''' to enable and '''0''' to disable.}}
}}
{{tr
| {{td|r_rainalpha |dark=1}}
{{td| <[[float]]> }}
{{td| Adjusts transparency of rain particles.}}
}}
{{tr
| {{td|r_rainProfile |dark=1}}
{{td| <[[bool]]> }}
{{td| Displays stats on rain rendering costs.}}
}}
{{tr
| {{td|r_RainHack |dark=1}}
{{td| <[[bool]]> }}
{{td| Overrides density values set in Hammer. Enabling will result in longer and more dense rain than at 100%. Can help solve visibility issues. {{note|Rain may fall through brushes when this command is enabled.}}}}
}}
{{tr
| {{td|r_rainspeed |dark=1}}
{{td| <[[float]]> }}
{{td| Lower values will cause rain to disappear sooner and fall slower. Default value is '''600.0f'''}}
}}
{{tr
| {{td|r_RainSideVel |dark=1}}
{{td| <[[float]]> }}
{{td| Controls sideways movement of the rain particles.}}
}}
{{tr
| {{td|r_RainSimulate |dark=1}}
{{td| <[[bool]]> }}
{{td| Toggles animation on the rain; freezes the rain when set to 0.}}
}}
{{tr
| {{td|r_rainwidth |dark=1}}
{{td| <[[float]]> }}
{{td| Widens the rain's alpha to desired value. Default value is '''0.5'''}}
}}
{{tr
| {{td|r_RainRadius |dark=1}}
{{td| <[[float]]> }}
{{td| Distance from the brush where the rain starts/stops rendering.}}
}}
{{tr
| {{td|r_rainlength |dark=1}}
{{td| <[[float]]> }}
{{td| Changes the length of the rain particles. Default value is '''0.1f'''}}
}}
{{tr
| {{td|r_RainSplashPercentage |dark=1}}
{{td| <[[float]]> }}
{{td| Percent chance of splash particles spawning when a particle is used.}}
}}
{{tr
| {{td|r_raindensity |dark=1}}
{{td| <[[float]]> }}
{{td| No function. Use <code>r_RainParticleDensity</code> instead.}}
}}
{{tr
| {{td|r_rainalphapow |dark=1}}
{{td| <[[float]]> }}
{{td| Raises the value of <code>r_rainalpha</code> exponentially. {{confirm|Some say this has no effect?}}}}
}}
}}
== Bugs and caveats ==
{{warning|<code>func_precipitation</code> brushes should not overlap <code>[[func_smokevolume]]</code> brushes, as it can freeze the game. The exact cause of this is not clear.}}
{{note|The precipitation created by this entity is not GPU-accelerated. In resource-intensive multiplayer games such as {{tf2}}, it's recommended to use a [[info particle system|particle system]] to create weather effects rather than relying on this entity. }}
== See also ==
* [[func_precipitation_blocker]]
* [[Rain splashes]]

Latest revision as of 08:55, 4 May 2025

Recycle-warning.png
This is a preserved entity in Day of Defeat: SourceTeam Fortress 2
If the game has round restart mechanics this entity may not behave as expected.
Rain particles created by func_precipitation in Counter-Strike: Global Offensive
C++ Class hierarchy
CPrecipitation
CBaseEntity
C++ effects.cpp

func_precipitation is a brush entity available in all Source Source games. It creates rain, snow, or ash inside its volume.

The collision code will attempt to block precipitation that collides with world brushes, allowing this entity to cover the entire map with a single brush. If this does not occur correctly, a func_precipitation_blocker(in all games since Left 4 Dead)(also in Garry's Mod) can be used to prevent precipitation in a selected area, if available in the target game.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Density (0-100%) (renderamt) <integer>
This is the amount of particles that fall down from the top side of the brush. However, distance from first particle to second depends on a brush volume size!
Color (R G B) (rendercolor) <color255>
Color added to sprites which are rendered transparently (probably rain and snow particles)
Precipitation Type (preciptype) <integer choices>
Precipitation type
Note.pngNote:The "Particle" precipitation types are generated using the PCF files of a game, allowing users to alter the look of the precipitation in more ways than just the used material.

Inputs

Alpha <integerRedirectInput/integer> !FGD
Changes the density of the rain, and may add additional particle effects like fog or leaves. It accepts inputs from -1 to 255.

Related Console Commands

There are a number of console commands that control precipitation rendering. See the Precipitation issues page for details on various issues and workarounds involving this entity.

Bugs and caveats

Warning.pngWarning:func_precipitation brushes should not overlap func_smokevolume brushes, as it can freeze the game. The exact cause of this is not clear.
Note.pngNote:The precipitation created by this entity is not GPU-accelerated. In resource-intensive multiplayer games such as Team Fortress 2, it's recommended to use a particle system to create weather effects rather than relying on this entity.

See also