How can a light source be fixed behind an object, but with camera movement?

Compute direction vector dir from camera to earth as

dir = earth.pos - camera.pos

A line that extends both ways to infinity through camera and earth can be described as

L = camera.pos + π›Œ * dir

with:

π›Œ < 0 : positions behind the camera (when looking at earth)
π›Œ = 0 : position at camera
0 < π›Œ < 1 : positions between camera and earth
π›Œ = 1 : position at earth
π›Œ > 1 : positions beyond earth (when looking at earth)

3 Likes