Getting LIGHT_POSITION in a spatial shader

Godot Version

4.2.2 stable

Question

In the documentation for light(), LIGHT is unhelpfully explained as “Light Vector, in view space.” and it seems to be normalized.
Furthermore ATTENUATION includes shadow information rather than being a pure falloff function. So I can’t use that and LIGHT to calculate LIGHT_POSITION.
How else would I calculate LIGHT_POSITION in a spatial shader?

void light() {
    DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * LIGHT_COLOR;
}

Looking at the example function the only logical thing to assume is that LIGHT is a vector that points towards the light being computed. Thus, the surface is maximally illuminated when the surface points directly at the light.

With regards to how you could achieve the light position, maybe you should just forward the world space light position(s) to the shader via a uniform.

I was gonna say that you could just compute the view space position of the light based on the DEPTH map and ATTENUATION, because I don’t see how ATTENUATION is not the light falloff. However, I don’t know how to resolve the computation for scenarios where the falloff value is not at its default value (e.g linear vs logarithmic).

Sorry I can’t give you a direct solution. I have yet to mess around with shaders in Godot.