Projection matrix for non-constant FOV

Could anyone help me to derive a projection matrix that enables linear change of vertical FOV from left to right?

The problem I’m trying to solve is a projection onto the screen that is not perpendicular to a view direction. Furthermore, there are a lot of such screens that have to be aligned. Thus far I’ve been using averaged FOV, but the results are not adequate.

Thank you in advance!


Perhaps it would help to clarify what you want different from calling glFrustum() with right != -left. This gives you an off-axis perspective frustum where the screen is not orthogonal to the view direction.

the screen is always orthogonal to the view direction… an off-axis projection only means that the view point is not directly over the center of the screen.

Yeah and that is exactly what Aleksandar wants.

Thank you guys!
Special thanks to Dark Photon! :slight_smile:

The best solutions are always the simplest.
I tried to solve it using FOV instead of simple frustum.

the screen is always orthogonal to the view direction…[/QUOTE]
A clarification for those that find this post later. The truth of the latter depends on your definition of “view direction”.

If you define “view direction” as the eye-space negative Z axis, regardless whether that vector is even visible in the view frustum, then what he asserted is true.

If you define the “view direction” as a vector from the eyepoint through the center of the view frustum, then Chris’ assertion isn’t true.

Just depends on your perspective. LIGHT_MODEL_LOCAL_VIEWER or not – your pick. For wildly off-axis frustums though, you want it.

Although some time has passed since I’ve started this thread, and also since I’ve solved my problem, I think it can be interesting to illustrate what I needed. The problem was in a fact that I started from the projection matrix in the form that depends on the FOV. It was virtually impossible to accommodate it for the use-case in which viewing direction is not perpendicular to projection plane. Defining frustum with clipping planes made it almost trivial.

This is the illustration of using glFrustum-like projection matrix for non-perpendicular multiple projection planes.
Fig1 (Cepelin-1.jpg) is 360 degrees panorama projected with 18 separate projectors while the viewer is in the center of the room depicted in Fig2 (CepelinRoom_resize.jpg).