|
#1
|
|||
|
|||
Projection Matrix (onto oblique near plane)
I would like to define a projection matrix matrix with an oblique near plane. I have a paper which explains how to do this, but it seems that the projection matrix in Vizard isn't defined in the same way as with OpenGl. Can someone explain why they aren't defined in the same way?
Here is a website which explains how to derive the (regular) projection matrix: http://www.songho.ca/opengl/gl_projectionmatrix.html The openGL matrix has the following form: OpenglProjectionMatrix = [ [ 2n/(r-l), 0 , (r+l)/(r-l) , 0 ] , [ 0 , 2n/(t-b), (t+b)/(t-b) , 0 ] , [ 0 , 0 , P33 , P34 ] , [ 0 , 0 , -1 , 0 ] ] Using the 'viz.MainWindow.getProjectionMatrix()' command ( and after varying the near and far parameters), one can see that vizard returns a projection matrix of the form: VizardProjectionMatrix = [ [ 2n/(r-l), 0 , (r+l)/(r-l) , 0 ] , [ 0 , 2n/(t-b), (t+b)/(t-b) , 0 ] , [ 0 , 0 , P33 , -1 ] , [ 0 , 0 , P43 , 0 ] ] If eye space is projected onto a non-oblique near plane, it is easy to resolve this issue by simply switching the two elements ( P34 with P43 ) which are out of place . But in order to define a projection matrix with an oblique near plan, I need to define two more elements in the openGL-style matrix ( P31 and P32). My quick fix can't work anymore, so I'm wondering (1) is there anyway I can set the projection matrix as defined by openGL? (2) Is there any special reason the projection matrix is defined differently in Vizard? Here is the form of the matrix which I need to define: ObliqueProjectionMatrix = [ [ 2n/(r-l), 0 , (r+l)/(r-l) , 0 ] , [ 0 , 2n/(t-b), (t+b)/(t-b) , 0 ] , [ P31 , P32 , P33 , P34 ] , [ 0 , 0 , -1 , 0 ] ] Any help would be appreciated.thanks! -Andy |
#2
|
|||
|
|||
Have you tried using the viz.MainWindow.setProjectionMatrix() command?
Code:
ObliqueProjectionMatrix = [ 2n/(r-l), 0 , (r+l)/(r-l) , 0, 0 , 2n/(t-b), (t+b)/(t-b) , 0, P31 , P32 , P33 , P34, 0 , 0 , -1 , 0 ] viz.MainWindow.setProjectionMatrix(ObliqueProjectionMatrix) |
Tags |
oblique near plane, projection matrix |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
orthographic projection in a head-tracked cave environment | michaelrepucci | Vizard | 5 | 12-14-2011 11:29 AM |
projection matrix control & child window | kwkim | Vizard | 0 | 08-31-2011 01:53 AM |
Tiling a texture on a plane | FreakyT | Vizard | 2 | 04-27-2011 06:34 PM |
I need help with the Far Clip Plane... | k_iwan | Vizard | 3 | 03-13-2007 05:54 AM |
Panning Textures across a plane. | shivanangel | Vizard | 3 | 04-07-2006 09:45 AM |