Class Atmosphere
f = 1 - exp(-depth / scale). Disabled by default; enable per
scene (setEnabled(boolean), the Fallout 4 environment does) or
globally with -De3d.atmosphere=true /
e3d.atmosphere: true in the config file
(bugreport-20261006-000922).
Cost model: the factor is evaluated once per polygon per frame and
folded into the same per-polygon light multiplier the span loops
already apply — texel * (light*(1-f)) + sky*f — so the
per-pixel price on textured triangles is one ADD per channel and no
additional multiplication. Solid polygons precompute one shaded color
per polygon, so their per-pixel cost is exactly zero. Lightmapped
triangles sit inside the stage-3 bubble a few hundred units from the
camera, where the factor rounds to zero for any practical scale; that
path is deliberately left untouched.
The haze target color is the configured e3d.atmosphereColor
when set, otherwise the scene's sky color
(LightingManager.getSkyColor()), so the horizon blends into
the backdrop seamlessly. With neither, haze is inert.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidBlends a per-polygon shaded color toward the haze target in place:c = c*(1-f) + target*f.static booleanenabled()Returns whether distance haze is active.static floatfactor(double cameraDepth) The haze factor for a camera-space depth: 0 at the camera, approaching 1 at infinity.static voidDrops all runtime overrides; configuration applies again.static doublescale()Returns the haze scale in world units.static voidSets the haze target color at runtime.static voidsetEnabled(boolean enabled) Enables or disables the haze at runtime (environment modules).static voidsetScale(double scale) Sets the haze scale at runtime: the camera depth at which the haze factor reaches ~63% (1 - 1/e).static ColortargetColor(LightingManager lighting) Resolves the haze target color: runtime override, then the configurede3d.atmosphereColor, then the scene's sky color.
-
Method Details
-
setEnabled
public static void setEnabled(boolean enabled) Enables or disables the haze at runtime (environment modules). Wins overe3d.atmosphere; seeresetOverrides().- Parameters:
enabled- true to haze distant geometry toward the sky color
-
setScale
public static void setScale(double scale) Sets the haze scale at runtime: the camera depth at which the haze factor reaches ~63% (1 - 1/e). Wins overe3d.atmosphereScale.- Parameters:
scale- world units
-
setColor
Sets the haze target color at runtime. Wins overe3d.atmosphereColorand the scene sky color.- Parameters:
color- haze color, or null to fall back to configuration
-
resetOverrides
public static void resetOverrides()Drops all runtime overrides; configuration applies again. -
enabled
public static boolean enabled()Returns whether distance haze is active. -
scale
public static double scale()Returns the haze scale in world units. -
factor
public static float factor(double cameraDepth) The haze factor for a camera-space depth: 0 at the camera, approaching 1 at infinity. Returns 0 when the haze is disabled or the depth is behind the near plane.- Parameters:
cameraDepth- camera-space Z of the polygon- Returns:
- haze blend factor in [0, 1)
-
targetColor
Resolves the haze target color: runtime override, then the configurede3d.atmosphereColor, then the scene's sky color.- Parameters:
lighting- the scene lighting manager, or null- Returns:
- the color to fade toward, or null when none is known (haze stays inert)
-
applyHaze
Blends a per-polygon shaded color toward the haze target in place:c = c*(1-f) + target*f. Called once per polygon per frame — the span loops keep painting the constant result, so solid polygons pay zero per-pixel cost for the haze.- Parameters:
shaded- the polygon's lit color, mutatedf- haze factor fromfactor(double)target- haze target color fromtargetColor(LightingManager)
-