Skip to main content

Scene Lights

Last Updated Time: 12/26/2023

Overview

The light of the light source has an effect on objects, and lighting in the Engine is used to simulate how light travels and interacts in the real world. The Engine uses detailed models to analyze the mechanics of how lights work to achieve more realistic effects, or uses simplified models to achieve more stylized effects.

Creating Scene Lights

In the Component Editor, click Create Game Object -> Light Source Object to create a Light Source Object.

image-20231212173933888

Scene Light Settings

Select the created Light Source Object (LLightSource) in the Hierarchy panel, then select LightSourceComponent0(Inherited) in the Inspector panel, and the light related settings can be made in the VisBase category below.

image-20231130175656219

Scene Light Types

The Engine provides different types of lights, which can be selected according to the needs of different scenes.

The Point light, Spot light, Box light and Area light can be selected in the Light Type property of the Light Source Object.

image-20231130175532597

Point

The Point light can be seen as a point, from which light radiates out in space and emits evenly in all directions. The Point light is usually used to simulate the light of a bulb.

image-20230712133121242

Note

You can add Terrain Objects, Direct Lights, and model objects to the scene first in order to see the effect of the scene light.

image-20230921134506781

Spot

The Spot light is a directional light that emits light from a single point of a cone to simulate the effect of a focused beam of light. The Spot light is generally used to simulate lights of flashlights, stage lights, etc.

image-20230712133617891

Box

The Box light can be seen as a box that emits light from inside. The Box light is generally used to simulate lights of indoor scenes such as lamps, windows, etc.

image-20230712142851986

Area

The Area light can be seen as a light with a planar shape and a surface that emits light. The Area light is generally used to simulate large-area lights, such as floors, walls, etc.

image-20230712141349209

Scene Light Properties

Basic Properties of Lights

The following are the basic properties of scene lights.

image-20231130175737638

PropertyDescription
ColorThe color that the light emits.
IntensityThe total energy that the light emits.
Specular IntensityAdjust the intensity of the specular light.
Flash IntensityFlashing brightness offset factor (multiply with Intensity).
Flash SpeedFade in and fade out time when flashing.
Flash Peak PeriodThe sum of the time to keep the brightest state and the time to keep the darkest state when flashing.
Enable Lens FlareEnable the lens effect. When enabled, it will simulate the glass blur effect when the lens is looking towards the light.
Lens Flare ConfigLens effect Configuration file.
Lens Flare DistanceLens effect attenuation distance.

Effects of Basic Properties

Color

image-20230927152650933

Intensity

image-20230921165459772

Specular Intensity

The image below shows the specular effects reflected after the Point light illuminates the mirror.

image-20230922113318652

Note

Place a mirror in the scene and use it to view the specular effects reflected after the scene light illuminates the mirror.

Flashing

Different flashing effects can be achieved by modifying the light's properties Flash Intensity, Flash Speed and Flash Peak Period.

The image below shows the effect when Flash Intensity=1, Flash Speed=2, and Flash Peak Period=0.5.

Flash

Lens Flare

To enable the Lens Flare effect of the scene light, you need to enable the global Lens Flare effect first. Click Windows -> Default Effect in the Editor, then in the Default Effect window, check Lens Flare -> Proxy Object -> Lens Flare -> Visible.

image-20231011155630097

Enable Lens Flare

Check the Enable Lens Flare property of the light to see its Lens Flare effect.

image-20231205141137318

Lens Flare Config

Drag a Lens Flare file (*.lensflare) from the Project panel into Lens Flare Config and the configuration of the file will override that of the global Lens Flare.

image-20231205141229100

After configuration:

image-20231205141625611

Note

Right-click on the blank space of the Resource Preview window, then click Create Resource -> Lens Flare to create a Lens Flare file. Double-click the file to edit it.

image-20231012163150588

Lens Flare Distance

Effects of different Lens Flare Distances with the same distance from the light.

Lens Flare Distance: 50
Lens Flare Distance: 60

State Properties

The following are the properties under the State category of scene lights.

image-20231214160206806

PropertyDescription
VisibleWhether the light is displayed in the scene.
ActiveEnable the light effect.
Show Bounding BoxWhether to display the wireframe of the light range.
Affect Volumetric FogEnable the effect of the light illuminating in the fog.
Volumetric Fog OnlyShow only the effect of the light illuminating in the fog, not the effect of the light illuminating on the ground/objects.
NameThe light name.
Current Specular IntensityUnmodifiable
Async LoadSpeed up map loading.
Shadow Map DynamicAuto refresh shadow map size.
Helper NameUnmodifiable

Point Light Properties

The following are properties related to the Point Light settings.

image-20231012140941495

