Skip to main content

Set Directional Light Color

Changes the color of the directional light shining on the terrain.

Set Directional Light Color block

Description

The Set Directional Light Color block changes the color of the directional light shining on the terrain. This is a code block part of the Environment drawer.

Usage

Use Set Directional Light Color to adjust the ambient lighting in your simulation. This block is perfect for creating time-of-day effects like sunrise and sunset, simulating different weather conditions, or establishing specific moods and atmospheres in your environment.

Syntax

Input:

  • Color block

Example

This is a model of a forest environment. To make the lighting more realistic, the color of the directional light changes from white to be gradually more pink (the green value of its RGB is lowered) during the sunset and gradually less pink during sunrise.

Set Directional Light Color example code 1Set Directional Light Color example code 2Set Directional Light Color example code 3

Notes

  • The directional light affects all objects and terrain in the simulation
  • Color changes take effect immediately when the block is executed
  • Combine with Set Directional Light Intensity for more complex lighting effects