Quad that fills view frustrum

Started by
3 comments, last by AQ 19 years, 6 months ago
Anyone happen to know what needs to be done to get a quad to fill the entire frustrum at any given z value? What matrix do I need to play with to make it stay in the frustrum no matter where the camera is pointing? To be clear, I want the quad to scale to the size of frustrum so that it takes up the entire view, and I want to place that quad so it stays where the player is looking. I already know how to get the correct size of the quad using simple trig, but im not sure how to transform it to the correct position in space to always be in view. Any ideas?
Advertisement
You could render it as a transformed quad. Then all you need to do is specify its screen coordinates.
Alternately, you can use an Orthographic projection (D3DXMatrixOrtho, if I remember correctly). Basically, set the left, right, top, and bottom of the ortho projection to -1, 1, -1, and 1 respectively (maybe I have top/bottom reversed, I can't remember that, either), and make the quad use that same range.

That should accomplish the trick :)
Alright, I'll bite on using an orthogonal projection. How would I normalize the coords like you mention? D3DXMatrixOrthoLH takes in screen coords if I'm not mistaken, I'd rather not be resolution dependent.
Compute your quad in camera space .. that way, its eye-space z-coordinate will determine the placement .. then transform using your world matrix to place it in world corerctly!
Count your blessings before you count your problems.www.wiu.edu/users/muaiq

This topic is closed to new replies.

Advertisement