Fog¶
Inherits: EntityHandle
C++ type: Fog
Description¶
Applies atmospheric fog to a scene. Fog blends the scene's rendered colour towards a fog colour based on the depth of each fragment from the camera, simulating haze, mist, or distance-based visibility falloff.
Three fog models are supported: linear, exponential, and squared-exponential.
Properties¶
| Type | Name | Default | Langs |
|---|---|---|---|
| FogType | type | LINEAR |
C++ | Lua |
| Vector3 | color | (0.8, 0.8, 0.8) |
C++ | Lua |
| float | density | 0.01 |
C++ | Lua |
| float | linearStart | 10.0 |
C++ | Lua |
| float | linearEnd | 100.0 |
C++ | Lua |
Methods¶
| Type | Name | Langs |
|---|---|---|
| void | setType | C++ | Lua |
| void | setColor | C++ | Lua |
| void | setDensity | C++ | Lua |
| void | setLinearStart | C++ | Lua |
| void | setLinearEnd | C++ | Lua |
| void | setLinearStartEnd | C++ | Lua |
Enumerations¶
FogType¶
- LINEAR — Fog increases linearly between
linearStartandlinearEnddistances. Full opacity atlinearEnd. - EXPONENTIAL — Fog uses the formula
exp(-density * d). Grows gradually regardless of distance bounds. - EXPONENTIALSQUARED — Fog uses
exp(-(density * d)²). More concentrated near objects, faster roll-off.
Property details¶
type¶
The fog calculation model.
color¶
- Setter: void setColor(Vector3 color)
- Setter: void setColor(float red, float green, float blue)
- Getter: Vector3 getColor() const
The fog colour in linear space. Match this to your sky colour for a natural-looking effect.
density¶
- Setter: void setDensity(float density)
- Getter: float getDensity() const
The density coefficient for EXPONENTIAL and EXPONENTIALSQUARED modes. Larger values produce thicker fog.
linearStart / linearEnd¶
- Setter: void setLinearStart(float start) / setLinearEnd(float end)
- Setter: void setLinearStartEnd(float start, float end)
- Getter: float getLinearStart() / getLinearEnd() const
The near and far clip distances for LINEAR fog. Objects closer than linearStart are unaffected; objects beyond linearEnd are fully in the fog colour.