Getting accurate light colors in shader

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ninfur

How can I write a light shader that outputs the exact same color as defined by the scenes directional light?

The following simple script will not result in accurate colors.

shader_type spatial;

void light() {
    DIFFUSE_LIGHT = LIGHT_COLOR;
}

The world environment has no background, ambient light or reflected light.

I am aware that LIGHT_COLOR is the light’s color multiplied by the energy. But with the energy set to 1, I would expect it to be the same as the directional light’s color.

Converting LIGHT_COLOR from linear to the sRGB color space does not help.