PDA

View Full Version : Scene organization in open area.



lgc_ustc
04-22-2004, 12:38 PM
Hi, everybody,

Well, this problem might be irrelative to OpenGL. If you guys thing it's really off-topic, feel free to delete it.I have been brooding on this issue for quite some time, but do not have any good idea yet.

It is: how to organize the objects effectively in an indoor/outdoor scene(for example, in a scene that appeared in the HL2's demo in E3). I often heard that indoor systems use BSPs(like Quake series), while for the outdoor systems OctTrees are more effective. But how things go in a mixture of indoor and outdoor? I think we might achieve that in the following way: let each building has a bounding box and a BSP tree, and divide the whole scene using OctTree, so that we can quickly determine which building should be drawn; after this step, we draw the building(s) using its BSP tree to speed up (also for collision detection). So this is a BSP/OctTree mixture solution. Is this feasible? Or anybody has better ideas? Any comments on this are very welcome!

Thanks in advance!

plasmonster
04-22-2004, 01:09 PM
Your idea is very interesting, and very doable. You can completely generalize the concept of a node in a tree, using c++ classes, and embed anything in it:

class node{
...
virtual void recurse();
...
};

class bsp_node : public node{
bsp_node* children[2];
void recurse() {...}
};

class octree_node : public node{
octree_node* children[8];
void recurse() {...}
};

and so on. It's really nothing more than a scene graph of sorts. I've been playing with this very idea for some time now. The trick is organizing the structures and data for convenient and efficient access and functionality.

An obvious problem with the setup above is that each class assumes the type at each node, which would in turn require casts to different node types. A workaround for this is to use the base node type for all children, and use an enum to identify the type. Yet another solution is to use the c++ typinfo functionality. There are lots of other solutions as well.

lgc_ustc
04-22-2004, 01:55 PM
Thanks for your reply, Portal:). I am interested in this since few materails talk about this, while the indoor/outdoor game scenes are more and more popular in nowadays games(HL2, Unreal, etc). I have seen so many games before with buildings which you can only watch from outside, but have no entrance for game players to enter and explore, which really reduces the realism. I guess the portal is a really good connector for indoor and outdoor systems.

plasmonster
04-22-2004, 02:17 PM
lgc_ustc, when you say outdoor/indoor your making a concrete distinction, and pointing to the crux of the problem. Say you want a huge LOD terrain, in addition to a complex bsp world; one big problem is connecting the terrain to the bsp. A bsp terrain is ok if it's small, but try it with a 2K x 2K height map, good luck. Anyway, you might be ok without such a connection for drawing, but when it comes to pathfinding, you're in deep.

By the way, you're right. This is off base for a gl forum, but awfully fun stuff to think about :)