Jon Watte

You can still do billboards in screen space; just set the projection matrix to an orthographic matrix (or to identity).

If you use billboards, you have to settle on a distance from camera to billboard plane (say, 1.01 meters, if your near clipping plane is at 1.0 meters), and then project the ray to the sun from the camera location onto that plane for the sun location. Project the Forward ray of the camera orientation matrix (which is the inverse of the view matrix) onto that same plane to get "camera center."

Note that the plane normal of the projection plane will be the same as the camera Forward vector.

The math would look something like:

Vector3 cameraPos = ...;

Vector3 sunPos = ...;

float ProjectionPlaneDistance = ...;

Matrix cameraMat = viewMatrix.Inverse();

Vector3 sunPos = cameraMat.Forward * Vector3.Dot(sunPos - cameraPos, cameraMat.Forward) * ProjectionPlaneDistance + cameraPos;

Vector3 centerPos = cameraMat.Forward * ProjectionPlaneDistance + cameraPos;