Perspective zooming problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Amaroker
Posts: 5
Joined: Sat Nov 15, 2008 11:46 am

Perspective zooming problem

Post by Amaroker »

Hello,

I'm trying to export a 3D scene from a non-Irrlicht program where zooming is performed by changing view width and height (model units). So, I export the position of camera & target, view width & height and near & far values and import into my own program built with Irrlicht.

So in Irrlicht I call buildProjectionMatrixPerspectiveLH where I need to multiply the first parameters (view height and width) with a zoom factor (my camera zooms by changing the field of view, so that's my zoom factor).

The problem is, how can I calculate the equivalent zoom factor? I want the objects in the scene to be rendered as they were in the original program. Well, it's pointing in the right direction but I need to make it zoom properly.

The difference I see is that when the near clipping plane distance is adjusted in the original program it doesn't affect the zoom (rendering using gluPerspective), but in Irrlicht there are visible zoom changes if I modify the near value. It seems like the behaviour of glFrustum, but I can't find glFrustum in Irrlicht source code. Same with gluPerspective. (Maybe someone can explain how perspective works in Irrlicht OpenGL driver? Which part of the source code?).

Any ideas? Thanks for reading...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

We simply build the projection matrix on our own. The values are very similar to glFrustum, though.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

(my camera zooms by changing the field of view, so that's my zoom factor).
Use the FOV setting method of the ICameraSceneNode.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Amaroker
Posts: 5
Joined: Sat Nov 15, 2008 11:46 am

Post by Amaroker »

OK, thanks hybrid. I compared the irrlicht projection matrix with the matrix created by glFrustum and found the difference. Problem solved now.
Post Reply