Weather - FreeSlave/halflife-featureful GitHub Wiki
GitHub pages!
Wiki is deprecated. Proceed toFeatureful SDK provides support for rain, snow and fog weather effects similar to ones used in Counter Strike and Condition Zero.
env_fog
Use env_fog
to put a global fog on the map. Set the entity name to make it toggleable by triggers.
There's an option to choose between Linear and Exponential fog (OpenGL terms), but after the Half-Life anniversary update it doesn't work as expected anymore. Linear fog uses start distance
and end distance
values and it will look for a player like a wall of color starting with a certain distance. Exponential fog relies only on density
, which should be a number smaller than 0.01, and it's considered to be more realistic.
- By default in GoldSource the fog is exponential (exponential-squared to be precise).
- On
steam_legacy
branch the custom fog type will be applied as expected. - On the current (anniversary) version the fog will always be exponential if the shaders are on. Otherwise the behavior is the same as on
steam_legacy
. - To get the linear fog on the current version of GoldSource with shaders on you must copy
platform/gl_shaders
subdirectory to your mod and edit thefs_world.frag
to always use the linear fog. Note that it will force the fog to the certain type disregarding the configured type in theenv_fog
.
Notes:
- Fog covers the whole map (including the indoor areas). There's currently no alternative to it.
- You can use several
env_fog
entities on one map, but it's better to make sure that only one is active at time. - Beams may look weird in the fog (the transparent part won't render correctly). There's no fix for this. Avoid using beams in the foggy areas.
env_rain
Featureful SDK implements rain effect similar to one used in Counter Strike and Condition Zero (e.g. de_aztec map).
Use env_rain
to put rain on the map. The raindrops will appear around the player giving the illusion of global rain. To make rain localized in the certain area independent of player position you can use Localized
spawnflag. By default raindrops appear only under the sky. To allow them in the indoor areas tick the Allow indoor
spawnflag (that will make it look like raindrops appear from the ceiling).
To turn off/on the rain, give env_rain
a name and call it by some trigger.
Besides falling raindrops rain includes other particle effects:
- Splashes when raindrops hit the ground.
- Ripples when raindrops hit water.
- Windpuffs - little clouds flying near the ground.
These extra effects can be turned off in spawnflags.
The particle parameters like sprite, color, lifetime and speed can be configured in env_rain
options. If you don't provide any value the default ones will be used. Default sprites used for particles (and must be presented in the mod resources) are:
- sprites/effects/rain.spr - for raindrops
- sprites/effects/ripple.spr - for ripples
- sprites/gas_puff_01.spr - for windpuffs
- sprites/wsplash3.spr - for splashes (doesn't need to be distributed in the mod, already present in base Half-Life).
The way how the particles are lit depends on the light mode parameter:
Light doesn't affect color
- surrounding light won't effect the color (this also makes particles visible even in the complete darkness).Light color affects color
- the resulting particle color will be mixed with color of the surrounding light.Light intensity affects color
- the resulting particle color will be scaled by the surrounding light intensity (sum of color components).
Raindrops and winpuffs are affected by the global wind. The wind changes its strength and direction randomly. There's currently no way to configure the wind (will be implemented later).
Hints:
- Use different color to create the "acid" rain.
- The
Rain Intensity
,Rain max distance
andUpdate period
parameters affect the resulting number of raindrops. The default numbers are provided in fgd Help description.
env_snow
Featureful SDK implements snow effect similar to one used in Counter Strike and Condition Zero (cs_office_cz).
env_snow
is similar to env_rain
, but spawns snowflakes instead of raindrops. It doesn't have any extra effects besides snowflakes. Like rain, snow is affected by the global wind.
The snowflake default sprite is sprites/effects/snowflake.spr.
Hints:
- Snow and rain can be used together to create mixtured precipitation effect.
- Use different color to create other kinds of precipitation like dust, falling ashes, etc.
- The
Snow Intensity
,Snow max distance
andUpdate period
parameters affect the resulting number of snowflakes. The default numbers are provided in fgd Help description.
func_rainvolume and func_snowvolume
Alternatively to env_rain
and env_snow
you can use brush entities func_rainvolume
and func_snowvolume
. They are always localized within their bounding box. Note that despite the brush entity can have any geometry the resulting area will depend on the bounding box. Create several entities if you want to cover areas of the more complex shape and adjust Intensity
parameter accordingly to the size of the brushes - the smaller the area, the smaller intensity should be to avoid high density of the precipitation (unless that's what you want to achieve).