Jump to content

  • Log In with Google      Sign In   
  • Create Account

Hybrid ortho/perspective view frustum


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 cstony   Members   -  Reputation: 410

Like
0Likes
Like

Posted 20 December 2012 - 02:27 PM

I am trying to create an effect where the view frustum provides a perspective effect along the x-axis, but an orthographic effect along the y-axis.

Think of a perspective view frustum but where the top and bottom faces run parallel to each other. Does anyone know how I an achieve this effect?

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8201

Like
1Likes
Like

Posted 20 December 2012 - 02:55 PM

Thinking about this for a minute, I don't think you can implement the whole chain of operations using matrices and the standard vertex processing stages. I believe it's the perspective division stage, which is introducing the perspective effect by dividing by the depth, that is the core of the problem since it is applied to both the X and the Y axes. You can either have no perspective, or perspective along both axes, since the divisor is the same for both axes.

You would have to implement your own vertex processing. This should be trivial with a vertex shader since you can just do the division yourself (divide only the X, Z and W components of the transformed vertex); then, OpenGL's own perspective division has no effect since the vertex has a unit W-component.

#3 MaelmDev   Members   -  Reputation: 198

Like
0Likes
Like

Posted 20 December 2012 - 03:53 PM

I can think of how this would work visually, but not the steps needed to produce the transform matrix. What I see is an orthographic frustum with the "near" side squished vertically to make a trapezoidal prism.

#4 CryoGenesis   Members   -  Reputation: 495

Like
0Likes
Like

Posted 20 December 2012 - 05:13 PM

Sounds like one of those old raycasting type views.
Do you mean something like this:
http://image.dosgamesarchive.com/screenshots/wolfenstein4.gif
but instead of the crappy block graphics you have proper geometry?

#5 cstony   Members   -  Reputation: 410

Like
0Likes
Like

Posted 23 December 2012 - 09:02 AM

Thanks Brother Bob, you're right. I was initially thinking that this would be possible to construct just by modifying the projection matrix. Doing the perspective divide in the vertex shader only on the x, z and w components did the trick! smile.png




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