WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-13-2012, 06:01 AM
andrewjworz andrewjworz is offline
Member
 
Join Date: Apr 2011
Posts: 11
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
Reply With Quote
  #2  
Old 07-13-2012, 09:10 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Just make sure the projection matrix is a 16 item 1-dimensional array.
Reply With Quote
Reply

Tags
oblique near plane, projection matrix

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
orthographic projection in a head-tracked cave environment michaelrepucci Vizard 5 12-14-2011 10:29 AM
projection matrix control & child window kwkim Vizard 0 08-31-2011 12:53 AM
Tiling a texture on a plane FreakyT Vizard 2 04-27-2011 05:34 PM
I need help with the Far Clip Plane... k_iwan Vizard 3 03-13-2007 04:54 AM
Panning Textures across a plane. shivanangel Vizard 3 04-07-2006 08:45 AM


All times are GMT -7. The time now is 07:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC