How to calculate sun and camera angle?

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

I want to know if the player (Camera) is watching to the sun directly.

:bust_in_silhouette: Reply From: reimgrab

You need at least the forward vector of the camera and a position and dimension of your sun.
Then you could model the sun (mathematically) as a sphere and do a ray-sphere intersection test.