Creating a global volumetric fog

In this recipe, you will interact with the HDR effects and learn to manipulate the global fog and other fog effects such as volumetric fog.

Getting ready

You should have Forest.cry open in the Editor and have completed the Creating your first time of day using the basic parameters recipe earlier in this chapter.

How to do it...

As we will soon be adjusting the fog color, to be able to visualize it easier being multiplied on top of the haze created by the HDR sky, we must set its multiplier:

  1. Open the Time Of Day dialog and ensure that the advanced time of day settings are displayed.
  2. Set the FogColorMultiplier to 10, so that we can easily see our color changing.
  3. Next, select a color for the fog.

    Note

    A good technique is to copy the color of the sun to warm the map or the color of the sky to cool it.

  4. In the following final screenshot, I have used the sky color of RGB 150, 200, 210 for the fog.
  5. Next, let's adjust the atmosphere height. This parameter defines the atmosphere height above the sea level. So, in reality the higher the atmosphere is, the less visible the effect of fog layers will be.
  6. Let's set our atmosphere to 8000. Since we have raised the atmosphere, the fog in the distance will be too bright and we will need to adjust for this.
  7. Set the FogColorMultiplier down to a more comfortable value of 5.

    Note

    If you still find that the density of the fog is too thick, then adjust the global density.

    How to do it...

You can now see that setting good volumetric fog can increase the believability of a level and especially highlight the silhouettes of distant objects.

How it works...

Global volumetric fog in the CryENGINE allows you to model almost all aspects of an atmospheric Aerial Perspective. It simulates particles/aerosols distributed uniformly along the ground plane and falling off exponentially from a height (based on height above the 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.

There's more...

You would have noticed other settings under the Fog parameters in the Time Of Day dialog such as Density offset. You might also want to know how to enable and disable fog rendering for ease of editing.

Density offset

The Density offset parameter shifts the fog density per pixel, by the given amount. As a result, objects that are close to the viewer appear less foggy.

Note

Adjusting this effect should be used sparingly as there is a realistic trait to this visual effect.

Enabling or disabling fog in the Render Settings

You can easily disable the rendering of fog in the Editor without adjusting the time of day settings. Do this by navigating to the Display tab in the RollupBar and unchecking Fog.

Enabling or disabling fog in the Render Settings

See also

  • Go back to the Terrain Lighting recipe earlier in this chapter to see the effects of sun lighting on the fog settings
  • Continue to the next recipe to create a custom skybox for your level
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.51.145