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.
- 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.
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.
Defines how much the to scale rim lighting. The higher the value the more cloud edges will glow.
Defines the slope of the ramp function used to blend in rim lighting. The higher the value the harder the transition.
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.
Controls brightness of clouds in HDR (relative to LDR).