PropertyDescription
RangeLimit the light's visible range.
Constant AttenuationConstant attenuation factor.
Linear AttenuationLinear attenuation factor.
Radial AttenuationRadial attenuation factor.
Shadow Map SizeThe size of the shadow map displayed when creating a shadow.
Adapt Shadow Map SizeWhen enabled, the shadow map size can be automatically adjusted according to the view distance.
Volumetric Fog Inscatter IntensityCan be used to control the intensity of the volumetric fog after using it.

Property Effects

Range

The image below shows Point Lights with different Ranges. When a light is selected, you can see the area surrounded by a wireframe, which represents the light's visible range.

Light Range Wireframe Not Displayed
Light Range Wireframe Displayed

Note

Wireframes can be turned on/off via the Show Bounding Box property of the light.

Attenuation

Properties Constant Attenuation, Linear Attenuation and Radial Attenuation are used to adjust the light intensity of the light area.

The attenuation equation is:

d = max(d + Attenuation Coefficient 0, 0.0F);
float inten = max(0.0F, 1.0F - (Attenuation Coefficient 1 * d + Attenuation Coefficient 2 * d * d));
//If the values of Attenuation Coefficient 0 and Attenuation Coefficient 2 are both 0, the following equation will be used.
float inten = max(0.0F, 1.0F - Attenuation Coefficient 1 * d);

//d is the distance from the point in the light area to the light center.
//The result of the above equation is the light intensity.

Among them, Attenuation Coefficient 0 is Constant Attenuation, Attenuation Coefficient 1 is Linear Attenuation, and Attenuation Coefficient 2 is Radial Attenuation.

Constant Attenuation

The image below shows the effects of different Constant Attenuation when both Linear Attenuation are 1 and both Radial Attenuation are 0.

image-20231012133603867

Linear Attenuation

The image below shows the effects of different Linear Attenuation when both Constant Attenuation are 0 and both Radial Attenuation are 0.

image-20231012105343203

Radial Attenuation

The image below shows the effects of different Radial Attenuation when both Constant Attenuation are 0 and both Linear Attenuation are 1.

image-20231012105847977

Volumetric Fog Inscatter Intensity

First you need to enable the Voxel Fog Volume effect. In the Editor, click Windows -> Default Effect, then in the Default Effect window, check Voxel Fog Volume -> Property -> Visible.

image-20231011133606029

Select LSceneSettings-1 in the Hierarchy panel and check the Enable Tiled Forward Shading property under Context Config in the Inspector panel.

image-20231011134658247

Select the Light Source Object in the Hierarchy panel, select LightSourceComponent0(Inherited) in the Inspector panel, and then check VisBase -> State -> Affect Volumetric Fog.

image-20231012145131382

The volumetric fog intensity can be controlled by adjusting the Volumetric Fog Inscatter Intensity property of the light.

image-20231011153558948

On the basis of the above, the effects of turning on and off State -> Volumetric Fog Only property of the light are shown below:

Volumetric Fog Only Off
Volumetric Fog Only On

Spot Light Properties

The following are properties related to the Spot Light settings.

image-20231215110936599

PropertyDescription
Mask MapSet the Mask Map that the Spot Light loads.
RangeLimit the light's visible range.
Linear AttenuationLinear attenuation factor.
Radial AttenuationRadial attenuation factor.
Inner DegreeSet the inner cone angle of the Spot Light (in degrees).
Outer DegreeSet the outer cone angle of the Spot Light (in degrees).
Falloff ExponentExponential power of the Spot Light's intensity.
Shadow Map SizeThe size of the shadow map displayed when creating a shadow.
Adapt Shadow Map SizeWhen enabled, the shadow map size can be automatically adjusted according to the view distance.
Volumetric Fog Inscatter IntensityCan be used to control the intensity of the volumetric fog after using it.

Property Effects

Mask Map

The Mask Map property is used to modify the Pattern of the area illuminated by the Spot Light.

Drag a Mask Map from the Resource Preview window to the Mask Map of the Light Source Object (LLightSource) to add a Mask Map to the light.

image-20231214172921418

The effect:

image-20230926145131177

Range

The Range property is used to adjust the area illuminated by the light. When a light is selected, you can see an area surrounded by a wireframe, which represents the light's visible range.

Light Range Wireframe Not Displayed
Light Range Wireframe Displayed
Attenuation

Properties Linear Attenuation and Radial Attenuation are used to adjust the light intensity of the light area.

The attenuation equation is:

float attenu = max(0.0F, 1.0F - (Attenuation Coefficient 1 * d + Attenuation Coefficient 2 * d * d));
//If the value of Attenuation Coefficient 2 is 0, the following equation will be used.
float attenu = max(0.0F, 1.0F - Attenuation Coefficient 1 * d);
//d is the distance from the point in the light area to the light center.
//The result of the above equation is the light intensity.

Among them, Attenuation Coefficient 1 is Linear Attenuation, and Attenuation Coefficient 2 is Radial Attenuation.

Linear Attenuation

The image below shows the effects of different Linear Attenuation when both Radial Attenuation are 0.

