Skip to end of metadata
Go to start of metadata

Overview

Clouds are shaded via gradient lighting, taking the sun and viewer direction into account. The gradient shading computation is done per-vertex. Interestingly, a per-pixel gradient computation gave inferior results as clouds tended to get overlit. In addition rim lighting is applied on a per-pixel basis to capture the effects of a special form of light scattering typically seen when looking at clouds being lit by the sun from behind. For more information on setting up 3D clouds in the Sandbox Editor, please see the Setting Up Weather Effects tutorial.

Clouds use "Soft Clipping" to gradually fade in/out at the near and far clipping plane. This prevents rendering artifacts in the far distance and flickering due to cloud particles entering/leaving the view cone near the camera during a flythrough. Additionally, clouds blend softly against opaque scene geometry. No manual setup is required to enable this feature!


Clouds rendered in CRYENGINE.

Material and Shading Parameters

For the gradient lighting the engine internally calculates a bright and a dark color and interpolates between the two based on the current viewer, sun and cloud position.

The bright color is calculated from the current HDR Sun color multiplier. The dark color is from the current HDR Sky color multiplier.

The values for sun and sky color as well as the two color multipliers can be altered in the editor's Time of Day window.

Material Parameters

  • Opacity - Defines the clouds overall opacity.
  • Diffuse Color - The diffuse color is modulated with dark color to get a material specific dark color.
  • Specular Color - The specular color is modulated with bright color to get a material specific bight color.

Shader Parameters

Param

Description

CloudAngularAtten

Defines the angular attenuation factor for rim lighting. The smaller the value the more wide-spread the rim lighting effect for clouds (partially) covering the sun from the viewer's point of view.


Angular attenuation set to 2.0, 10.0, 100.0 (from left to right)

CloudBacklightingScale

Defines how much the to scale rim lighting. The higher the value the more cloud edges will glow.

CloudOutlineSlope

Defines the slope of the ramp function used to blend in rim lighting. The higher the value the harder the transition.


Outline slope of 2.5 (left, threshold set to 0.2) and 0.45 (right, threshold set to 0.6)

 CloudOutlineThreshold

Defines the cloud's opacity threshold value below which the rim lighting effect is applied. The higher the threshold the more rim lighting will "grow" inwards.


Outline threshold set to 0.2, 0.4, 0.6 (from left to right)

HDRBrightnessAdjust

Controls brightness of clouds in HDR (relative to LDR).

Console Variables

e_Clouds

Enable clouds rendering

r_CloudsDebug

Toggles debugging mode for clouds.Usage: r_CloudsDebug [0/1/2]
Usage: r_CloudsDebug = 1: render just screen imposters
Usage: r_CloudsDebug = 2: render just non-screen imposters
Default is 0 (off)

  • No labels