Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to switch Perspective to Orthogonal projection while keeping things in almost same size?


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
2 replies to this topic

#1 Tunisia hawker   Members   -  Reputation: 160

Like
0Likes
Like

Posted 18 September 2012 - 02:11 AM

Hi,I want to change my projection matrix from Persective to Orthogonal way.I use the same width,height and other properties,so I get bigger things showing on the screen.My question is how to modify the projection matrix so I can get simillar size as Perspective Projection?

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 7746

Like
0Likes
Like

Posted 18 September 2012 - 05:11 AM

The size of an object in perspective projection depends on its distance from the viewpoint. First you have to define a distance within the view volume where you want objects from the perspective and the orthographic projections to have the same sizes. And secondly, which way are you going; do you have an orthographic projection and want a similar perspective one, or the other way around?

#3 Brother Bob   Moderators   -  Reputation: 7746

Like
0Likes
Like

Posted 18 September 2012 - 05:39 AM

Actually, I don't need that information to give an answer, but you need it yourself when you plug in some numbers to get an actual projection matrix.

The size of a perspective projection at depth d is
width = d*tan(fov/2);
height = aspect*d*tan(fov/2);
where fov is the full vertical field of view, and aspect is the width-to-height aspect ratio of the view volume. At this particular depth d, the visible coordinate system range from -width to width in the horizontal direction, and from -height to height in the vertical direction.

Based on that, you can set up the orthographic projection with the width and the height values. At depth d in the perspective projection, objects will have the same size as in the orthographic projection.

If you need to go the other way around, solve for fov given the width or height instead. The two are linked by the aspect parameter so they are effectively the same parameter.




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