func_precipitation is a brush entity available in all Source games. It creates rain, snow, or ash inside its volume.
Rain 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.
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. 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> No function. Use
r_rainalphapow <float> Raises the value of
r_rainalphaexponentially.Confirm:Some say this has no effect?
func_precipitationbrushes should not overlap
func_smokevolumebrushes, as it can freeze the game. The exact cause of this is not clear.
- Density (0-100%)
- 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!
- Color (R G B)
- Color added to sprites which are rendered transparently (probably rain and snow particles)
- Precipitation Type
- Precipitation type
Value Name Description/Notes Example Map(s)
Rain Rain falling. CS:S map "
Snow Identical to Rain, use "Snowfall" instead.
Ash Ash falling. Appears with missing textures in most games other than EP1. A fix can be applied by extracting all 3
Used throughout EP1.
Snowfall Snow falling. DoD:S map "
Particle Rain Particle rain with slight mist and refraction. Left 4 Dead's "No Mercy" campaign, CS:GO map "
Particle Ash Particle ash with orange tint. Left 4 Dead's "Dead Air" campaign.
Particle Rain Storm Particle rain with denser, more angled particles. Left 4 Dead 2's "Hard Rain" and "The Passing" campaigns.
Particle Snow Particle snowfall. CS:GO map "
Particle Bugs Particle flying bugs. In later games, this value is used by Particle Snow instead. Left 4 Dead 2's "Swamp Fever" campaign.
Particle Smoke Particle smoke with variable density. Left 4 Dead 2's "Dead Center" campaign.
- Entity Scripts
- Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
- Script think function
- Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Note: Try to avoid expensive operations in this function, as it may cause performance problems.
- 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.
- Removes this entity from the world.
- Removes this entity and its children from the world. Note: Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than
- Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- Same as a player invoking +use; may not do anything depending on the entity. Can also be invoked by firing an output that does not specify an input.
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug: In , the code is executed in the script scope of the entity that fires the output, not the one receiving the input.Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
- Execute a VScript function in the scope of the receiving entity.
- Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
- Set this entity's angles.
- Move with this entity. See Entity Hierarchy (parenting).
- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
- These outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
- This output fires when the entity is killed and removed from the game.