Jump to content
  • Advertisement
Sign in to follow this  
aprilspirit89

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

This topic is 2160 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,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?

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!