Off-axis perspective projection

What it says on the tin: a place to discuss proposed new features.
Post Reply
grimm
Gnoblar
Posts: 11
Joined: Sat Feb 12, 2005 12:39 am
Location: Sweden

Off-axis perspective projection

Post by grimm »

Off-axis perspective projection is useful when the viewer's eyes aren't perpendicular to the center of the screen. Example applications for this are caves (multiple screens surrounding the viewer) and stereo views (see e.g. 9.080 in http://www.opengl.org/resources/faq/tec ... ations.htm)

I looked at the Camera class, but didn't find anything about this, nor about supplying your own projection matrix. Perhaps SceneManager::manualRender can be used directly, but that seems unnecessary complex.
grimm
Gnoblar
Posts: 11
Joined: Sat Feb 12, 2005 12:39 am
Location: Sweden

Post by grimm »

I think it actually is quite easy to add this support to Ogre, since the functions for creating the matrix is already there (the second overload of RenderSystem::_makeProjectionMatrix). This function corresponds to glFrustum where you can specify different values for left/right and top/bottom.

It can be supported by adding the following to the class Frustum:

- One more projection type, perhaps calling it PT_WINDOW.
- Four new member variables: left, right, top, and bottom.
- Member function(s) for setting these member variables.
- Code for handling the new projection type in updateFrustum() (just calling the function mentioned above).

However, perhaps it is not very clean to add even more members to Frustum, especially since they will only be used for this type of projection (and then the other member will not be used).

I can create a patch for this, but it would be good to know what others think first.
User avatar
AmitMathew
Gnoblar
Posts: 21
Joined: Mon Jul 21, 2003 3:48 pm
Location: Athens, GA, USA
Contact:

Post by AmitMathew »

I would be interested in seeing this. On my to-do list is to add support to Ogre for different VR displays but I haven't really had a chance to research into what is necessary to pull this off. I would be interested to see what you come up with.

Amit
pgavigan
Gnoblar
Posts: 22
Joined: Wed Jun 06, 2007 7:09 pm
Location: Carleton University, Ottawa Ontario Canada

Post by pgavigan »

AmitMathew wrote:I would be interested in seeing this. On my to-do list is to add support to Ogre for different VR displays but I haven't really had a chance to research into what is necessary to pull this off. I would be interested to see what you come up with.

Amit
Hey there,

I'm working on a v-cave right now, and am wondering if anything ever came of this? Do you know of any easy way for me to set this up off hand?
Patrick
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Code: Select all

      Ogre::RenderSystem::_setProjectionMatrix(someMatrix);
      Ogre::RenderSystem::_setViewMatrix(m);
      Ogre::RenderSystem::_setWorldMatrix(Ogre::Matrix4::IDENTITY);
Keep in mind that you need to update the matrix transforms yourself, as Ogre doesn't do this automagically when you're using custom transforms.

The camera has go a transform setting function too.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Bottom line is that Camera::setCustomProjectionMatrix lets you do anything you like.
Post Reply