problem underestanding orthographic projection

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1
Contact:

problem underestanding orthographic projection

Post by rogerdv »

Im still a newbin in this and I really dont underestand the difference between perspective and orthographic projection. Anyway, everybody says that it is the best choice to implement an isometric like view, so, i started working.
The problem is that I draw my terrain, put a robot mesh and place camera at (200,200,200). That worked fine in normal mode, but if I set camera in ortho mode, the view gets inside mesh. No matter how far I move the camera, still the mesh interferes with the view, actually there is not much difference between 200 or 1000. So, i guess Im doing something wrong here, but, what is it? Do I need to do something special before setting ortho mode? Or simply should I try placing camera 100 times far away?
matches81
Greenskin
Posts: 116
Joined: Tue Jun 12, 2007 10:28 am

Post by matches81 »

the difference between perspective and orthographic projection is:
With perspective projection distant objects appear smaller, the view frustum (the area you see on screen) is shaped like a pyramid with its tip cut off (you sit at the smaller side). With orthographic projection distant objects don't get smaller, your view frustum is a cuboid. The far plane has the same size as the near plane. Parallel lines in space remain parallel.

Because distant objects don't get smaller with orthographic projection you normally can specify the size of the near plane / the view area. I don't know about Ogre, because I'm quite new to it, but there should be a way to do that. Moving the camera away won't change a thing about what you see.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Maybe what you need is 'zoom' feature within Orthographic projective mode. For that matter, here is the thread: http://www.ogre3d.org/phpBB2/viewtopic.php?=&p=214034
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1
Contact:

Post by rogerdv »

Do I need to use matrices and all that stuff to get a decent view?
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Yes and the matrices are actually pretty easy to deal with - the values are all self-explanatory.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA
Contact:

Post by walaber »

what kind of game are you trying to make that requires an orthographic view?
Go Go Gadget OGRE!!
Image
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 »

walaber wrote:what kind of game are you trying to make that requires an orthographic view?
http://www.ogre3d.org/phpBB2/viewtopic.php?p=241989

http://www.ogre3d.org/phpBB2/viewtopic.php?p=242150
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
matches81
Greenskin
Posts: 116
Joined: Tue Jun 12, 2007 10:28 am

Post by matches81 »

In the thread linked by syedhs, Sinbad explains a solution that should work for you.
There should be a function called setOrthoWindow(Real w, Real h) which should do just what you need. 'w' and 'h' define the size of the window in world units. You can try and imagine that as a rectangle through which you will look. The bigger that rectangle is, the "farther" away you seem to be, i.e. the smaller objects will get. Perhaps that helped.
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1
Contact:

Post by rogerdv »

walaber wrote:what kind of game are you trying to make that requires an orthographic view?
You can see in the threads posteb by jacmoe.
After some reasoning I found why ortho is the best mode. In perspective mode objects in the "lower" side of screen are "closer" to camera , so they should look bigger than the objects in the "upper" side. In ortho mode, all objects will seem to have the same size. Thats why the screenshot from daimonin 3d client looks so different to my application and so similar to old style isometric games.
Post Reply