Class ExponentialHeightFog
Used to create fogging effects such as clouds but with a density that is related to the height of the fog.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Level/Actors/ExponentialHeightFog.h
Syntax
public class ExponentialHeightFog : public Actor, public IFogRenderer
Fields
DirectionalInscatteringColor
Controls the color of the directional inscattering, which is used to approximate inscattering from a directional light. Note: there must be a directional light enabled for DirectionalInscattering to be used.
Declaration
public Color DirectionalInscatteringColor = Color(0.25, 0.25f, 0.125f)
Field Value
Color
|
DirectionalInscatteringExponent
Controls the size of the directional inscattering cone, which is used to approximate inscattering from a directional light. Note: there must be a directional light enabled for DirectionalInscattering to be used. Range: 2-64.
Declaration
public float DirectionalInscatteringExponent = 4.0f
Field Value
float
|
DirectionalInscatteringLight
Directional light used for Directional Inscattering.
Declaration
public ScriptingObjectReference<DirectionalLight> DirectionalInscatteringLight
Field Value
ScriptingObjectReference<DirectionalLight>
|
DirectionalInscatteringStartDistance
Controls the start distance from the viewer of the directional inscattering, which is used to approximate inscattering from a directional light. Note: there must be a directional light enabled for DirectionalInscattering to be used.
Declaration
public float DirectionalInscatteringStartDistance = 10000.0f
Field Value
float
|
FogCutoffDistance
Scene elements past this distance will not have fog applied. This is useful for excluding skyboxes which already have fog baked in. Setting this value to 0 disables it.
Declaration
public float FogCutoffDistance = 0.0f
Field Value
float
|
FogDensity
The fog density factor.
Declaration
public float FogDensity = 0.02f
Field Value
float
|
FogHeightFalloff
The fog height density factor that controls how the density increases as height decreases. Smaller values produce a more visible transition layer.
Declaration
public float FogHeightFalloff = 0.2f
Field Value
float
|
FogInscatteringColor
Color of the fog.
Declaration
public Color FogInscatteringColor = Color(0.448f, 0.634f, 1.0f)
Field Value
Color
|
FogMaxOpacity
Maximum opacity of the fog. A value of 1 means the fog can become fully opaque at a distance and replace scene color completely. A value of 0 means the fog color will not be factored in at all.
Declaration
public float FogMaxOpacity = 1.0f
Field Value
float
|
StartDistance
Distance from the camera that the fog will start, in world units.
Declaration
public float StartDistance = 0.0f
Field Value
float
|
VolumetricFogAlbedo
The height fog particle reflectiveness used by volumetric fog. Water particles in air have an albedo near white, while dust has slightly darker value.
Declaration
public Color VolumetricFogAlbedo = Color::White
Field Value
Color
|
VolumetricFogDistance
Distance over which volumetric fog should be computed. Larger values extend the effect into the distance but expose under-sampling artifacts in details.
Declaration
public float VolumetricFogDistance = 6000.0f
Field Value
float
|
VolumetricFogEmissive
Light emitted by height fog. This is a density value so more light is emitted the further you are looking through the fog. In most cases using a Skylight is a better choice, however, it may be useful in certain scenarios.
Declaration
public Color VolumetricFogEmissive = Color::Black
Field Value
Color
|
VolumetricFogEnable
Whether to enable Volumetric fog. Graphics quality settings control the resolution of the fog simulation.
Declaration
public bool VolumetricFogEnable = false
Field Value
bool
|
VolumetricFogExtinctionScale
Scales the height fog particle extinction amount used by volumetric fog. Values larger than 1 cause fog particles everywhere absorb more light. Range: 0.1-10.
Declaration
public float VolumetricFogExtinctionScale = 1.0f
Field Value
float
|
VolumetricFogScatteringDistribution
Controls the scattering phase function - how much incoming light scatters in various directions. A distribution value of 0 scatters equally in all directions, while 0.9 scatters predominantly in the light direction. In order to have visible volumetric fog light shafts from the side, the distribution will need to be closer to 0. Range: -0.9-0.9.
Declaration
public float VolumetricFogScatteringDistribution = 0.2f
Field Value
float
|
Methods
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
DeserializeStream
stream
The input stream. |
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Overrides
Draw(RenderContext& renderContext)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContext& renderContext) override
Parameters
RenderContext
renderContext
The rendering context. |
Overrides
DrawFog(GPUContext* context, RenderContext& renderContext, GPUTextureView* output)
Draw fog using GBuffer inputs
Declaration
public virtual void DrawFog(GPUContext* context, RenderContext& renderContext, GPUTextureView* output) override
Parameters
GPUContext
context
Context responsible for rendering commands |
RenderContext
renderContext
The rendering context. |
GPUTextureView
output
Output buffer |
Overrides
GetEditorBox()
Gets actor bounding box (single actor, no children included) for editor tools.
Declaration
public virtual BoundingBox GetEditorBox() const override
Returns
BoundingBox
|
Overrides
GetExponentialHeightFogData(const RenderView& view, ShaderExponentialHeightFogData& result)
Gets the exponential height fog data.
Declaration
public virtual void GetExponentialHeightFogData(const RenderView& view, ShaderExponentialHeightFogData& result) const override
Parameters
RenderView
view
The rendering view. |
ShaderExponentialHeightFogData
result
The result. |
Overrides
GetVolumetricFogOptions(VolumetricFogOptions& result)
Gets the volumetric fog options.
Declaration
public virtual void GetVolumetricFogOptions(VolumetricFogOptions& result) const override
Parameters
VolumetricFogOptions
result
The result. |
Overrides
HasContentLoaded()
Returns true if actor has loaded content.
Declaration
public virtual bool HasContentLoaded() const override
Returns
bool
|
Overrides
IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between the current object and a ray.
Declaration
public virtual bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
Returns
bool
True whether the two objects intersected, otherwise false. |
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
protected virtual void OnDisable() override
Overrides
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
protected virtual void OnEnable() override
Overrides
OnTransformChanged()
Called when actor transform gets changed.
Declaration
protected virtual void OnTransformChanged() override
Overrides
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
SerializeStream
stream
The output stream. |
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |