Fog

Distance fog for a Camera3d (its fog), sharing the draw distance's fade band (Camera3d.drawDistanceFadeFraction). Off by default.

With a backdropHeight, the band of the screen from where the ground ends up to that height at the draw distance (or the horizon, if lower) is filled in color behind everything, so objects fading out fade into fog rather than the sky. Drawables with castsFogSilhouette set keep blocking the sky past the draw distance, in color, out to silhouetteReach times it: a model by its own outline (a pointed roof stays pointed, see silhouetteHulls), an image by its corners, level walls (BGE.DrawableWalls) as their real outline.

Fog fixes the draw distance: it doesn't change with the render quality level (see followsQuality).

Fields are read every frame, so they can be changed live.

Properties

  • enabled (boolean) — Nothing is drawn or worked out while this is false
  • color (integer) — RGB (0xRRGGBB), like Drawable.color
  • backdropHeight (float) — How high the backdrop reaches at the draw distance, in world units (0 for no backdrop). It
  • backdropRegion (dynamic) — An roRegion stretched over the backdrop, tinted with color (so draw it white), or
  • silhouetteHulls (boolean) — Outline each silhouette by its model's own points, split up its height (a tower on a nave,
  • silhouetteReach (float) — Silhouettes reach this many times the draw distance (0 for none). 1 keeps the fog that
  • silhouetteStartAlpha (float) — Fog makes up the opacity a fading object has lost, once its fade alpha drops below this
  • silhouetteOpacityLead (float) — How much faster a fading object's silhouette makes up the opacity it has lost: drawn at
  • followsQuality (boolean) — With fog on, the draw distance stays at Camera3d.maxDrawDistance at every render quality
  • qualityTransitionSeconds (float) — Seconds a draw distance change takes to ease in while followsQuality is set, when longer

Example

CODE
camera.fog.enabled = true
camera.fog.color = &h1C2842
camera.fog.backdropHeight = 400
houseModel.castsFogSilhouette = true

Constructor

new Fog(): Fog