AtmosphericLightVector material node returning opposite direction

I was eager to use the new AtmosphericLightVector material node to get rid of a material parameter collection that I used to retrieve the directional light direction in my materials, but as soon as I plugged it in I started getting strange results. After some tests I realized that the AtmosphericLightVector material node returns a vector which is actually the opposite of the light direction.

To reproduce the issue just create a new level, drop a directional light in it and check the “Atmosphere Sun Light” property. Then create a new material and assign it to a mesh in the map, like in the screenshot below. On the left you can see the directional light oriented towards [1, 0, 0], while on the right you can see that the vector returned by AtmosphericLightVector is [-1, 0, 0].

I don’t know if it’s supposed to work this way by design, and if it is please bear with me, but it feels a bit puzzling having to multiply the vector by -1 to actually get the direction of the light.

A minor issue that I also would like to point out in the current implementation is that a zero vector is returned from the node when previewing the material in the material editor. Previewing the material this way is a pain and much harder than it was with the material parameter collection approach where a default test value could be set. A much more useful approach would be to return the direction of the light in the material preview viewport, so that changes to light direction could be previewed in real time.

I really like the new node and was hoping to finally get rid of the verbose material collection parameter approach, but as of now it feels a bit unpolished and unnecessarily hard to use.

Thanks.

1 Like

Usually, LightVector is a vector from a pixel towards the light, so i’m pretty sure that is intended.

Thanks for your reply! Ah, I see, and it makes sense. By reading the release notes I was under the impression that it would be the other way around: “New: Added material nodes “Atmospheric Fog Sun Direction” and “Atmospheric Fog Sun Color” so that materials can very easily get access to the direction and color of a directional light”, hence the misunderstanding.

1 Like