Hi graphics people!!!
What I want to do is to calculate a projection matrix, where I can specify any orientation for the near plane. This means, I want to be able to rotate the near plane of my viewing volume.
I looked at Foley and tried to derivate it from his 6 steps, but it doesn' really work. Currently I am doing it like this:
1) I calculate the u,v,n -axis. I think this works. It gives me the following Matrix:
(With the n-axis I specify the orientation with the near plane and calculate the u- and v-axis according to the n-axis)Code :ux uy uz 0 R = vx vy vz 0 nx ny nz 0 0 0 0 1
2) after that I convert the frustum to the symmetric frustum by a shear transformation
3) Here I scale the sides to: x = +/-z, z = -far, z = -nearCode :shx = (left + right) / (2 * near) shy = (bottom + top) / (2 * near) 1 0 shx 0 H = 0 1 shy 0 0 0 1 0 0 0 0 1
The required scaling matrix is therefore:
4) In this step I transform the far plane to the plane z = +1 and the near plane to z = -1 using projection normalization.Code :xscale = 2 * near / (left - right) yscale = 2 * near / (top - bottom) zscale = 1 xscale 0 0 0 S = 0 yscale 0 0 0 0 zscale 0 0 0 0 1
With multiplication of the matrices above I should get my projection matrix, with a flexible near plane:Code :a = -(far + near) / (far - near) b = (-2 * far * near) / (far - near) 1 0 0 0 N = 0 1 0 0 0 0 a b 0 0 -1 0
But it doesn't work. I think that something is wrong with the rotation part. But I just did it like Foley. Without the last multiplication by R, it's just like the normal OpenGL projection matrix.Code :P = N * S * H * R
It would be so cool if somebody of yous could give me a suggestion to this, because it should be possible.
[This message has been edited by A027298 (edited 11-26-2002).]