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.
Properties
Section titled “Properties”ambient
Section titled “ambient”Type: Color3 · Default: Color3.fromHex('#8a93a6') · Access: read/write · Replicates: yes
Color of the soft light that reaches every surface, including surfaces in shadow.
brightness
Section titled “brightness”Type: number · Default: 1.6 · Range: 0 to 10 (clamped) · Access: read/write · Replicates: yes
Sun strength.
sunDirection
Section titled “sunDirection”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.
skyColor
Section titled “skyColor”Type: Color3 · Default: Color3.fromHex('#bfdcff') · Access: read/write · Replicates: yes
The color of the sky behind everything.
fogColor
Section titled “fogColor”Type: Color3 · Default: Color3.fromHex('#bfdcff') · Access: read/write · Replicates: yes
The color of the fog.
fogEnd
Section titled “fogEnd”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.
shadows
Section titled “shadows”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
Methods
Section titled “Methods”Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString
Events
Section titled “Events”Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged
Examples
Section titled “Examples”Night time
Section titled “Night time”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;