.. _stdlib_distance_fog_component: =========== DistanceFog =========== ++++++++++++ Enumerations ++++++++++++ .. _enum-public_components-DistanceFogLightingMode: .. das:attribute:: 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. .. _enum-public_components-DistanceFogMode: .. das:attribute:: DistanceFogMode :Values: * **Linear** = 0 - Linear fading in range ``[startDistance, startDistance + 1 / (1 - density) - 1]``. Cheapest to compute. * **Exponential** = 1 - Exponential fading starting from ``startDistance`` according to formula ``exp2(-(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 ``startDistance`` according to formula ``exp2(-pow((1 / (1 - density) - 1) * (distance - startDistance), 2))``. May be useful for producing smooth yet short transition into the fog without visible edges at ``startDistance``. +++++++ Classes +++++++ .. _struct-distance_fog_component-DistanceFog: .. das:attribute:: 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: .. _function-distance_fog_component__dot__rq_active_DistanceFog: .. das:operator:: DistanceFog.active() : bool .. _function-distance_fog_component__dot__rq_active_rq_clone_DistanceFog_bool: .. das:operator:: 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 .. _function-distance_fog_component__dot__rq_mode_DistanceFog: .. das:operator:: DistanceFog.mode() : DistanceFogMode .. _function-distance_fog_component__dot__rq_mode_rq_clone_DistanceFog_DistanceFogMode: .. das:operator:: DistanceFog.mode =(value: DistanceFogMode) Approach used for computing fog amount at a certain depth. See DistanceFogMode enum description for details. :Arguments: * **value** : :ref:`DistanceFogMode ` .. _function-distance_fog_component__dot__rq_lightingMode_DistanceFog: .. das:operator:: DistanceFog.lightingMode() : DistanceFogLightingMode .. _function-distance_fog_component__dot__rq_lightingMode_rq_clone_DistanceFog_DistanceFogLightingMode: .. das:operator:: DistanceFog.lightingMode =(value: DistanceFogLightingMode) Approach used for lighting the fog. See DistanceFogLightingMode enum description for details. :Arguments: * **value** : :ref:`DistanceFogLightingMode ` .. _function-distance_fog_component__dot__rq_color_DistanceFog: .. das:operator:: DistanceFog.color() : float4 .. _function-distance_fog_component__dot__rq_color_rq_clone_DistanceFog_float4: .. das:operator:: DistanceFog.color =(value: float4) Color of the fog. Works as a multiplier to lighting if the latter is enabled. :Arguments: * **value** : float4 .. _function-distance_fog_component__dot__rq_density_DistanceFog: .. das:operator:: DistanceFog.density() : float .. _function-distance_fog_component__dot__rq_density_rq_clone_DistanceFog_float: .. das:operator:: DistanceFog.density =(value: float) Desnsity of the fog in range [0, 1]. :Arguments: * **value** : float .. _function-distance_fog_component__dot__rq_densityHeightFalloff_DistanceFog: .. das:operator:: DistanceFog.densityHeightFalloff() : float .. _function-distance_fog_component__dot__rq_densityHeightFalloff_rq_clone_DistanceFog_float: .. das:operator:: 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 .. _function-distance_fog_component__dot__rq_densityHeightOrigin_DistanceFog: .. das:operator:: DistanceFog.densityHeightOrigin() : float .. _function-distance_fog_component__dot__rq_densityHeightOrigin_rq_clone_DistanceFog_float: .. das:operator:: DistanceFog.densityHeightOrigin =(value: float) Height at which density starts to decrease. :Arguments: * **value** : float .. _function-distance_fog_component__dot__rq_startDistance_DistanceFog: .. das:operator:: DistanceFog.startDistance() : float .. _function-distance_fog_component__dot__rq_startDistance_rq_clone_DistanceFog_float: .. das:operator:: DistanceFog.startDistance =(value: float) Distance from the camera at which the fog starts. :Arguments: * **value** : float