# Creating perspective view with X/Z FOV

This topic is 3902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 on other sites
Oops, you're right :) I did mean 90 degrees.

Anyway, yes! This is working perfectly now! Thanks so much!

1. 1
Rutin
47
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 16
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633003
• Total Posts
3009844
• ### Who's Online (See full list)

There are no registered users currently online

×