Archived

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

Ainokea

opengl vs. octrees and bsp trees

Recommended Posts

Ainokea    435
Opengl doesnt draw stuff if you dont see it (when you tell it not to ofcourse) and if that works why would you want to implement a bsp tree or octree etc. etc.?

Share this post


Link to post
Share on other sites
leiavoia    960
well... drawing things out of view still wastes time sending the data to openGL and then letting it decide to draw it or not. I think it''d be faster to decide that before you even put that data together. Try drawing 100,000 quads off the screen and see if your screenrate takes a dive

trees are usefull for many other things though. I use a quadtree for collision detection.

Share this post


Link to post
Share on other sites
GroZZleR    820
I''m pretty sure thats not true at all. It won''t draw things not in your near and far clipping planes, but that doesn''t mean it doesn''t draw things you can''t see.

As an example, draw a million quads in descending (or is it ascending with OpenGL?) z values straight on from the camera.

Those quads are blocked by eachother, but OpenGL will still draw them. Thats why Occlusion algorithms exist (read up on those).

Also Frustum checks (checks if something is in your viewing planes) are essential.

And as stated, Octrees and Quadtrees are also great for collision detection among other things.

Share this post


Link to post
Share on other sites
fooman    122
i think your mainly talking about the frustrumculling / occlusionculling. well... opengl needs to handle the data you give him. if you exclude 60-70% of the scene by frustrumculling on your bsp/octree, you dont need to handle it with opengl. The fun starts here, where you know, that bsp/octree starts with a very low number of nodes, spliting in more and more of them. if you can exclude one of the big nodes, you dont need to check the smaller ones. opengl checks every polygon! if you see, that a node is completely in scene, you render it, if you see, a piece of it is in scene, you check the childnodes... Like I mentioned, the trick is checking least possible data, to be really fast! same is for exclusionculling, which could be preformed (if one is willing to do so) much easyer, if you just start the same top-to-bottom check, as in frustrumculling (just with the remainers of the frustum...).

Share this post


Link to post
Share on other sites