Fog
Fog can be used to great effect to create atmosphere and emphasize distance. There are two types of fog available in Unreal Tournament, and three types of fog availible in UT2003. The three types of fog availible in Unreal Tournament are view fog, distance fog and volumetric fog. Unreal Tournament 2003 replaces volumetric fog a new type of fog, which we unofficially call emitter fog.
View Fog
View Fog is a simple method of adding "fog" to a map or an area in a map. It works by simply tinting the rendered scene by a specified amount. View Fog is sometimes also referred to as "fake fog." It uses practically no rendering resources, but it is not that realistic. Often an underwater area will have a blueish view fog. View Fog is not particularly realistic, but is very cheap resource wise.
Setting Up View Fog in Unreal Tournament
In Unreal Tournament, view fog is specific to the zone containing the camera. It is specified by the ViewFlash and ViewFog variables in the zone's ZoneInfo?. Here's a sample configuration:
ViewFlash X | -0.5 |
ViewFlash Y | -0.5 |
ViewFlash Z | -0.5 |
ViewFog X | 0.5 |
ViewFog Y | 0.5 |
ViewFog Z | 0.5 |
Setting Up View Fog in UT2003
View Fog does not appear to work properly in UT2003, however, the variables for it are still present so theoretically it may still work on some graphics hardware. View Fog is controlled by Volumes in UT2003. Specifically, PhysicsVolumes are used. To set up View Fog, simply set the ViewFog variable (under "PhysicsVolume") in the PhysicsVolume to whatever color you want the screen to be tinted.
Distance Fog
Distance Fog is sometimes called "true fog." Distance fog tints the screen as with view fog, but the degree of tinting is determined by the distance that a given pixel is from the camera. View fog has a uniform color independant of the distance you are from an object. Objects farther away will apear to "fade away" into the distance fog. Note, however, that the skybox is not affected by the fog on your level, but you can add fog into the skybox as well. Unlike View Fog, however, Distance Fog has to check a lot of distances every frame and this can have an impact on performance. However, some types of distance fog allow the engine to reject objects beyond a certain distance, which usually results in a net speed boost. Distance fog may not show up in the editor, and can be tuned in-game using the editactor console command to find the optimum values. Note, however, that distance fog may not obscure the coronas from lights.
Setting Up Distance Fog in Unreal Tournament
Firstly, you have to set the bFogZone variable in the zoneinfo of every zone you wish to be able to see distance fog in. The zone that the fog is actually in will be the ones that the fog actually exists in, but distance fog calculations are skipped entirely if the camera is in a zone with bFogZone false. On the downside, however, decals will not be displayed properly in a zone with bFogZone true, so bFogZone should be left false unless fog is actually likely to be seen from the zone in question.
Someone else fill in how to make the fog itself please..
Setting Up Distance Fog in UT2003
There are two ways to set up distance fog in UT2003, with a Zone or with a Volume. Zone fog is set in the variables of the ZoneInfo for a zone and affects any viewports inside the zone. Volume fog is created by placing a PhysicsVolume.
Zone Fog
Zone-based Distance Fog is set up similarly distance fog in UT. Create a zone where you want fog, place a zone info, and set some variables. Specifically those variables are:
group | variable | purpose |
ZoneInfo | bDistanceFog | Enable distance fog in this zone. |
ZoneLight | DistanceFogBlendTime | fade time when entering this zone. Only has an effect if the zone the camera is moving from also has bDistanceFog=true. |
ZoneLight | DistanceFogColor | Color of the fog. The A value seems to be ignored. |
ZoneLight | DistanceFogBegin | Distance in front of the camera that fog becomes visible, measured in UU. For a natural effect this should probably be small (< 2000). |
ZoneLight | DistanceFogEnd | Distance in front of the camera that the fog becomes 100% opaque. |
One big benefit of using zone fog in your map in addition to adding atmosphere is that it allows the engine to discard objects and entire zones if they're beyond the DistanceFogEnd distance, which can result in a big speed boost in some maps.
Volume Fog
Before we start, there's one important fact about Volume-based fog that you should know: It doesn't occlude. If you're trying to optimize your level use zone fog, as volume fog won't do anything for you (in fact it might make it run a bit slower due to the extra blending, but I'm not sure about that).
Volume-based distance fog is very similar to to View Fog in UT2003. You must place a PhysicsVolume to cover the area that you want the fog to affect, but instead of setting the ViewFog variables, you will need to set four variables under the "VolumeFog" group.
bDistanceFog | This is a boolean variable indicating whether or not distance fog calculations should be done. If you want to use distance fog, this must be set to true. By default, it is set to false. |
DistanceFogColor | This is a color variable that specifies, simply enough, the color that you want the fog to be. The alpha of the color will be determined by the distance that the object being viewed is from the camera. |
DistanceFogEnd | This is the distance at which fog cover is absolute. Everything at this range and beyond will be totally obscured. However, if the skybox does not contain fog, these objects will actually be silhouetted against the sky. (Because the object itself will be completely colored over by the sky behind it will be unaffected.) |
DistanceFogStart | This is the distance at which fog calculations begin. Anything closer than this distance to the camera will not be fogged at all. |
Interestingly, if you set DistanceFogStart to be GREATER than DistanceFogEnd, you will get inverse fog. Objects will become more obscured the CLOSER you get to them.
Emitter Fog
Emitter Fog is availible only in UT2003 and is the most demanding form of fog, resource wise. The only advantage Emitter-based fog has over distance fog is that emitter-based fog can move and creep about on your level. Emitter fog is created by simply making an Emitter with a very large range of locations for particles to be spawned. The particles should be translucent, very slow moving, relatively large (for performance reasons), and also should look somewhat foggy. This can take some experimentation to get right, but fortunately, emitter fog can be seen in the 3D viewport in the editor if realtime preview is enabled.
"Volumetric Fog"
Volumetric fog is something like an extended corona. It behaves like distance fog, but takes the shape of a sphere around a light source. I do not know if it is availible in UT2003, but I would suspect that it is. In Unreal Tournament, the radius of the spherical "fog" can be specified in the light's properties by setting the VolumeBrightness, VolumeFog, and VolumeRadius properties in the Lighting group. The fog will only be visible if the camera is within a zone that has bFogZone=true.
Tips and Tricks
Original Unreal Tournament
Fog is very handy with skyboxes that are a moving sky scene in the air. Your map will be more eye-pleasing if you have fog in the skybox. Also, who would want to see the sides of the skybox if your supposed to see the clouds flying by because your high in the sky? Anyway, if the skybox is a square, put eight lights on the perimeter and one in the center. Select all of the lights that you just created and fool around with the properties mentioned above. Be sure to not forget to set the "bFogZone" property to "True".
inio: did you mean to delete the stuff at the end?
Foxpaw: Yes, I refactored it above.
inio: There's a lot of UT-specific detailed information that got lost in the refactor. I restored it a bit.
RenegadeWeapon: Could someone fill in how to make Distance Fog in UT? It's sort of frustrating to know it exists but not how to make it...