Setting up Weather and Fog
We've got rain and snow; also a limited ability to control what parts of a level have fog. Here's how it works--
Every level has a global set of weather conditions: whether it's raining or snowing, how much, and how far from the camera it's visible (our basic optimization, compared to using particle effects, is that precipitation only falls around the camera, which is usually where the player is). You can use room brushes to control what parts of the level have weather. But every place where it's raining, it's raining in the same way; and every place which has fog has it in the same color and density.
For a look at the global precipitation settings for your level, mouse your way over to Editors/Mission Parameters.../Weather. You'll notice that the first field in the weather settings lets you choose between rain and snow. No level can have both. Some of the fields after that apply to all precipitation, while others apply only to rain or only to snow.
Here are settings which look good in my little test level when using rain (fields not in boldface aren't used for rain):
- new drops/sec. 40
precip fall (ft./sec.) 130 visible distance (feet) 80 render radius (feet) .1 (thicker than real ones, but at least it's visible) rendering alpha (0-1) .8 precip brightness (0-1) .8 (this would be lower for a night mission) snow jitter(feet) rain length (feet) 10 splash frequency (0-1) .5 (at 1.0, all raindrops on horizontal surfaces make splashes) splash radius (feet) .25 splash height (feet) .4 splash duration (sec.) .3 texture rain wind (ft./sec.) 0 0 0 (this has no effect on physics, just slants the rain)
Here are settings which look good for snow (fields not in boldface aren't used for snow):
- new drops/sec. 20
precip fall (ft./sec.) 10 visible distance (feet) 60 render radius (feet) .12 (cartoonishly big, but at least it's visible) rendering alpha (0-1) 1 precip brightness (0-1) 1 (this would be lower for a night mission) snow jitter (feet) 3 (some extra curviness to how it falls) rain length (feet) splash frequency (0-1) splash radius (feet) splash height (feet) splash duration (sec.) texture snow wind (ft./sec.) 0 0 0 (this has no effect on physics, just slants the snow)
Putting weather into a levelEdit
You set this stuff up using room brushes. So a level which hasn't been really room brushed out can't have weather yet. The way the brushes map to the world is approximate. The weather really thinks in terms of world rep cells, the ones you see when you turn on show_cell.
To give a kind of room weather, add the property Weather/Local Weather. It has two checkboxes, one for precipitation and one for fog. The weather property is applied to the world any time you either reportalize or recompute the room database.
More about fogEdit
The global fog settings are the same as before; the only change is that you have to specify what parts of your level have fog.
Local fog is a very tricky business, because it works in terms of cells. Supposing you're in a building, which doesn't have fog, looking across a foggy street into another building. Even though the inside of the other building wouldn't be fogged if you were in it, we want it rendered with fog because we're seeing it through cells which are fogged.
So you can make the fog look obviously wrong if you have a cell which, from a particular vantage point, has one part which should be fogged and another which shouldn't be. One part or the other will look wrong. It's surprisingly easy to build a level which makes this happen. For example, an L-shaped building with two windows:
######################## # # # indoors (no fog) # # # # ####--######## # # # | # | # # outdoors # # (foggy) # You # # # ###########
Suppose you look out the near window, through the fog, through the other window and back into the building. If the horizontal part of the L is all one world rep cell, you'll have both a part of it visible through the fog and a part where you're looking through clear air. One part or the other will look wrong. In building your level, you don't have direct control over where world rep cells are built; they're computed with the goal of having as few of them as possible (when the level is optimized, anyhow). Walls, obviously, separate cells. The one other place where you can be sure to find boundaries between cells is doors, since there are cells where the doors shut.
If you can get away with it, it's definitely easier to fog your entire level. Remember that any part of the world which is not room brushed cannot have fog, much less rain or snow.
More about rain and snowEdit
Rain and snow are created above the camera. The "visible distance" field in the weather dialog controls both how far away they're created horizontally and how far above the camera they are created. So you won't have these effects unless there's enough room above you for them to appear.
The settings I've written here give you fairly light snow, and a steady sprinkle of rain. At these settings they have a small effect on frame rate but not much. It is easy to find settings which slow the game down in a big, ugly, smelly, unneighborly way.
Rain doesn't hit the surface of water; it keeps going, even making splash effects when it finally hits something solid. Fixing this would be hard but we can do it if we need to.
There is no way to change the weather settings during the game. This is because the rendering is optimized in ways which assume that the precipitation is always falling at the same angle and speed. But, life goes on.