Global volumetric fog in CRYENGINE allows you to model almost all aspects of Aerial Perspective. It simulates particles/aerosols distributed uniformly along the ground plane and falling off exponentially with height (based on height above sea level).
The fog integral between the viewer and each pixel in the scene gets properly solved taking the two mentioned distributions into account. Additionally, it accounts for sunlight scattered into the view ray to produce halos around the sun in foggy environments.
Only reflected sunlight from the ground is not considered since there's no closed form to solve the integral. Luckily, it can safely be ignored as it only has a minor impact on the final result.
Most volumetric fog parameters are directly editable in the editor's Time of Day window under Fog. There are also a few parameters in other subsections which contribute to the result of the volumetric fog computation.
Make sure you read up on the Time of Day documentation to discover how to tweak environment fog for your level.
The Fog entity is used to overwrite the fog effect in specific areas. In indoor areas a subtle fog effect can be added to simulate a dusty area.
To use, create an area shape and link the shape to the Fog Entity. When in game mode, you can walk into the area and see how the fog gets different inside. Outside Game mode the fog is not visible.
Defines the height of the density above sea level. The higher the atmosphere the less visible the effect of horizontal fog layers.
Sets up the time in which the fog takes to fade in.
Specifies the density of the fog.
FogVolumes exhibit the same properties of global volumetric fog, with the added benefit of locality. Currently supported volume types are boxes and ellipsoids (including spheres as a special case).
The benefit of using a FogVolume is that it is possible to define fog volumes that can be non-uniformly scaled along their major axes, rotated, and have an arbitrary fall-off direction (unlike global volumetric fog which defines the world space up-vector as its fall off direction).
Fog volumes are placed as entities. To place one open the RollupBar, select Entity, Render and then FogVolume in the tree view below. Drag the entity into the render view to place it. You should be see a white, spherical fog volume.
Translation and Rotation of a fog volume entity is performed via the move and rotate edit mode just like for any other object. Non-uniform scaling will distort the entity and produce incorrect rendering results.
Select/deselect this box to enable or disable this fog volume entity.
Set the fog color.
This value controls the latitude of the world space fall off direction of the fog.
This value controls the longitude of the world space fall off direction of the fog. 0° represents East, rotation is counter-clockwise.
This value scales the density distribution along the fall off direction. Higher values will make the fog fall off more rapidly and generate thicker fog layers along the negative fall off direction.
This value controls how much to shift the fog density distribution along the fall off direction in world units (m).
This value controls the global density of the fog. The higher the value the more dense the fog and the less you'll be able to see objects behind or inside the fog volume.
HDR brightness multiplier for the fog color.
Stop rendering the object, depending on camera distance to object.
This value specifies a factor that is used to soften the edges of the fog volume when viewed from outside.
During rendering the Color property is ignored. Instead, the current global fog color is used. Please refer to the Volumetric Fog page for further information.
Specifies the volume type. The following types are currently supported: 0 - Ellipsoid, 1 - Cube.
The height/width/depth of the fog volume in world units (m). Non-uniform scaling is possible so height, width and depth don't have to be the same.
Q: Shadow maps inside fog volumes do not work, what's wrong?
Make sure you have the cast/receive shadow flag unchecked for each fog volume entity.
Q: In indoors fog volumes sometime suddenly disappear when player moves around, how can this be fixed?
Make sure your fog volume entity doesn't cover more than one sector. They'll otherwise get culled when the main sector they were registered to becomes invisible.