DistanceFog
Enumerations
- DistanceFogLightingMode
- Values:
None = 0 - No lighting is applied to fog and just raw color is taken.
Ambient = 1 - Ambient light at view direction is applied to fog, simulating inscattering of light coming from the environment.
- DistanceFogMode
- Values:
Linear = 0 - Linear fading in range
[startDistance, startDistance + 1 / (1 - density) - 1]. Cheapest to compute.Exponential = 1 - Exponential fading starting from
startDistanceaccording to formulaexp2(-(1 / (1 - density) - 1) * (distance - startDistance)). This is a physically plausible way for representing light absorption. Also enables correct usage of height-based density.ExponentialSquared = 2 - Exponential fading starting from
startDistanceaccording to formulaexp2(-pow((1 / (1 - density) - 1) * (distance - startDistance), 2)). May be useful for producing smooth yet short transition into the fog without visible edges atstartDistance.
Classes
- DistanceFog : NativeComponent
This component is used to setup distance fog effect. Distance fog is a non-physical effect with the primary use case of hiding away far parts of the scene. But it can be a good cheap alternative to volumetric fog when no advanced lighting is required, especiall with usage of height-based density.
To use this component, add the following line to your project file:
require engine.core_components.distance_fog_component // or require engine.core
Usage example:
let setting = create_render_settings()
get_component(renderSettings) $(var fog : DistanceFog?) {
fog.active = true
fog.density = 0.005
fog.lightingMode = DistanceFogLightingMode.Ambient
}
- Properties:
- DistanceFog.active: bool
- DistanceFog.active =(value: bool)
Active flag. If set to true, distance fog will be applied to the result image. Default is false.
- Arguments:
value : bool
- DistanceFog.mode: DistanceFogMode
- DistanceFog.mode =(value: DistanceFogMode)
Approach used for computing fog amount at a certain depth. See DistanceFogMode enum description for details.
- Arguments:
value : DistanceFogMode
- DistanceFog.lightingMode: DistanceFogLightingMode
- DistanceFog.lightingMode =(value: DistanceFogLightingMode)
Approach used for lighting the fog. See DistanceFogLightingMode enum description for details.
- Arguments:
value : DistanceFogLightingMode
- DistanceFog.color: float4
- DistanceFog.color =(value: float4)
Color of the fog. Works as a multiplier to lighting if the latter is enabled.
- Arguments:
value : float4
- DistanceFog.density: float
- DistanceFog.density =(value: float)
Desnsity of the fog in range [0, 1].
- Arguments:
value : float
- DistanceFog.densityHeightFalloff: float
- DistanceFog.densityHeightFalloff =(value: float)
Falloff coefficient of density decrease with increase of altitude in range [0, 1]. Density multiplier at a height h is computed as exp((1 - 1 / (1 - densityHeightFalloff)) * (h - densityHeightOrigin)). Note that height-based density computation is only correct for DistanceFogMode Exponential, although working with any mode.
- Arguments:
value : float
- DistanceFog.densityHeightOrigin: float
- DistanceFog.densityHeightOrigin =(value: float)
Height at which density starts to decrease.
- Arguments:
value : float
- DistanceFog.startDistance: float
- DistanceFog.startDistance =(value: float)
Distance from the camera at which the fog starts.
- Arguments:
value : float