• Advertisement
Sign in to follow this  

Create a Fake Perspective ?

This topic is 2150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

The left side of the image below shows a regular projection with the camera positioned at (0,0,0) and looking at (0,0,farZ) which I show with a yellow dot. Notice the top and bottom of the boxes.

I want to render something similar to the right side. The camera would seem as if it's positioned at (0,bottom,0) and looking at (0,bottom,farZ). Notice the bottoms of the boxes here.

How can I do that ? If I simply relocate the camera half the objects will be off screen. This is a 2D game (with 3D objects) so I'm keeping the camera fixed.

Thank you.

cameray.jpg

Share this post


Link to post
Share on other sites
Advertisement
Hi!

At first, I thought of suggesting an orthographic projection, but then I saw that your objects are getting smaller in the distance (perspective-like). This is rather tricky.
Maybe there is some easy matrix to achieve this, I don’t know. (One of the off-center matrices perhaps? I honestly don’t know.)

But, in case there is not, you could try to use two viewprojection matrices. The first one is a perspective matrix centered above the object, thereby producing the 3D look you want to have. Afterwards you move the object by a translation in clipping space to the desired position. The offset vector could probably be somehow found by using the “cameras” viewprojection matrix (probably orthographic) to see, where the vertex is on the screen and how far it is away from the camera. I’m not quite sure, whether this works so easily. It’s essentially the idea of rendering the objects to small imposters and then placing the imposters (except that you don’t need to render the object (and depth) to a texture, but instead just moved it to the desired position in the vertex shader).
Maybe you could pick up the imposter idea, which means you'd render your objects with the perspective projection to a texture atlas and then just render textured, viewport-aligned quads (billboards) to show them in the final scene. (If your atlas contains depth, you can adjust the output depth of the billboard pixels to get proper depth tests.)

I hope this helps at least a little. smile.png Edited by Tsus

Share this post


Link to post
Share on other sites
Can't you make the camera look waaay below your desired screen area (thereby making your wanted objects way above) and then apply a translation after the projection matrix?

Share this post


Link to post
Share on other sites

...
I want to render something similar to the right side. The camera would seem as if it's positioned at (0,bottom,0) and looking at (0,bottom,farZ). Notice the bottoms of the boxes here.
...

How should it look like when the boxes are apart from the vertical axis?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement