Light sources locally simulate realistic lighting from objects such as lamps, torches, spotlights, and TV screens. By using the different types of light sources instead of just general global lighting through the Lighting service, you can create immersive environments such as cyberpunk cities, traditional light festivals, and moody detective scenes.
Light sources share various properties from the Light class, including Color, Brightness, and Shadows.
There are three types of light sources: point lights, spotlights, and surface lights.
A PointLight emits light spherically from a single point. This object is ideal for non-directional lights like bulbs, torches, and fireballs.
A point light's Range property defines the radial distance of illumination from the light's position, measured in studs.
A SpotLight emits light in the shape of a cone with a spherical base. This object is ideal for directional lights like street lamps, flashlights, and headlights.
The spotlight's Face property determines which face/axis light emits from, as shown from the following streetlamp's glowing light part:
A spotlight's Angle property defines the angle of light emission from the cone's apex. The maximum value is 180 which illuminates a full half sphere from the apex.
A SurfaceLight emits light from the face of a BasePart. This object is ideal for lighting from TV or computer screens, billboards, and fluorescent panels.
A surface light's Face property determines the face of the BasePart from which light emanates. Notice that light emits from the entire surface, not just a point on the surface.
A surface light's Angle property defines the angle of light emission from the part's surface. An angle of 0 means that light travels directly outward from the surface while an angle of 180 means light travels outward perpendicular to the surface.
A surface light's Range determines the distance of illumination from the surface. The maximum value is 60, measured in studs.
All light sources share various properties from the Light class, including color, brightness, and shadows.
The Color property sets the Color3 value of the emitted light.
The Brightness property sets the light's brightness with maximum effect at the center of the light. Note that Brightness is still limited to the light's defined range, so a higher Brightness value doesn't light up a larger region around the light.
The Shadows property projects shadows where light is blocked by an obstacle.
Creating a Light Source
After you decide which type of light source you need for your experience, you can create one and adjust its properties.
To create a light source on a given part:
- In the Explorer window, hover over the part and click the ⊕ button. A contextual menu displays.
- From the menu, insert a PointLight, SpotLight, or SurfaceLight.