Jump to content
  • Advertisement
Sign in to follow this  
kavitha

camera rotation problem !!

This topic is 4977 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 all, I am looking to find the end points of the frustum created by the camera with a known horizontal and vertical field of view; the camera is centered at origin; to find the top right corner of the frustum, i created a rotation matrix with {-(0.5 * horizontal FOV), 0.5 * vertical FOV, 0.0f} (x is negative coz of right hand rule !!)and multiplied the vector 0.0, 0.0, 1.0 with this matrix to get the vector passing thru' the top right corner of the frustum from origin. basically i create a square with the obtained 4 corners of the frustum and render the same to validate the frustum corners. It seems the corners have a minor error on y values; (the obtained y values seems to be little high). I tested the output by reducing the x & y values by a small value to see the area of square being reduced and i could see a border of space between square and edges of the screen. how do i fix this error on y value? am sure this must be met by many here. help me out !! ~ kavitha

Share this post


Link to post
Share on other sites
Advertisement
Rotating is probably not what you want to do. That assumes that the length of an edge is 1, but I bet you intend the distance to the far plane to be 1, instead.

Getting the locations of the corners of the frustum is trivial. Suppose the horizontal and vertical FOVs are aH and aV and the distances to the far plane is f. Then (assuming the X axis is horizontal and the Y axis is vertical) the corners of the far plane are [ +/- f*tan(aH / 2), +/- f*tan(aV / 2) ]. Yes, it's that easy. If the frustum is rotated and/or translated, then just transform those points.

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!