Archived

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

Sfpiano

Not drawing what's not in the frustum

Recommended Posts

Sfpiano    126
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 this post


Link to post
Share on other sites
Sphet    631
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 this post


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

Share this post


Link to post
Share on other sites