The critical value here, lightPos, was set as the vertexPos function that you expressed in screen space (this was because its original shape of the world space was multiplied by modelView). The screen space remains in the camera, not in the 3D world. Therefore, in order to have a fixed light source relative to some absolute point in world space (for example, [4.0, 4.0, 4.0]), you could simply leave your objects in this space, as you know.
But getting rid of modelview is not a good idea, since the whole point of the model matrix is ββto put your objects where they belong (so that you can reuse your vertex arrays with changes only to the model matrix, and not burden them with specifying all vertex vertices from scratch).
It is best to multiply modelView on both vertices and lightPos. Thus, you treat lightPos, as originally, a quantity in world space, but then perform a comparison in screen space. Mathematics to get the light intensity from the normals will work the same in any space, and you will get the right light source.
source share