Skip to content

Lighting

The sky, the sun, ambient light and fog.

  • Inherits: Service → Instance
  • Creatable: No. It’s created with the game; use Lighting (import { Lighting } from '@rally/sdk').
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

Type: Color3 · Default: Color3.fromHex('#8a93a6') · Access: read/write · Replicates: yes

Color of the soft light that reaches every surface, including surfaces in shadow.

Type: number · Default: 1.6 · Range: 0 to 10 (clamped) · Access: read/write · Replicates: yes

Sun strength.

Type: Vector3 · Default: new Vector3(-0.5, -1, -0.35) · Access: read/write · Replicates: yes

The direction sunlight travels; its length doesn’t matter. The default comes down from above at an angle. In 2D games the light comes from the front, tilted by this direction.

Type: Color3 · Default: Color3.fromHex('#bfdcff') · Access: read/write · Replicates: yes

The color of the sky behind everything.

Type: Color3 · Default: Color3.fromHex('#bfdcff') · Access: read/write · Replicates: yes

The color of the fog.

Type: number · Default: 0 · Range: 0 or more (clamped) · Access: read/write · Replicates: yes

Distance where fog is total (0 = no fog).

Fog starts at 30% of this distance.

Type: boolean · Default: true · Access: read/write · Replicates: yes

Whether the sun casts shadows (3D games only).

Inherited from Instance: name, archivable, id, className, parent, destroyed

Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString

Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged

import { Color3, Lighting, Vector3 } from '@rally/sdk';
Lighting.skyColor = Color3.fromHex('#0b1026');
Lighting.ambient = Color3.fromHex('#2a3350');
Lighting.brightness = 0.3;
Lighting.sunDirection = new Vector3(0.3, -1, 0.2);
Lighting.fogColor = Color3.fromHex('#0b1026');
Lighting.fogEnd = 250;