• Announcements

Archived

This topic is now archived and is closed to further replies.

Not drawing what's not in the frustum

Recommended Posts

I have proper frustum detection implemented, and I set up a quadtree, but I''m sure exactly how to not draw what''s not in the viewing frustum. The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you''re the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."

Share on other sites
If by quadtree you mean a 2 dimensional collection of square spaces, each containing 4 smaller squares, recursevly so that objects can be stored in a quad, then what you do is clip the bounding quad at the highest level against your frustum, and if it is invisible, don't recurse into it. If it is visible, recurse into it and test the next four child quads. If they are visible, recurse into those, testing for them being visible. Do this to a certain depth at which you no longer need to test for visibility because the quads are small enough to satisfy your needs. Take all the quads that you determined are visible and draw every object that is stored within that quad. That way only the (roughly) visible objects get drawn.

In my engine all I did was break the world into a grid, and test the frustum against a box that has the dimensions of each grid cell. If that box was visible then I would draw everything in that grid element. If it wasn't visible I wouldn't bother. It was coarse, but it worked for me since my grid cells were not densly populated.

[edited by - Sphet on September 1, 2003 2:09:17 PM]

Share on other sites
I understand that, but I''m not sure how to tell the program specifically what series of triangles to draw. My vertex buffer is a 1-dimensional array. Say I draw the first large (128x128) quadrant, and then 3 smaller quadrants (32x32). I''d have somethign like this:

[]--------|--|--[]
[]--------|--[]

The ''|'' splits up the quadrants. So in a grid, I''d have something like start at (0, 0), draw until(192, 0) for the first row, then for the second, start at (0, 10), but only go until (160, 10).

The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you''re the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."

• Forum Statistics

• Total Topics
628278
• Total Posts
2981789

• 10
• 11
• 17
• 14
• 9