CRYENGINE includes a CGI quality Time Of Day lighting system. Designers can use the Time Of Day function to simulate realistic and surrealistic lighting effects.
After completing this tutorial, you will be able to use the Time Of Day function, the Terrain Lighting dialog box, and the Terrain -> Environment panel in the RollupBar to configure precise lighting conditions.
Time Of Day Dialog Box
The Time Of Day dialog box is used to configure the lighting and environment settings of a level. All values can be animated over time so that the level will look different as time advances.
Open the Time Of Day function through the Terrain menu. You can also find a "Time Of Day" button in the main toolbar.
The Time of Day window will typically open with just the basic properties listed but you can toggle between the basic and advanced properties, by selecting the Toggle Advanced Properties option on the left hand panel.
A complete list of the parameters and their functions can be found at the end of this tutorial. There are also additional parameters which can be accessed via the Rollup Bar -> Terrain -> Environment tab.
Static Versus Dynamic Skies
Some of the parameters described on this page are relevant only to either Dynamic (HDR sky) or Static (Skybox). The latter are simple boxes that use textures to render a sky dome; hence, they cannot offer all the dynamic effects exposed by HDR sky and the Time Of Day system.
It is important to remember that the sky and time of day can be configured on a level per level basis. Dynamic skies use a material that has the "SkyHDR" shader assigned. Static skies use a material with the "Sky" shader and combines textures containing the five sides of the sky box (all cube sides, except the bottom). To manipulate the sky, create or pick an appropriate material and assign it to the sky dome through RollupBar -> Environment -> Skybox -> Material/MaterialLowSpec. You must also have the "Skybox Multiplier" value set to '1' in the Time of Day properties.
To store the changes made in the parameters panel, the red record button in the top panel needs to be highlighted. The Time Of Day dialog box has a slider that represents a 24 hour day. It can be used to set the current time and can also be used to scroll or scrub through the entire 24 hour cycle.
All the parameters that are changed in the right panel will be set for the currently selected time. The graph in the center of the dialog box shows the change of the highlighted parameter over time. When a parameter in the right panel is changed, the graph curve will be updated at the currently selected time. It is also possible to directly change the curve by dragging around the key frame points. New key frames can be inserted by double-clicking the curve and existing ones can be removed by double-clicking the key frames themselves.
It is important to realize that each yellow dot in the graph for each property is a key frame and times that lie between these keyframes will have their values interpolated.
Time Of Day Tasks
Import From File
Imports the Time Of Day settings from an XML/TOD file.
Export To File
Exports the Time Of Day settings to an XML file.
Resets all the parameters to their default values.
Expands all the parameter group panels.
Collapses all the parameter group panels.
Toggle Advanced Properties
Toggles the properties view panel on the right to either show just the basic properties or all available properties.
Displays the current time that is being edited.
Initial time that will be used when the mission is started.
If you do not set this value correctly, your TOD will not be set correctly in pure-game mode.
End time that will be used for the mission. If the end time is set to 23.59, the time will loop, starting the next Time Of Day cycle once a day is over.
Speed at which the time advances; 0.005 is a good general value.
Starts or resumes the playback of the Time Of Day sequence in the Editor.
Stops the playback of the Time Of Day sequence in the Editor.
Force Sky Update
Selecting this check box forces a complete update of the sky light calculations in each frame.
The Terrain Lighting Dialog Box
See Terrain Lighting Tool for more information.
See Cloud Shadows for more information.
See Environment Panel for more information.
Time of Day Parameters Settings
HDR dynamic power factor
The dynamic power factor is applied to all the light sources, when rendering in the HDR mode.
This value should be left at 0 to maintain consistent and accurate lighting results. It will be removed in future updates. Use the HDR Curve Editor controls instead.
Sky brightening (terrain occlusion)
DEPRECATED (3.6) - This value specifies how much ambient occlusion on terrain, under trees, and the like, should be visible.
Global illumination multiplier
This value specifies how strong the global illumination will be.
This RGB value sets the color of the light source used as the sun.
Sun color Multiplier
This value specifies the brightness of the sun and gets multiplied with the sun color.
Sun specular Multiplier
An additional control for the brightness of the sun, allowing you to increase the intensity and brightness of the sun on specular materials in the world.
This allows for gradient coloring of the global fog. This value will be the bottom color of the fog
Color (bottom) multiplier
This value is multiplied by the bottom fog color and specifies the brightness of the top fog color.
Specifies a reference height for the vertical fog gradient (in range [-5000..35000], default is 0).
Density at the top (in range [0..1], default is 1). Please note that it is possible to set the top density to a higher value than the bottom density.
This allows for gradient coloring of the global fog. This value will be the top color of the fog.
Color (top) multiplier
This value is multiplied by the top fog color and specifies the brightness of the top fog color.
Specifies a reference height for the vertical fog gradient (in range [-5000..35000], default is 4000).
Density at the top (in range [0..1], default is 1). Please note that it is possible to set the top density to a higher value than the bottom density.
Color height offset
Shifts the color of the vertical fog gradient towards the top or bottom (in range [-1..1], default is 0).
Color (radial) & multiplier
Specifies the color of the fog component responsible for producing halos around the sun and in-scattering of sun light.
Specifies the size of the radial fog component (in range [0..1], default is 0.75).
Specifies how much the radial fog component is affected by distance (in range [0..1], default is 0.5).
Final density clamp
Specifies the maximum fog density that is allowed for final blending with the scene (in range [0..1], default is 1).
This value specifies the global density of the volumetric fog. Higher values produce denser fog.
The ramp values can be used to control the fog density in relation to the camera.
This sets the distance from the camera at which the fog will be rendered at its maximum density, set by the Global Density parameter.
This value determines how much the ramp values effect the rendering of the fog.
Specifies how much the fog color computed per pixel (via the settings above) is generally darkened based on the volumetric shadow value computed by the engine per pixel (in range [0..1], default is 0.25).
Shadow darkening sun
Specifies how much the radial fog color is influenced individually (in range [0..1], default is 1).
Shadow darkening ambient
Specifies how much the ambient fog color (i.e. height gradient) is influenced individually (in range [0..1], default is 1).
Specifies how far volumetric shadows get traced (in range [0..1], default is 0.1; that is, up until 10% of the level's far clip plane distance).
Please note that these parameters are ignored when a static sky is used.
Parameters in this section are solely used to compute the atmospheric appearance of a dynamic sky. They do not directly affect the rendering of objects in the world (for example, lighting colors and intensities).
However, they are used to internally compute an approximate fog color to automatically fog the entire scene in appropriate colors. For a static sky, only the fog color in the fog parameter group is used.
For a more in-depth explanation of the physical scattering parameters listed below, please refer to this page.
A RGB value specifying the sun color that is used to compute the atmosphere color.
Sun intensity multiplier
This value sets the brightness of the sun. It gets multiplied by the sun intensity to yield the overall color.
This parameter sets the Mie scattering constant. Mie scattering is caused by aerosols in the lower atmosphere (up to 1 km).
This parameter specifies the Rayleigh scattering constant. Rayleigh scattering is caused by particles in the atmosphere (up to 8 km) and is wavelength dependent.
Sun anisotropy factor
The anisotropy factor controls the sun's appearance in the sky. The closer this value gets to -1.0, the sharper and smaller the sun spot will be.
Wavelength R, G, and B
This triple defines the wavelengths (in nm) of the RGB primaries. Tweaking these values will shift the colors of the resulting gradients and produce different kinds of atmospheres.
Night Sky and Night Sky Multiplier
Please note that all the parameters in this section are ignored when a static sky is used.
Horizon color & multiplier
This RGB value that is scaled by the multiplier specifies the horizon color of the night sky gradient.
Zenith color & multiplier
This RGB value that is scaled by the multiplier specifies the zenith color of the night sky gradient.
This value shifts the night sky gradient. Small values shift it more towards the bottom. Higher values shift it towards the top.
This value controls the overall brightness of the stars.
Moon color & multiplier
This RGB value that is scaled by the multiplier specifies the moon's emissive color.
Moon inner corona color & multiplier
This RGB value that is scaled by the multiplier specifies the color of the moon's inner corona.
Moon inner corona scale
This value controls the size and blurriness of the moon's inner corona.
Moon outer corona color & multiplier
This RGB value that is scaled by the multiplier specifies the color of the moon's outer corona.
Moon outer corona scale
This value controls the size and blurriness of the moon's outer corona.
All types of clouds supported by the engine (distance clouds, impostor clouds, and volumetric clouds) use the current sky and sun color, along with per material albedo to shade the clouds.
As sun and sky color can be slightly too bright or dark in certain scenarios, the following two parameters provide means to correct the cloud brightness for a given time of day.
This value specifies how much the sun affects the cloud brightness.
This value specifies how much the sky light affects the cloud brightness.
Sun custom color
Sun custom color multiplier
Sun custom color influence
Sky custom color
Sky custom color multiplier
Sky custom color influence
Sun Rays Effect
Sun shafts visibility
DEPRECATED - This value controls the visibility of sun shafts.
Sun rays visibility
This value controls the visibility of sun rays. Higher values cause brighter rays around the sun.
Sun rays attenuation
This value controls the attenuation of sun rays. Higher values cause shorter rays around the sun.
Sun rays suncolor influence
This value controls how much the sun color contributes to the color of the sun rays.
Sun rays custom color
This value specifies a custom color for the sun rays.
Ocean fog color
This RGB color specifies the ocean fog color for a specific time of day.
Ocean fog color multiplier
This parameter controls the brightness of the ocean fog and is multiplied by the ocean fog color.
Ocean fog density
This value controls the density of the ocean fog.
This value controls the brightness of a static skybox. This parameter is not used for a dynamic sky.
This must be set to '1' when using a static skybox.
This parameter applies a grain filter to the final image.
This parameter applies a sharpening filter to the final image.
This parameter applies a color filter to the final image.
This parameter controls the strength of the photo color filtering.
Depth of Field
This parameter specifies at what distance the background begins to become blurry (out of focus).
This parameter controls how strong areas that are out of focus, are blurred.
The parameters in this section give you control over the sun's cascaded shadow map bias settings at different ranges. It does not affect point lights (bias settings can be defined per light in the light properties).
Moves the shadow cascade toward or away from the shadow-casting object (or objects).
Allows you to adjust the gradient (slope-based) bias used to compute the shadow bias.
Customize the sharpness of the shadows.
CRYENGINE supports multiple cascades. Cascade 0 is closest to the camera, cascade 1 is further, etc. The higher the cascade, the lower the precision of the shadows (lower resolution for higher cascades).
Shadow map acne is usually visible at medium range on the 3rd and 4th cascade especially. To prevent shadow map artifacts, the sun shadows bias and slope bias settings are exposed in the time of day.
The lower the “Bias”, the more connected the shadows will be to the shadow caster.
In most cases, the "Bias" should be kept as low as possible, to ensure a proper connection between the shadow and the shadow caster. Values between 0.01 and 0.05 offer the best compromise.
|Bias = 0||Bias = 0.05|
|Bias = 1||Bias = 5|
Shadow Slope Bias
The higher the "Slope Bias", the less shadows will be cast from surface with a high angle of incidence of the light.
In most cases, you want to keep the “Slope Bias” at a fairly high value, to remove the artifacts usually produced by the low shadow bias. Values between 32 and 64 offer the best compromise.
|Slope Bias = 8||Slope Bias = 32|
|Slope Bias = 64||Bias = 0.025 / Slope Bias = 32|
In the last image above, a compromise was made between Bias of 0.025 and Slope Bias of 32. Some artifacts are visible, but the self shadowing is better overall.
There is no "one-size-fits-all" setting for shadow cascades. It depends on your assets, sun position, lighting conditions, etc. Tweak these settings to suit your needs and keep in mind they have little to no impact on performance.
Shadow Jittering can be defined through Time of Day (as well as r_ShadowJittering CVar) to give you control over shadow sharpness.
Note that the more jittering that is used, the heavier on performance it is.
|Shadow Jittering = 2.5 (default)||Shadow Jittering = 1||Shadow Jittering = 10|
HDR Curve Editor
Film curve shoulder scale
Controls the slope at the tip of the curve (modified bright values).
Film curve midtones scale
Controls the linearity of the middle of the curve (modifies grey values).
Film curve toe scale
Controls the slope at the base of the curve (modifies dark values).
Film curve whitepoint
Sets the value to be mapped as pure white in the tone mapped image.
Color saturation before tone-mapping.
HDR Color balance to control overall color of the scene.
Overall brightness of the scene used for the automatic eye adaptation.
Darkest possible exposure used for the automatic eye adaptation.
Brightest possible exposure used for the automatic eye adaptation.
Controls the amount of bloom that comes from glowing/lit objects.