Lighting

Lighting is the simulation of light in the graphics scene of a place, and is part of the rendering engine. The service provides the ability to manipulate lighting. Designing lighting is often important in development.
The main features of lighting are the environment, global lighting, dynamic lighting and post-processing effects. In the context of parts, materials sets how the parts' surfaces respond to light. Custom PBR textures from images are supported. There are also special effects related to parts such as s.
There are limitations of lighting such as the 60 studs limit on the dynamic light range and lack of screen space reflections and ray tracing support found in other contemporary engines like Unity.https://docs.unity3d.com/560/Documentation/Manual/PostProcessing-ScreenSpaceReflection.htmlhttps://unity.com/ray-tracing
== History ==
Lens flare was introduced as a built-in lighting effect which would be later removed in late 2007.
On January 28, 2011, Roblox introduced ambient shadows (screen space ambient occlusion) which is enabled at high graphics level setting and disabled at lower graphics levels.https://web.archive.org/web/20220616133237/https://blog.roblox.com/2011/01/let-your-dim-light-shine-ambient-shadows/
On January 20, 2012, a blog post was published that showcased prototype dynamic lighting for a Hack Week project.https://web.archive.org/web/20220113005005/https://blog.roblox.com/2012/01/tech-demo-dynamic-lighting-exploration/ On February 7, 2013, a blog post was published on prototype using voxels to generate lighting and shadows.https://web.archive.org/web/20220316190548/https://blog.roblox.com/2013/02/dynamic-lighting-and-shadows-the-voxel-solution/ On April 15, 2013, uploaded a video showcasing games making use of dynamic lighting on a testing site.http://www.youtube.com/watch?v=UGNF_LhXBko On May 9, 2013, dynamic lighting would be released with voxel-based lighting and shadows as well as new light sources,https://web.archive.org/web/20220814085908/https://blog.roblox.com/2013/05/lights-on-dynamic-lighting-and-shadows-are-here/ which would also receive shadows on September 30, 2013.https://web.archive.org/web/20220517200750/https://blog.roblox.com/2013/09/dynamic-lights-now-support-shadows/ On May 29, 2014, stencil shadows would be replaced by a blob system that would be fused with voxel-based shadows.https://web.archive.org/web/20220817171700/https://blog.roblox.com/2014/05/character-shadows-get-the-dynamic-lighting-treatment/
On April 4, 2013, bevels were removed for performance reasons. Furthermore, a blog post was published stating that "they hurt performance and don't fit our vision for the future look of ROBLOX".
On June 6, 2014, Roblox introduced dynamic reflections which allows reflective objects and water to reflect the sky dynamically through the use of cube mapping. Previously, reflections would only reflect the sky itself without any changes such as the time of day.https://web.archive.org/web/20220603220904/https://blog.roblox.com/2014/06/environment-maps-bring-dynamic-reflections-to-roblox/
In April 2015, Roblox introduced particle emitters.https://web.archive.org/web/20220112015521/https://blog.roblox.com/2015/04/explore-the-endless-possibilities-of-custom-particles/
On December 21, 2015, uploaded a video showcasing a new lighting system with features such as HDR rendering and smaller voxels.https://www.youtube.com/watch?v=z5TmqDtpwSM On December 19, 2016, as a project of Hack Week 2016, zeuxcg uploaded another video showcasing the lighting system with voxels replaced by shadow mapping and would be known as Future Is Bright.https://www.youtube.com/watch?v=lrvOGqC9ZjQhttps://web.archive.org/web/20220612061852/https://blog.roblox.com/2017/01/hack-week-2016-imagining-future-roblox/ In 2017, an article was published covering comparisons between voxels and shadow mapping in aspects of lighting, both quality and performance, with a conclusion hinting that a hybrid of both would be used.https://roblox.github.io/future-is-bright/compare On October 3, 2018, the new lighting system would be introduced as a beta feature. The lighting system would enabled through the Technology mode ("Voxel") while the old system would have its own Technology mode ("Legacy").https://devforum.roblox.com/t/future-is-bright-phase-1-studio-beta/182687 The new lighting system would be released on December 3 as the first phase of Future Is Bright.https://devforum.roblox.com/t/future-is-bright-phase-1-released/207935 On January 28, 2019, the Compatibility mode would also be introduced which would use the same system as Voxel but it would approximately recreate the Legacy mode.https://devforum.roblox.com/t/deprecating-lightinglegacy-introducing-lightingcompatibility/232667 On July 17, 2019, the Legacy mode would be deprecated and the old lighting system would be disabled in favor of the new lighting system for performance and maintenance reasons.https://devforum.roblox.com/t/compatibility-replacing-legacy-on-17th-of-june-2019/269872/70 On April 18, 2019, phase 2 of Future Is Bright was announced as a Roblox Studio beta featurehttps://devforum.roblox.com/t/future-is-bright-phase-2-studio-beta/269370, introducing shadow mapping to directional light as "ShadowMap" mode and two properties for controlling its shadows: Lighting.ShadowSoftness and BasePart.CastShadow, which would be released on May 10, 2019.https://devforum.roblox.com/t/future-is-bright-phase-2-released/278531 On January 10, 2020, phase 2.5 was released which implemented the PBR model and switched to a new specular BRDF. Two new properties were added to Lighting: EnvironmentDiffuseScale for diffuse light and EnvironmentSpecularScale for specular light.https://devforum.roblox.com/t/future-is-bright-phase-25-released/429543 On June 23, 2020, phase 3 was announced as a beta featurehttps://devforum.roblox.com/t/future-is-bright-phase-3-studio-beta/639903, introducing the Future Technology mode which adds shadow mapping and specular highlights to local lights, which would be released on November 19, 2020.https://devforum.roblox.com/t/future-is-bright-phase-3-released/878634
On January 21, 2016, a Hack Week blog post was published featuring a prototype service known as EffectsManager, which could allow developers to add custom pixel shaders through a special type of local scripts containing HLSL code, which would be parented to the service.https://web.archive.org/web/20211015170000/http://blog.roblox.com/2016/01/hack-week-2015-shaders/ Although the feature had not been introduced, in May 2016, Roblox introduced post-processing effects, some of which would use the effects similarly found in the hack week, and a form of anti-aliasing known as MSAA.https://www.youtube.com/watch?v=Xoj5KI4Sbr4https://web.archive.org/web/20220221011922/https://blog.roblox.com/2016/05/a-whole-new-world-roblox-adds-post-effects-and-anti-aliasing/
On April 22, 2020, was introduced.https://devforum.roblox.com/t/release-notes-for-429/537322/2
On November 13, 2020, a DevForum post announced a series of updates around clouds known as Dynamic Skies with three main phases. Phase 1 introduces while Phases 2 and 3 will introduce more controls and allow flying through and above clouds.https://devforum.roblox.com/t/dynamic-skies-are-getting-cloudy/869476
In January 2021, ambient shadows were switched to Horizon-Based Ambient Occlusion.https://devforum.roblox.com/t/horizon-based-ambient-occasion-hbao-issues/972390
On March 17, 2021, environment probe known as EnvMap was introduced as a beta feature which simulates indirect lighting, improving indoor lighting.https://devforum.roblox.com/t/indoor-dynamic-environment-maps-beta/1115802 EnvMap would be released on July 21, 2021.https://devforum.roblox.com/t/better-indoor-reflections-live-for-future-lighting/1365721
On the week of Oct. 21st, 2024, Compatibility lighting was removed from Roblox Studio & games using it would be converted to Voxel.
== Environment ==
The environment of lighting has three main features: the sky, atmosphere and clouds. The environment also affects diffuse and specular light. Most aspects of the environment is affected by the time of day which can be controlled through 's TimeOfDay (string) or ClockTime (number) property.
=== Sky ===
The sky has two features: the sky itself and the celestial bodies including the sun, the moon and the stars. is used to replace the sky's appearance with other images, and is also used to change the appearance of celestial bodies as well as disable them. The 's effect is affected by the sky. Clouds provide an alternative option to using sky images with clouds. Sky is affected by the time of day, turning dark at night and turning bright at day.
=== Atmosphere ===
There are two ways to create lighting atmosphere including fog:
* has two properties: FogEnd and FogStart, both of which change the range of the fog and is the most basic way to create fog.
* provides more advanced fog than the basic fog. Atmosphere must be parented to Lighting and there must be at least one in Lighting in order to for Atmosphere to affect the lighting. Atmosphere reflects the sky and simulates fog better than the basic fog.
=== Clouds ===
:
 adds clouds to lighting when parented to . The clouds appearance can be changed by the Clouds properties. Clouds affect the brightness of the directional source.
