Sign in to follow this  

Creating perspective view with X/Z FOV

This topic is 3590 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

I'm trying to create a perspective view with an FOV of 45 degrees along the X or Z axis; NOT the Y axis. My problem is that D3DXMatrixPerspectiveFovLH takes a FOV parameter for the Y axis, and I'm having a great deal of difficulty of converting my FOV in the X/Z axis to a FOV in the Y axis that I can pass in. I've tried a number of different methods (such as "fovy = fovx / aspect"), but nothing seems to get me the result I'm looking for. I have a camera set up in the center of a box, and the corners of the box should be exactly at the left and right sides of my screen. What's the best way to do this? Thanks!

Share this post


Link to post
Share on other sites
It sounds like the box is really a cube, right? (to make the corners of the box to be at the sides of the screen for both x and z directions)

The field of view from the center of a cube to the corners is 90 degrees, not 45. Your eyept would have to be at the back wall of a cube for the front corners to be 45 degrees apart ( 22.5 degrees to either side ).

If your eyept is at the back wall (to get a 45 deg fov along x-z axes), the y angle is 2*atan( h/(2*w) ) where h is the height of the screen and w is the width. If your aspect is w/h, then y-angle = 2*atan(1/(2*aspect)).

Does that help?

Share this post


Link to post
Share on other sites

This topic is 3590 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.

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