Can’t quite figure this out, I get the location of the directional light (i.e sun) and forward vector of the player camera, normalize both vectors and Dot product. I thought the result would return a consistent value no matter where the sun was in the sky but the value is the same if I rotate the player 360 degrees.

If I then move the sun (directional light) to another position and repeat I get a different value then before.

I was trying to get a consistent value returned no matter where the sun was in the sky.

Any suggestions?

are you plugging the normalized location of the sun into the dot product?

You need to use the normalized{ sun location - player location }, that’ll give you the sun’s direction vector, rather than just the sun’s position

Directional lights don’t really have a position, as the light doesn’t emit from a single point in space. You’d want to check the dot product of the light’s forward vector (times -1) with the camera forward vector.

The objective of a directional light is to not have a position, only a rotation; the effective position is infinitely far backward from the facing direction, in a sense.

The dot product of two normalise vectors will give 1 if the two are parallel (non-skew, non-perpendicular), but it sounds like you may be dealing with angles alone:

On a 2D plane, If the angle of the sun is angled at a 200 degree bearing, and the player is looking on a 20 degree bearing, the player is looking directly at the sun (bad for your eyes!)

3D is slightly harder, but it becomes a lot easier if you express the directions of the look and sun as unit vectors - very easy to do.

Dot those two vectors and compare the closeness to 1.