Sign in to follow this  
kavitha

camera rotation problem !!

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
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

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