Jump to content

  • Log In with Google      Sign In   
  • Create Account

Create a Fake Perspective ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Endemoniada   Members   -  Reputation: 312

Like
0Likes
Like

Posted 31 May 2012 - 09:14 PM

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.

Posted Image

Sponsor:

#2 Tsus   Members   -  Reputation: 1063

Like
0Likes
Like

Posted 01 June 2012 - 01:21 AM

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. Posted Image

Edited by Tsus, 01 June 2012 - 01:57 AM.


#3 darrenmarklines   Members   -  Reputation: 200

Like
0Likes
Like

Posted 03 June 2012 - 05:20 AM

PerspectiveOffCenterLH is what you want, you need to change the camera dynamically per object with an offset that is appropriate for the effect you want.

#4 DvDmanDT   GDNet+   -  Reputation: 1004

Like
0Likes
Like

Posted 03 June 2012 - 05:54 AM

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?

#5 haegarr   Crossbones+   -  Reputation: 4604

Like
0Likes
Like

Posted 03 June 2012 - 07:55 AM

...
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?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS