Orthogonal camera with illusion of depth

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
bilygates
Posts: 13
Joined: Tue Feb 23, 2010 10:35 pm

Orthogonal camera with illusion of depth

Post by bilygates »

Hello,

I have a rather simple question and I apologize if it has been asked before. I use a camera with an orthogonal projection for a 2D game and I want to give the user the illusion of depth using the scene nodes' Z position.

I will give an example: With an orthogonal projection, the scene nodes appear the same regardless of their Z value. If I move the camera left by 100px, all the scene nodes appear to move right by 100px, like they were all at the same distance from the camera. But, what I want to do is make the scene nodes appear to be farther away from the camera based on their Z value. If the camera moves 100px to the left, I want a scene node with a Z value of 200px to move only 50px to the right (or similar values).

I hope I have made myself clear. So, is there any simple way to achieve this? The only solution I can think of is manually moving scene nodes when moving the camera, which is a little tedious.

Thank you in advance!
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

You could set the scale of objects according to their distance from the camera, but most games will just use a projection camera with a very very small field of view.
bilygates
Posts: 13
Joined: Tue Feb 23, 2010 10:35 pm

Post by bilygates »

Wouldn't scaling the objects change their size? I want the objects to maintain their size regardless of their distance from the camera, just like in an orthogonal projection. I only want them to move slower when moving the camera to give the illusion of depth. Think of a space shooter with multiple layers of stars in the background; when you scroll, some stars move slower and give the impression that they are farther away.
Post Reply