Archived

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

Raeldor

Need Advice: One QuadTree, or Two?

Recommended Posts

Hi All, At the moment, I have a quadtree which I am using to perform view frustrum culling on my terrain. This seems to work very well. I am now at the stage of adding objects to the terrain. The question is... should I use the same quadtree and just attach the objects to the relevant tile which will then be rendered by the leaf of the quadtree when that tile is visible, or should I have a new quadtree especially for objects and do the culling and rendering seperately? Thanks Rael

Share this post


Link to post
Share on other sites
I think we are both doing the same work.

My Idea about this meshanism is in the favour of single QT(quad Tree) that saves both Terrain Mesh and list of objects. But the problem wil arise when multiple leaf contains the same object causing re-rendering those object per-frame.

My suggestion to prevent this slow down is to flag (say it m_visible)the object using a boolean type variable that should be updated per frame. As Soon AS an object is rendered this flag is set and when you encounter same object in the next leaf (thats gonna be rendered), you probably encounter same object but before rendering the object this time you (sorry we) first check that flag, if it is set skip rendering the object otherwise render it.

In the end of rendering pass, clear all flags, like

for( a=0; a<object.size(); ++a )
Object.m_visible = false;

But there should be Z-Buffer On for rendering correctly (possibly reducing performance), because the QT Leafs are never sorted w.r.t Camera Position (where as BSP solves this) so the subsequent leafs me occuld the objects that should'nt be occluded, m i right... now u reply in this forum to proceed and overcome this problem coz we r doing the same thing... Thanx

[edited by - maktal on August 10, 2003 12:01:09 PM]

Share this post


Link to post
Share on other sites
Because your objects size isen''t 0...
If an object is located on the seperating line between two (or four) cells, some of the object is in one cell and another part of the object is in another cell.

Best regards
Roquqkie

Share this post


Link to post
Share on other sites
I see. For my immediate concerns, I don''t think that will be so much of a problem since it is just a terrain editor, so some ''popping'' of objects onto the screen will not be that big of a deal.

However, do keep me posted on your solution since once I have finished my changes to the editor code, I will be going back and updating my game client and server code to render the objects where it will be more of an issue.

Thanks

Rael


Share this post


Link to post
Share on other sites