PDA

View Full Version : Asymmetric frustum + rotation?

7th
04-30-2007, 04:52 AM
Hi,
I am trying to define an asymmetric viewing frustum that has a rotation on it but I can't seem to get the process right. What I want to achieve can be descibed by the following sequence:

1) Define a frustum of (lrtb) -45,-30,45,35.
2) Rotate the frustum by 45 degrees around the centre of the frustum (not the normal).

The effects that I am seeing are either that the frustum rotates around the normal or I get a 'shear' effect (I think because the lrtb are being transposed by the rotation).

Any guidance as to the correct sequence of events to achieve this would be greatly appreciated.

cass
04-30-2007, 10:22 AM
Without understanding from your description exactly what you want, what I would suggest is solving for the matrix by picking the corners of the frustum in eye space and their corresponding location in clip space. That should give you more than enough equations to solve for your unknowns (the matrix elements).

7th
04-30-2007, 11:06 AM
Thanks Cass.
I can certainly calculate the corners of my frutsum but I am not sure how to then create my frustum from this in OpenGL.
Is there a standard approach to this?

dorbie
05-07-2007, 02:15 AM
You mean like a 2D screenspace rotation?

You can apply this as a pre multiplication on the projection matrix, although this is a very unusual requirement.

Perform the rotation then call glFrustum and it should rotate around the middle with no ill effects.

If you mean eyespace then you apply it on the modeview matrix as part of the viewing transformation, but that is only for rotations about the viewpoint.

The description is a little bit ambiguous but I think my first explanation is what you're looking for and can only really be done at that stage.

7th
05-09-2007, 01:55 AM
Your assumption is correct - 2D Screenspace rotation is a much better description!

I have tried the rotation on the Projection matrix. The problem with this is that the net effect transposes the h and v fov.

i.e. if I have a viewport (and hence FoV) that has an aspect ratio of 2:1, then when I apply a 90 degree roll I want the aspect ration to be effectively inverted such that the objects in the view do not get distorted. Not a clear description I know, but I am struggling to accurately describe it.