Jump to content
  • Advertisement
Sign in to follow this  
asphodel

Quad that fills view frustrum

This topic is 5412 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

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?

Share this post


Link to post
Share on other sites
Advertisement
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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!