Skip to Content
Kinemium
Services

Lighting

Control the time of day, ambient light, shadows, and default visual effects.

Lighting controls how the world is lit: the sun's position, ambient colors, shadow quality, and exposure. It also creates the default post-processing effects as its children.

Getting started

local Lighting = game:GetService("Lighting")

Lighting.ClockTime = 18
Lighting.Brightness = 2.5
Lighting.Ambient = Color3.fromRGB(40, 45, 60)

ClockTime takes a decimal hour, so 18 is 6 PM. Values wrap around a 24-hour day, so 25 is 1 AM the next day.

Properties

PropertyTypeAccessDefaultDescription
ClockTimenumberRead/write10.5Time of day in hours. Wrapped into the 0-24 range.
TimeOfDaystringRead/write"10:30:00" equivalentThe same time as an HH:MM:SS string.
BrightnessnumberRead/write2Overall light intensity. Negative values clamp to 0.
AmbientColor3Read/writeWhiteLight applied to all faces.
OutdoorAmbientColor3Read/writeWhiteAmbient light outside shadowed areas.
SunColorColor3Read/writeColor3.new(1, 0.98, 0.95)Color of the sun's light.
GlobalShadowsbooleanRead/writetrueWhether shadows are rendered.
ShadowSoftnessnumberRead/write0Shadow blur, clamped between 0 and 1.
ExposureCompensationnumberRead/write0Exposure adjustment applied to the final image.
DynamicResolutionbooleanRead/writetrueWhether render resolution can drop under load.
ResolutionScalenumberRead/write0.5Minimum resolution scale, clamped between 0.1 and 1.
ShadowCascadesnumberRead/write2Number of shadow cascades, clamped between 1 and 4.
ShadowMapSizenumberRead/write2048Shadow map resolution, clamped between 256 and 8192.

ShadowCascades and ShadowMapSize are stored as integers, so fractional values are truncated. Raising ShadowMapSize sharpens shadows at the cost of memory and fill rate.

TimeOfDay

TimeOfDay accepts exactly the format HH:MM:SS, with a 24-hour clock. Anything else raises an error:

Lighting.TimeOfDay = "06:30:00"

Reading TimeOfDay formats the current ClockTime back into a string, so it reflects the wrapped value rather than the value you last assigned.

Methods

GetSunDirection

GetSunDirection(): Vector3

Returns the direction the sun's light travels, derived from ClockTime. The vector stays in sync with the time, so it's useful for aligning lens flares or custom sky elements.

local sunDirection = Lighting:GetSunDirection()

Default effects

When Lighting is created, it adds effect objects as children, including Clouds, Atmosphere, BloomEffect, ColorCorrectionEffect, SunRaysEffect, SSAOEffect, ScreenSpaceReflectionsEffect, and ReflectionProbeEffect. Several more exist but start disabled.

local bloom = Lighting:FindFirstChild("BloomEffect")
if bloom then
    bloom.Enabled = false
end

Access them by name with FindFirstChild() rather than assuming they're present, since a game can remove or replace them. Each effect has its own properties; the effects share a common Enabled switch.

Effects are created with replication disabled and are not sent to clients by default.

Notes

  • ClockTime wraps instead of clamping, so animating it continuously is safe.
  • Ambient and OutdoorAmbient are separate controls. Setting one doesn't change the other.

See also

  • PostProcess, the shared base for post-processing effects.
  • Workspace, the world being lit.

On this page