Sign in to follow this  
schupf

Drawing the view frustum

Recommended Posts

Hi, I want to visualize my quadtree algorithm, which I am using in my terrain. Therefore I want to do the following: 1. Preprocessing: Render the terrain from a top-down view (with orthographic projection) into a texture A. This texture stays the same the whole time. 2. Rendering (every frame): Set a texture B as rendertarget and render a vertex grid which fits to the real terrain vertex grid. Depending on the cull status of the patch a vertex belongs to, the vertex gets a green (visible) or red (patch culled) color (so I have to update the VB every frame - ouch?). In the pixel shader I just sample texture A and add the interpolated color to it. So I get a bird's eye view of my terrain where culled patches are red. I also want to draw the edges of the camera view frustum (with ID3DXLine or something similar, I dont know yet), but the problem is: it is possible that the view frustum is partially outside my terrain-map. Actually I just wanted to do the following every frame: calculate the positions of the 8 frustum corner points, transform these world x,z coordinates into clip space coordinates and connect the points with lines. But this doesn't work if some corner points are outside the map (and therefore outside my rendertarget texture). Do I really have to manually clip the frustum or is there a simpler way?

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