Sign in to follow this  
aprilspirit89

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

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
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 [i]d[/i] is
[code]
width = d*tan(fov/2);
height = aspect*d*tan(fov/2);
[/code]
where [i]fov[/i] is the full vertical field of view, and [i]aspect[/i] is the width-to-height aspect ratio of the view volume. At this particular depth [i]d[/i], the visible coordinate system range from -[i]width[/i] to[i] width[/i] in the horizontal direction, and from -[i]height[/i] to [i]height[/i] 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 [i]fov[/i] given the [i]width[/i] or [i]height[/i] instead. The two are linked by the [i]aspect[/i] parameter so they are effectively the same parameter.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this