Skip to content
Lighting System

Lighting System

It takes about 15 minutes to read this article

This article outlines the concept of a Lighting system, all its basic properties, and how to use it in an editor.

What is the lighting?

Lighting system is a world object with main lighting effect in game scene,can change environment and atmosphere effect. include parallel light and skylight. - Parallel light property: refers to the effect of a parallel light source on the environment, mainly simulating the environmental effect of sunlight. - Skylight property: refers to the light source effect reflected by the object, mainly baking the overall environmental atmosphere.

Parallel Light Properties

Orientation Angle

  • Description: Determines the lateral position of the sun in the sky (XY axis).

  • Value range: [-180,180]

  • Related Interfaces:

ts
// Set the sun orientation angle to 30.
Lighting.yawAngle = 30;
// Set the sun orientation angle to 30.
Lighting.yawAngle = 30;

Pitch Angle

  • Description: Determines the longitudinal position of the sun in the sky (Z-axis).

  • Value range: [-90,90]

  • Related Interfaces:

ts
// Set the Sun's pitch angle to -30
Lighting.pitchAngle = -30;
// Set the Sun's pitch angle to -30
Lighting.pitchAngle = -30;

Intensity

  • Description: The developer can adjust the intensity of the parallel light by sliding the roller.
  • Value range: 0-100.

Ground at Strength 0

Ground at Strength 50

Ground at Strength 100
  • Related Interfaces:
ts
// Set the parallel light intensity to 10
Lighting.directionalLightIntensity = 10;
// Set the parallel light intensity to 10
Lighting.directionalLightIntensity = 10;

Color

  • Description: The developer can choose the color of the parallel light. The resulting ground color is determined by material, texture, and light.

  • Related Interfaces:

ts
// Set the parallel light color to pale yellow
Lighting.directionalLightColor = new Type.LinearColor(255,240,200);
// Set the parallel light color to pale yellow
Lighting.directionalLightColor = new Type.LinearColor(255,240,200);

Cast Shadow

  • Cast Shadow: Whether or not to activate the shadow effect.

Shadowed

No Shadows
  • Shadow Distance: Affects the visual representation of shadows.

    • The larger the value, the blurrier the plot, and the larger the shadow pixels.

Shadow Distance 5000
  • The smaller the value, the sharper the plot, and the smaller the shadow pixels.

Shadow Distance 1000
  • Related Interfaces:
ts
// Turn off shadow casting
Lighting.castShadowsEnabled = false;

// Turn on shadow casting
Lighting.castShadowsEnabled = true;
// Turn off shadow casting
Lighting.castShadowsEnabled = false;

// Turn on shadow casting
Lighting.castShadowsEnabled = true;

Color Temperature

  • Enable color temperature: Check to enable color temperature effect.
  • Color Temperature: Size of solar temperature, range [1000, 14000]

Temperature 1000

Temperature 4000

Temperature 14000
  • Related Interfaces:
ts
// Turn off sunlight color temperature
Lighting.temperatureEnabled = false;

// Turn on sunlight color temperature
Lighting.temperatureEnabled = true;

// Set the sunlight color temperature to 4000
Lighting.temperature = 4000;
// Turn off sunlight color temperature
Lighting.temperatureEnabled = false;

// Turn on sunlight color temperature
Lighting.temperatureEnabled = true;

// Set the sunlight color temperature to 4000
Lighting.temperature = 4000;

Skylight Properties

Skylight Texture

  • Description: Skylight Texture is our preset reflection ball texture, which allows users to quickly select the reflection effect of the environment to create the desired atmosphere.

  • Steps:

  • First, open the Sky Box list in the Asset Library and find the type of resources in the Reflecting Ball

  • You can then drag one of the textures into the Skylight Texture.

Sky Light Intensity

  • Function description: The intensity of the reflected light effect of the object; the lower the value, the weaker the effect, the higher the value, the stronger the effect.

Dim light throughout the world when the intensity of the sky is 0.2

Bright light throughout the world at 1.0 mph

Skylight Intensity 6.0: The entire world shines with too much light
  • Related Interfaces:
ts
// Set the skylight intensity to 2.
Lighting.skyLightIntensity = 2;
// Set the skylight intensity to 2.
Lighting.skyLightIntensity = 2;

Skylight Color

  • Description: Skylight shades are shades of skylight that shine throughout the world; they can be adjusted to suit the developer's preferences.

Sky Light Color: Red FF000000

Sky Light Color Green 00FF0000

Sky Light Color 0000FF00
  • Related Interfaces:
ts
// Set skylight intensity to green
Lighting.skyLightColor = new Type.LinearColor(255, 0, 0);
// Set skylight intensity to green
Lighting.skyLightColor = new Type.LinearColor(255, 0, 0);

Color Bias

  • Description: Global post-processing color adjustment, adjusting global lighting color effects.

  • Related Interfaces:

ts
// Set the offset color
Lighting.lightColor = new LinearColor(255,0,0)
// Set the offset color
Lighting.lightColor = new LinearColor(255,0,0)

Exposure Compensation

  • Properties: The way of controlling exposure, such as the dark environment, requires an appropriate increase in exposure value to highlight the clarity of the screen.

  • Related Interfaces:

ts
// Set exposure compensation value
Lighting.ev100 = 0.5
// Set exposure compensation value
Lighting.ev100 = 0.5