== Light ==
Light can be separated into two categories: global lighting which pertains to the environment and dynamic lighting which pertains to parts. Roblox also features HDR rendering. The ExposureCompensation property of controls how much light is rendered. In order to save performance, local lighting and shadows are only rendered within a certain range.
=== Global lighting ===
Global lighting covers light in a global scale i.e. not casted from objects. There are three main sources of global lighting: directional, ambient and environmental light. Many properties of global lighting can be changed through .
==== Directional ====
Apart from the sky, both the sun and the moon cast a directional source. There is only one source and it is shared by both. Lighting can be used to change the time of day and latitude, both of which will change the direction of the source, the brightness of the source and the color of top and bottom surface lighting.
==== Ambient ====
There are two types of ambient light: ambient light itself and outdoor ambient light. Ambient light illuminates all of the objects uniformly. The Ambient property of Lighting can be used to change the color of light with the value component being the brightness of the light. Outdoor ambient light illuminates outdoor surfaces but also casts shadows indoors, which is enabled through the GlobalShadows property. The OutdoorAmbient property also changes the color of outdoor light. Environmental light may be used instead of outdoor ambient light as well as ambient light itself for more realistic approach to lighting.
==== Environmental ====
Environmental light is made up of diffuse light and specular light, and is derived from the environment, providing approximate global illumination. The EnvironmentDiffuseScale property and the EnvironmentSpecularScale property of Lighting can be used to change both of light, respectively. Diffuse light is casted from the environment while specular light affects reflection of materials on the environment. Specular light can be thought of as enabling reflections.
Indoor environmental light technically comes from an image automatically generated by an environment probe (or a cube map) known as EnvMap. Specular light are most visible indoors and often resembles reflections. Because of how environment probes behave, specular light are not suitable for mirror-like objects. There can be one or two probes at a time. The engine automatically chooses where to place the probe, preferably in the center of a "room". For moving between rooms, two are used to blend between the old probe and the new probe.https://devforum.roblox.com/t/indoor-dynamic-environment-maps-beta/1115802
=== Dynamic lighting ===
:
Dynamic lighting is a feature where any light including directional light can cast shadows. Dynamic lighting also introduces local sources of light parented to a part or an which can be created through the three light classes:
* represents a point source that emits light in all directions. An example of this light is a light bulb.
* represents a point source that emits light in a directed cone. An example of this light is a flashlight.
* represents a surface source that emits light. An example of this light is a screen.
The 's GlobalShadows property can enable and disable shadows from directional and diffuse light. Local lights also have the Shadows property that can be used to toggle shadows being casted. Parts also have the CastShadow property which can be used to enable and disable shadows of an individual part, often used to improve performance such as turning off shadows for grass meshes.
=== Technology ===
The engine uses different types of light technology which can be changed through the Technology property of Lighting, although the property is only temporarily used for transitioning places to newer technology as a process of the Future Is Bright development update.
==== Voxel ====
The engine uses voxels to simulate shadows casted by diffuse and outdoor ambient light, with each voxel measuring 4 studs (in a square), similar to that of Terrain. In Technology modes except for Future, voxel simulates shadows (except for character shadows which uses different technology, which is mostly shadow mapping).
==== ShadowMap ====
The engine uses shadow mapping to render sun shadows casted by the directional source in ShadowMap mode. However, the light and shadows from any light sources remains voxelised. On shadowed out areas, objects use voxelised shadows to render realistic shadings on walls and/or floors. Shadow mapping is visible in certain conditions according to the graphics level setting. In low graphics levels, shadow mapping is replaced with voxels.
==== Future ====
The engine gains shadow mapping on any light sources, making lights feel smoother and realistic. Object also gain environment mapping, also known as reflection mapping, which allows them to be able to reflect any light sources. Shadow mapping is visible in certain conditions according to the graphics level setting. In low graphics levels, shadow mapping is replaced with voxels.
==== Comparisons between modes ====
Technology	Directional 	Dynamic lighting	Enviornment Mapping
Future 	Shadow mapping*	Shadow mapping* 	
ShadowMap 	Shadow mapping*	Voxel 	
Voxel 	Voxel 	Voxel 	
* = will fall back to voxels if the range is far enough according to the client's graphics level setting.
==== Gallery ====
<tabber>
|-|Voxel=
VoxelLightingOutdoor.png|Voxel lighting in an outdoor place.
VoxelCharacterShadows.png|The sharper character shadows.
VoxelLightingIndoor.png|Voxel lighting in an indoor place.
VoxelLightingNoReflection.png|An object unable to reflect light.
VoxelLightCircle.png|The light circle.
|-|ShadowMap=
ShadowMapLightingOutdoor.png|ShadowMap lighting in an outdoor place.
ShadowMapLightingIndoor.png|The minor indoor lighting fixes in ShadowMap lighting.
VoxelShadingonShadowedAreas.png|The use of Voxel shadows on shadowed out areas.
|-|Future=
FutureLightingOutdoor.png|The slight outdoor lighting changes in Future lighting.
FutureLightingIndoor.png|Future lighting in an indoor place.
FutureLightingLightReflection.png|An object reflecting light.
FutureLightCircle.png|The light circle.
</tabber>
Removed lighting modes:
OutdoorLightingDemo Compatibility.png|Compatability (outdoor)
IndoorLightingDemo Compatibility.png|Compatability (indoor)
== Post-processing effects ==
Roblox features some post-processing effects:
* applies depth of field effect.
* applies the bloom effect.
* applies Gaussian blur.
* controls the appearance of the scene.
* applies a halo of light from the sun.
== Parts ==
=== Materials ===
:
The Material property affects the appearance of parts. Custom PBR textures from images are supported through and instances.
=== Special effects ===
Roblox features a set of special effects:
* emits particles of 2D images.
* Unlike ParticleEmitter, uses s to create a beam between both of the attachments.
* uses s to emit a trail from a line formed by both of the attachments.
== Limitations ==
Unlike other engines such as Unity, lighting in Roblox has some limitations and the lack of features:
* There is a limit of 60 studs for local lights.
** There is a feature request about this limitation in which a Roblox staff member replied that there are technical challenges on high range lights.https://devforum.roblox.com/t/increase-range-limit-of-lights/68336/112
* There is no ability to add directional lights.https://devforum.roblox.com/t/directionallight/22669
* There is no ability to change the appearance of the sky other than changing the images, e.g. for smooth transition.https://devforum.roblox.com/t/add-the-ability-to-modify-the-skybox-color-and-brightness/394566
* Roblox does not support screen space reflections other than the Water material.
** A Roblox staff post states that SSR can only run smoothly on high end devices.https://devforum.roblox.com/t/better-indoor-reflections-live-for-future-lighting/1365721
* Roblox does not have real-time ray tracing support which is available in other games like Battlefield V.
== Trivia ==
* Oddly, s, s, and parts (if they're in a model that has Humanoid on it) do not cast voxelised shadows. It's unknown if this is intentional, or for performance purposes.
== References ==
== External links ==
*Lighting and Effects on the Roblox Creator Documentation
Category:Experience features
Category:Game development