Skip to content

API Class Fog

github-actions[bot] edited this page Nov 25, 2026 · 7 revisions

Class: Fog

Defined in: src/engine/render/components.ts:712

Distance fog for the World (ADR 0071): the first enabled one applies to every material that takes fog. Every field can change each frame (a storm fading in) without recompiling materials.

Extends

Constructors

Constructor

new Fog(): Fog;

Returns

Fog

Inherited from

Component.constructor

Properties

affectsSkybox

affectsSkybox: boolean = false;

Defined in: src/engine/render/components.ts:723

Fade the sky to the fog colour too, by skyboxFog.


color

color: Color;

Defined in: src/engine/render/components.ts:715


density

density: number = 0.02;

Defined in: src/engine/render/components.ts:721

Thickness of exponential fog (about 1 / the distance it fades out over).


far

far: number = 100;

Defined in: src/engine/render/components.ts:719

Distance where linear fog is total, in metres.


heightFog

heightFog: boolean = false;

Defined in: src/engine/render/components.ts:727

Height fog (ADR 0110): thick near heightFogBase and thinning above it, on top of distance fog.


heightFogBase

heightFogBase: number = 0;

Defined in: src/engine/render/components.ts:731

The height, in metres, where height fog has heightFogDensity; it's thicker below and thinner above.


heightFogDensity

heightFogDensity: number = 0.05;

Defined in: src/engine/render/components.ts:729

Height fog's thickness at heightFogBase (about 1 / the distance it fades out over there).


heightFogFalloff

heightFogFalloff: number = 0.2;

Defined in: src/engine/render/components.ts:733

How fast height fog thins with height: it falls to about a third every 1 / falloff metres up.


mode

mode: FogMode = "linear";

Defined in: src/engine/render/components.ts:714

Distance fog's curve, or none for height fog alone (ADR 0110).


near

near: number = 10;

Defined in: src/engine/render/components.ts:717

Distance where linear fog starts, in metres.


skyboxFog

skyboxFog: number = 1;

Defined in: src/engine/render/components.ts:725

How far the sky fades to the fog colour when affectsSkybox is on, 0 to 1.

Accessors

enabled

Get Signature

get enabled(): boolean;

Defined in: src/engine/core/Component.ts:57

Returns

boolean

Set Signature

set enabled(value): void;

Defined in: src/engine/core/Component.ts:61

Parameters
value

boolean

Returns

void

Inherited from

Component.enabled


gameObject

Get Signature

get gameObject(): GameObject;

Defined in: src/engine/core/Component.ts:37

Unity-style alias for node.

Returns

GameObject

Inherited from

Component.gameObject


isActiveAndEnabled

Get Signature

get isActiveAndEnabled(): boolean;

Defined in: src/engine/core/Component.ts:68

True when enabled, the node is active in the hierarchy, and the node is in a loaded world.

Returns

boolean

Inherited from

Component.isActiveAndEnabled


node

Get Signature

get node(): GameObject;

Defined in: src/engine/core/Component.ts:32

The node this component is on.

Returns

GameObject

Inherited from

Component.node


owner

Get Signature

get owner(): GameObject;

Defined in: src/engine/core/Component.ts:45

The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).

Returns

GameObject

Inherited from

Component.owner


time

Get Signature

get time(): Readonly<TimeState>;

Defined in: src/engine/core/Component.ts:93

This component's World's clock (ADR 0032): the same values as Time, but safe to read outside the World's frame too (after an await, say).

Returns

Readonly<TimeState>

Inherited from

Component.time


transform

Get Signature

get transform(): Transform;

Defined in: src/engine/core/Component.ts:51

The Transform of the node this component is on, if it has one.

Returns

Transform

Inherited from

Component.transform


world

Get Signature

get world(): WorldHandle;

Defined in: src/engine/core/Component.ts:82

A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json"). Throws for a World no Engine owns.

Returns

WorldHandle

Inherited from

Component.world

Methods

instantiate()

instantiate(prefabPath, options?): GameObject;

Defined in: src/engine/core/Component.ts:103

Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate. Use it in code that may run after an await: by then the frame is over and the current World is the Engine's default one, which may not be this component's. A parent from another World throws.

Parameters

prefabPath

string

options?

InstantiateOptions = {}

Returns

GameObject

Inherited from

Component.instantiate

Clone this wiki locally