camera rotation problem !!

Started by
0 comments, last by JohnBolton 19 years, 4 months ago
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
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.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!

This topic is closed to new replies.

Advertisement