rojo/.cursor/rules/roblox/reference/engine/classes/Lighting.yaml
2026-02-02 12:08:47 -06:00

838 lines
28 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Lighting
type: class
memory_category: Instances
summary: |
The `Lighting` service controls global lighting in an experience. It includes
a range of adjustable properties that you can use to change how lighting
appears and interacts with other objects.
description: |
The `Lighting` service controls global lighting in an experience. It includes
a range of adjustable properties that you can use to change how lighting
appears and interacts with other objects, as summarized in
[Lighting Properties](../../../environment/lighting.md).
<img src="../../../assets/lighting-and-effects/lighting-properties/TimeOfDay-17.jpg" width="800" />
`Lighting` may also contain an `Class.Atmosphere` object to render realistic
atmospheric effects, including particle density, haze, glare, and color. See
[Atmospheric Effects](../../../environment/atmosphere.md) for details.
<img src="../../../assets/lighting-and-effects/atmosphere/Offset-A.jpg" width="800" />
In addition, `Lighting` (along with `Class.Workspace.CurrentCamera`) may
contain
[post‑processing effects](../../../environment/post-processing-effects.md)
such as `Class.SunRaysEffect` and `Class.BlurEffect`.
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
deprecation_message: ''
properties:
- name: Lighting.Ambient
summary: |
The lighting hue applied to areas that are occluded from the sky, such as
indoor areas.
description: |
`Ambient` is the lighting hue applied to areas that are occluded from the
sky, such as indoor areas.
`Ambient` defaults to `[0, 0, 0]` (black). As long as the red, green, and
blue channels of this property do not exceed the corresponding channels in
`Class.Lighting.OutdoorAmbient|OutdoorAmbient`, the change in hue will be
reserved for areas occluded from the sun/moon.
Note that when `Class.Lighting.GlobalShadows|GlobalShadows` is disabled,
there is no distinction between areas occluded from the sky and
non‑occluded areas. In this case,
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` will be ignored and the hue
from the `Ambient` property will be applied everywhere.
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.Brightness
summary: |
The intensity of illumination in the place.
description: |
The intensity of illumination in the place.
Changing this value will influence the impact of the light source (sun or
moon) on the place's lighting. Note that `Class.Lighting.Ambient|Ambient`
and `Class.Lighting.OutdoorAmbient|OutdoorAmbient` can also be used to
influence how bright a place appears. For example, setting
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` to <Typography
noWrap>`[255, 255, 255]`</Typography> will make the place appear brighter
than its default value of <Typography noWrap>`127, 127, 127`</Typography>
(as it is more white).
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.ClockTime
summary: |
A numerical representation (in hours) of the current time of day used by
`Lighting`.
description: |
A numerical representation (in hours) of the current time of day used by
`Lighting`. Note that this property does not correspond with the actual
time of day and will not change during gameplay unless it has been changed
by a script.
For a measure of `Lighting` time formatted as a 24-hour string, use
`Class.Lighting.TimeOfDay|TimeOfDay`. Changing
`Class.Lighting.TimeOfDay|TimeOfDay` or using
`Class.Lighting:SetMinutesAfterMidnight()|SetMinutesAfterMidnight()` will
also change this property.
code_samples: []
type: float
tags:
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- Environment
- name: Lighting.ColorShift_Bottom
summary: |
The hue represented in light reflected in the opposite surfaces to those
facing the sun or moon.
description: |
The hue represented in light reflected in the opposite surfaces to those
facing the sun or moon.
The surfaces of a `Class.BasePart` influenced by `ColorShift_Bottom`
depends on the position and orientation of the `Class.BasePart` relative
to the sun or moon's position. Where the sun is directly overhead a
`Class.BasePart`, the shift in color will only apply to the bottom
surface.
This effect can be increased or reduced by altering
`Class.Lighting.Brightness|Brightness`.
Note that `Class.Lighting.ColorShift_Top|ColorShift_Top` and
`ColorShift_Bottom` will interact with the
`Class.Lighting.Ambient|Ambient` and
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` properties if they are
greater than <Typography noWrap>`[0, 0, 0]`</Typography>. Also note that
the influence of `ColorShift_Bottom` can be very hard to identify when
`Class.Lighting.GlobalShadows|GlobalShadows` is enabled (default).
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.ColorShift_Top
summary: |
The hue represented in light reflected from surfaces facing the sun or
moon.
description: |
The hue represented in light reflected from surfaces facing the sun or
moon.
The surfaces of a `Class.BasePart` influenced by `ColorShift_Top` depends
on the position and orientation of the `Class.BasePart` relative to the
sun or moon's position. Where the sun is directly overhead a
`Class.BasePart`, the shift in color will only apply to the top surface.
This effect can be increased or reduced by altering
`Class.Lighting.Brightness|Brightness`.
Note that `ColorShift_Top` and
`Class.Lighting.ColorShift_Bottom|ColorShift_Bottom` will interact with
the `Class.Lighting.Ambient|Ambient` and
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` properties if they are
greater than <Typography noWrap>`[0, 0, 0]`</Typography>.
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.EnvironmentDiffuseScale
summary: |
Ambient light that is derived from the environment.
description: |
Ambient light that is derived from the environment with a default of `0`.
This property is similar to `Class.Lighting.Ambient|Ambient` and
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` but it's dynamic and can
change according to the sky and time of day. When this property is
increased, it's recommended to decrease `Class.Lighting.Ambient|Ambient`
and `Class.Lighting.OutdoorAmbient|OutdoorAmbient` accordingly.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.EnvironmentSpecularScale
summary: |
Specular light derived from environment.
description: |
Specular light derived from environment with a default of `0`. This
property will make smooth objects reflect the environment and it is
especially important to make metal look more realistic.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.ExposureCompensation
summary: |
The exposure compensation value.
description: |
This property determines the exposure compensation amount which applies a
bias to the exposure level of the scene prior to the tonemap step.
Defaults to `0` (no exposure compensation) and has a range from `-5` to
`5`. A value of `1` indicates twice as much exposure and `-1` means half
as much exposure.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Exposure
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.ExtendLightRangeTo120
summary: ''
description: ''
code_samples: []
type: RolloutState
tags:
- NotScriptable
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.FogColor
summary: |
A `Datatype.Color3` value giving the hue of `Lighting` fog.
description: |
A `Datatype.Color3` value giving the hue of `Lighting` fog. Note that fog
properties are hidden when `Lighting` contains an `Class.Atmosphere`
object.
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Fog
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.FogEnd
summary: |
The depth from the `Class.Workspace.CurrentCamera`, in studs, at which fog
will be completely opaque.
description: |
The depth from the `Class.Workspace.CurrentCamera`, in studs, at which fog
will be completely opaque. Note that fog properties are hidden when
`Lighting` contains an `Class.Atmosphere` object.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Fog
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.FogStart
summary: |
The depth from the `Class.Workspace.CurrentCamera`, in studs, at which fog
begins to show.
description: |
The depth from the `Class.Workspace.CurrentCamera`, in studs, at which fog
begins to show. Note that fog properties are hidden when `Lighting`
contains an `Class.Atmosphere` object.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Fog
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.GeographicLatitude
summary: |
The geographic latitude, in degrees, of the scene, influencing the result
of `Lighting` time on the position of the sun and moon.
description: |
The geographic latitude, in degrees, of the scene, influencing the result
of `Lighting` time on the position of the sun and moon. When calculating
the position of the sun, the earth's tilt is also taken into account.
Changing `GeographicLatitude` will alter the position of the sun at every
`Class.Lighting.TimeOfDay|TimeOfDay`. If you're looking to obtain the sun
or moon's position, use
`Class.Lighting:GetSunDirection()|GetSunDirection()` or
`Class.Lighting:GetMoonDirection()|GetMoonDirection()`.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.GlobalShadows
summary: |
Toggles voxel-based dynamic lighting for the place.
description: |
Toggles voxel-based dynamic lighting in the place. When set to `true`,
shadows are rendered in sheltered areas depending on the position of the
sun and moon. The lighting hue applied to these sheltered areas is
determined by the `Class.Lighting.Ambient|Ambient` property while the
lighting hue in all other areas is determined by the
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` property.
When `false`, shadows are not drawn and no distinction is made between
indoor and outdoor areas. As a result, the
`Class.Lighting.Ambient|Ambient` property determines the lighting hue and
`Class.Lighting.OutdoorAmbient|OutdoorAmbient` will do nothing.
Shadows are calculated using a voxel system and each lighting voxel is
4&times;4&times;4 studs. This means objects need to be larger than
4&times;4&times;4 studs to display a realistic shadow. Shadows are also
recalculated when `Class.BasePart|BaseParts` are moving.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.LightingStyle
summary: |
The artistic intent behind lighting in the experience.
description: |
`LightingStyle` indicates the artistic intent behind lighting in the
experience, as an `Enum.LightingStyle` option.
code_samples: []
type: LightingStyle
tags: []
deprecation_message: ''
security:
read: None
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.OutdoorAmbient
summary: |
The lighting hue applied to outdoor areas.
description: |
`OutdoorAmbient` is the lighting hue applied to outdoor areas.
`OutdoorAmbient` defaults to `[127, 127, 127]`. As long as the red, green,
and blue channels of `Class.Lighting.Ambient|Ambient` do not exceed the
corresponding channels in `OutdoorAmbient`, the hue of the lighting in
outdoor areas will be determined by this property.
The effective `OutdoorAmbient` value is clamped to be greater than or
equal to `Class.Lighting.Ambient|Ambient` in all channels, meaning that if
a channel of `Class.Lighting.Ambient|Ambient` exceeds its corresponding
`OutdoorAmbient` channel, the hue of `Class.Lighting.Ambient|Ambient` will
begin to apply to outdoor areas.
Note that when `Class.Lighting.GlobalShadows|GlobalShadows` is disabled,
there is no distinction between areas occluded from the sky and
non‑occluded areas. In this case, `OutdoorAmbient` will be ignored and the
hue from the `Class.Lighting.Ambient|Ambient` property will be applied
everywhere.
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.Outlines
summary: |
Determines whether outlines are enabled or disabled in a place.
description: |
This property determines whether outlines are enabled or disabled in a
place.
Outlines can be disabled on a global basis, using this `Lighting`
property, or alternatively on a surface-by-surface basis for
`Class.BasePart|BaseParts` using `Enum.SurfaceType`.
Although this property can be set by scripts, it recommended this property
is set in Roblox Studio prior to publishing the place.
code_samples: []
type: boolean
tags:
- Deprecated
deprecation_message: |
This item is no longer supported as the outlines feature was removed from
the Roblox platform.
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.PrioritizeLightingQuality
summary: |
Indicates whether you prefer lighting/shading quality or view distance to
scale down first.
description: |
This property indicates whether you prefer lighting/shading quality or
view distance to scale down first. As the rendering quality level reduces,
a setting of `true` prioritizes features such as advanced shadows and
high‑quality shaders at closer distances, while a setting of `false`
prioritizes view distance.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.ShadowColor
summary: |
This is supposed to change the color of player shadows, but currently
doesn't do anything.
description: |
This is supposed to change the color of player shadows, but currently
doesn't do anything.
code_samples: []
type: Color3
tags:
- NotReplicated
- Deprecated
deprecation_message: |
This item is deprecated and has no current functionality. Do not use it
for new work.
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: false
capabilities:
- Environment
- name: Lighting.ShadowSoftness
summary: |
Controls how blurry the shadows are.
description: |
Controls how blurry the shadows are with a default of `0.2`. This property
only works when `Class.Lighting.Technology|Technology` mode is
`Enum.Technology|ShadowMap` or `Enum.Technology|Future` and the device is
capable of rendering shadow maps.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.Technology
summary: |
Determines the lighting system for rendering the 3D world. Non-scriptable.
description: |
Determines the lighting system for rendering the 3D world. This property
is non‑scriptable and only modifiable in Studio.
code_samples: []
type: Technology
tags: []
deprecation_message: |
This property has been superseded by
`Class.Lighting.LightingStyle|LightingStyle` which determines the artistic
intent behind lighting, and
`Class.Lighting.PrioritizeLightingQuality|PrioritizeLightingQuality` which
indicates whether you prefer lighting/shading quality or view distance to
scale down first.
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- Environment
- name: Lighting.TimeOfDay
summary: |
A 24-hour string representation of the current time of day used by
`Lighting`.
description: |
A 24-hour string representation of the current time of day used by
`Lighting`. Note that this property does not correspond with the actual
time of day and will not change during gameplay unless it has been changed
by a script.
For a numeric measure of `Lighting` time, use
`Class.Lighting.ClockTime|ClockTime`. Changing
`Class.Lighting.ClockTime|ClockTime` or using
`Class.Lighting:SetMinutesAfterMidnight()|SetMinutesAfterMidnight()` will
also change this property.
code_samples: []
type: string
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- Environment
methods:
- name: Lighting:GetMinutesAfterMidnight
summary: |
Returns the number of minutes that have passed after midnight for the
purposes of lighting.
description: |
Returns the number of minutes that have passed after midnight for the
purposes of lighting. This number will be nearly identical to
`Class.Lighting.ClockTime|ClockTime` multiplied by `60`.
Note that this number will not always be equal to the value given in
`Class.Lighting:SetMinutesAfterMidnight()|SetMinutesAfterMidnight()` as it
returns minutes after midnight in the current day.
code_samples: []
parameters: []
returns:
- type: double
summary: |
The number of minutes after midnight.
tags: []
deprecation_message: ''
security: None
thread_safety: Safe
capabilities:
- Environment
- name: Lighting:getMinutesAfterMidnight
summary: ''
description: ''
code_samples: []
parameters: []
returns:
- type: double
summary: ''
tags:
- Deprecated
deprecation_message: |
This method is a deprecated variant of
`Class.Lighting:GetMinutesAfterMidnight()` which should be used instead.
security: None
thread_safety: Unsafe
capabilities:
- Environment
- name: Lighting:GetMoonDirection
summary: |
Returns a `Datatype.Vector3` representing the direction of the moon.
description: |
Returns a `Datatype.Vector3` representing the direction of the moon from
the position <Typography noWrap>`(0, 0, 0)`</Typography>. Note that when
the moon has "set" and is no longer visible, the `Datatype.Vector3`
returned by this method will continue to point towards the moon below the
horizon.
`Class.Lighting:GetSunDirection()|GetSunDirection()` is a variant of this
method for obtaining the direction of the sun.
code_samples: []
parameters: []
returns:
- type: Vector3
summary: |
`Datatype.Vector3` representing the direction of the moon.
tags: []
deprecation_message: ''
security: None
thread_safety: Safe
capabilities:
- Environment
- name: Lighting:GetMoonPhase
summary: |
Returns the moon's current phase.
description: |
Returns the moon's current phase. There is no way to change the moon's
phase so this will always return `0.75`.
code_samples: []
parameters: []
returns:
- type: float
summary: ''
tags: []
deprecation_message: |
There is currently no way to change the moon's phase, and thus this method
should not be used.
security: None
thread_safety: Unsafe
capabilities:
- Environment
- name: Lighting:GetSunDirection
summary: |
Returns a `Datatype.Vector3` representing the direction of the sun.
description: |
Returns a `Datatype.Vector3` representing the direction of the sun from
the position <Typography noWrap>`(0, 0, 0)`</Typography>. Note that when
the sun has "set" and is no longer visible, the `Datatype.Vector3`
returned by this method will continue to point towards the sun below the
horizon.
`Class.Lighting:GetMoonDirection()|GetMoonDirection()` is a variant of
this method for obtaining the direction of the moon.
code_samples: []
parameters: []
returns:
- type: Vector3
summary: |
`Datatype.Vector3` representing the direction of the sun.
tags: []
deprecation_message: ''
security: None
thread_safety: Safe
capabilities:
- Environment
- name: Lighting:SetMinutesAfterMidnight
summary: |
Sets `Class.Lighting.TimeOfDay|TimeOfDay` and
`Class.Lighting.ClockTime|ClockTime` to the given number of minutes after
midnight.
description: |
Sets `Class.Lighting.TimeOfDay|TimeOfDay` and
`Class.Lighting.ClockTime|ClockTime` to the given number of minutes after
midnight.
This method allows a numerical value to be used, for example in a
day/night cycle `Class.Script`, without the need to convert to a string in
the format required by `Class.Lighting.TimeOfDay|TimeOfDay`. It also
allows values greater than 24 hours to be given that correspond to times
in the next day.
The following code sample includes a simple day/night cycle script. The
speed of time and the initial time can be changed using the `TIME_SPEED`
and `START_TIME` parameters.
```lua
local Lighting = game:GetService("Lighting")
local TIME_SPEED = 60 -- 1 min = 1 hour
local START_TIME = 9 -- 9 AM
local minutesAfterMidnight = START_TIME * 60
local waitTime = 60 / TIME_SPEED
while true do
minutesAfterMidnight = minutesAfterMidnight + 1
Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
task.wait(waitTime)
end
```
code_samples: []
parameters:
- name: minutes
type: double
default:
summary: |
The number of minutes after midnight.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Environment
- name: Lighting:setMinutesAfterMidnight
summary: ''
description: ''
code_samples: []
parameters:
- name: minutes
type: double
default:
summary: ''
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: |
This method is a deprecated variant of
`Class.Lighting:SetMinutesAfterMidnight()` which should be used instead.
security: None
thread_safety: Unsafe
capabilities:
- Environment
events:
- name: Lighting.LightingChanged
summary: |
This event fires when a `Lighting` property is changed or a `Class.Sky` is
added or removed from `Lighting`.
description: |
This event fires when a `Lighting` property is changed or a `Class.Sky` is
added or removed from `Lighting`, with some exceptions:
- Changing `Class.Lighting.GlobalShadows|GlobalShadows` will not fire this
event.
- Changing fog properties `Class.Lighting.FogColor|FogColor`,
`Class.Lighting.FogStart|FogStart`, or `Class.Lighting.FogEnd|FogEnd`
will not fire this event.
In cases where this behavior is not desired, the `Class.Object.Changed`
event or `Class.Object:GetPropertyChangedSignal()` method can be used.
code_samples: []
parameters:
- name: skyChanged
type: boolean
default:
summary: ''
tags: []
deprecation_message: ''
security: None
capabilities:
- Environment
callbacks: []