image-20231012132835363

Radial Attenuation

The image below shows the effects of different Radial Attenuation when both Linear Attenuation are 0.

image-20231012133056543

Inner Degree

The effects of different Inner Degrees when Outer Degree = 30.

Light Range Wireframe Not Displayed
Light Range Wireframe Displayed
Outer Degree

The effects of different Outer Degrees when Inner Degree = 15.

Light Range Wireframe Not Displayed
Light Range Wireframe Displayed
Falloff Exponent

image-20231016152629267

Volumetric Fog Inscatter Intensity

For details on enabling and using the Volumetric Fog Inscatter Intensity effect of the Spot Light, please refer to the Volumetric Fog Inscatter Intensity of the Point Light.

image-20231212133115169

Box Light Properties

The following are properties related to the Box Light settings.

image-20231012152623960

PropertyDescription
Constant AttenuationConstant attenuation factor.
Linear AttenuationLinear attenuation factor.
Radial AttenuationRadial attenuation factor.
Light Box ScaleBox scale.

Property Effects

Attenuation

Properties Constant Attenuation, Linear Attenuation and Radial Attenuation are used to adjust the light intensity of the light area.

The attenuation equation is:

d = max(d + Attenuation Coefficient 0, 0.0F);
float attenu = max(0.0F, 1.0F - (Attenuation Coefficient 1 * d + Attenuation Coefficient 2 * d * d));
//If the values of Attenuation Coefficient 0 and Attenuation Coefficient 2 are both 0, the following equation will be used.
float attenu = max(0.0F, 1.0F - c_Attenu.y * d);
//d is the distance from the point in the light area to the light center.
//The result of the above equation, attenu, will be multiplied by the light intensity.

Among them, Attenuation Coefficient 0 is Constant Attenuation, Attenuation Coefficient 1 is Linear Attenuation, and Attenuation Coefficient 2 is Radial Attenuation.

Constant Attenuation

The image below shows the effects of different Constant Attenuation when both Linear Attenuation are 1 and both Radial Attenuation are 0.

image-20231012153724916

Linear Attenuation

The image below shows the effects of different Linear Attenuation when both Constant Attenuation are 0 and both Radial Attenuation are 0.

image-20231012154619016

Radial Attenuation

The image below shows the effects of different Radial Attenuation when both Constant Attenuation are 0 and both Linear Attenuation are 0.

image-20231012153032466

Light Box Scale
Light Range Wireframe Not Displayed
Light Range Wireframe Displayed

Area Light Properties

The following are properties related to the Area Light settings.

image-20231213170449677

PropertyDescription
RangeLimit the light's visible range.
Area HeightLength of the Area Light along the local Y-axis.
Area WidthLength of the Area Light along the local Z-axis.
Area AngleIlluminated area angle.
Shadow Map SizeThe size of the shadow map displayed when creating a shadow.
Adapt Shadow Map SizeWhen enabled, the shadow map size can be automatically adjusted according to the view distance.

Property Effects

Range

The Range property is used to adjust the area illuminated by the light.image-20230926175245575

Area Height/Area Width

You can adjust the size of the Area Light with properties Area Height and Area Width.

Light Range Wireframe Not Displayed
Light Range Wireframe Displayed
Area Angle

image-20230927105857288

Shadow Settings

Select LSceneSettings-1 in the Hierarchy panel and check Enable Dynamic Shadow under Context Config.

image-20230927134807662

The Shadow Map Size value (should be greater than 0) is required to be set when Point Lights, Spot Lights or Area Lights use shadows. After enabling Adapt Shadow Map Size, the Shadow Map Size value will not be used, and the shadow map size will be calculated automatically. At this time, the Shadow Map Size value should be greater than 0 too.

Disable Adapt Shadow Map Size and set different Shadow Map Sizes. The effects are shown below:

image-20230927151216557

The following are the effects of disabling and enabling Adapt Shadow Map Size when illuminated by an Area Light with a Shadow Map Size of 1024.

Adapt Shadow Map Size Disabled:

off

Adapt Shadow Map Size Enabled:

on

Models under moving lights have their shadows move with the models in real time by default. This feature can be disabled via State -> Shadow Map Dynamic property.

Before you use Shadow Map Dynamic, click Windows -> Default Effect, then in the Default Effect window, check the Shadow Map Optimal property and uncheck Use Shadow Pool under Light Manager.

image-20231215163958219

If there is LQualityVolume in the scene, you can directly select LQualityVolume, then select LightManager in the Inspector panel, check Shadow Map Optimal property and uncheck Use Shadow Pool.

image-20231215170303072

At this time, if you uncheck Shadow Map Dynamic and move the model, the shadow will not move with the model. The effect is as shown below:

ShadowMapDynamicOff

If you check Shadow Map Dynamic and move the model, the shadow will move with the model. The effect is as shown below:

ShadowMapDynamicOn