Fog class Lighting and environment
Distance fog for a Scene: geometry blends toward color the farther it is from the camera, evaluated per-fragment in linear HDR before tone mapping so fog is exposed and tone-mapped along with the scene.
Fog is a Scene setting (scene.fog), off by default. Set enabled and a
mode to turn it on. It applies to lit and unlit materials alike (the
skybox is left unfogged, so set color to your horizon color for distant
geometry to dissolve into the sky).
Two cheap extras: heightFalloff makes the fog ground-hugging (thinning with
altitude, exponential mode only), and sunInScatter adds a glow toward the
scene's directional light so looking into the sun through fog brightens.
Constructors
- Fog()
Properties
- color ↔ Vector3
-
Fog color, linear (not sRGB). Distant opaque geometry converges to this, so
matching it to the horizon color makes geometry dissolve into the sky.
getter/setter pair
- cutoffDistance ↔ double
-
Distance past which fog is not applied (0 disables the cutoff). Useful to
exclude a far layer that already reads as hazed.
getter/setter pair
- density ↔ double
-
Density for FogMode.exponential and FogMode.exponentialSquared. Larger
is thicker. See visibilityDensity for a distance-based way to set it.
getter/setter pair
- enabled ↔ bool
-
Whether fog is applied. False (the default) leaves the scene unfogged even
if a mode is set.
getter/setter pair
- end ↔ double
-
Distance at which FogMode.linear reaches full maxOpacity. Unused by the
exponential modes.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
Reference altitude (world Y) for height fog: where the fog is densest.
getter/setter pair
- heightFalloff ↔ double
-
How fast fog thins with altitude above height (0 = uniform, no height
fog). Only affects FogMode.exponential. Larger hugs the ground more
tightly.
getter/setter pair
- maxOpacity ↔ double
-
Upper bound on fog opacity (0 to 1). Below 1 the fog never fully hides
distant geometry, so a bright sky still shows through.
getter/setter pair
- mode ↔ FogMode
-
The distance-to-density curve. FogMode.none disables fog regardless of
enabled.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skyColorInfluence ↔ double
-
How much the fog color is taken from the sky instead of color (0 = flat
color, 1 = fully the environment sampled in the view direction). Above 0,
far geometry fades into the actual sky/horizon behind it (aerial
perspective) rather than a flat wall of color. Sampled from the
image-based-lighting environment, so it applies to lit materials; unlit
materials always use the flat color.
getter/setter pair
- start ↔ double
-
Distance at which fog begins. For FogMode.linear this is the near end; for
the exponential modes it offsets where accumulation starts (near geometry
stays clear).
getter/setter pair
- sunInScatter ↔ double
-
Strength of the in-scattering glow toward the scene's directional light
(0 = off). Cheap sun-through-fog without volumetrics.
getter/setter pair
- sunInScatterExponent ↔ double
-
Tightness of the sun in-scatter cone: larger concentrates the glow near the
sun. Only meaningful when sunInScatter is above 0.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
visibilityDensity(
double meters) → double -
The density that makes objects roughly
metersaway fade to a low-contrast haze, via Koschmieder's law (contrast threshold0.02). A convenience for authoring exponential fog by visibility distance instead of a raw coefficient.