Horde3D

Next-Generation Graphics Engine
It is currently 24.11.2024, 19:17

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: BSP tree scenemanagement
PostPosted: 31.12.2009, 19:36 
Offline

Joined: 30.09.2009, 17:41
Posts: 6
Hey there,
i especially like Horde3D because of its simplicity (as compared to Ogre and Irrlicht, the engines i used before) and its .NET Wrapper (which is my main point for choosing Horde3d). I thought about using it for my future projects. The only thing i'm not yet so sure about is if it really fits.
As the topic of the thread allready suggests, my main concern is the scenemanagement. As main world geometry i wanted to use Q3 .BSP files, cause the friend i'm doin this project with is allready quite confident with the Radiant tools. But Horde hasn't got any BSP-tree-scenemangement implemented. I once wrote a small program just to render these BSP files based on OpenGL, but i never optimized it for performance cause that would take quite long especially if you also want to implement fast collision tests and scenemanagement.
So i thought about either converting the BSP to Horde's preferred format and load that single mesh or loading every single leaf into a Horde3D node and hope that Horde3D can cope with that.

What do you think is one of the two approaches realiseable without a huge performance hit (compared to the .Net <-> c++ perf. hit)? I personally don't know enough about the H3D interna (yet) to answer the question by myself so i'm asking you and hope that you don't mind ;)

greetz and thx in advance r2


Top
 Profile  
Reply with quote  
PostPosted: 01.01.2010, 21:44 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Hi, BSP trees are an ancient structure and not often used for culling any more these days. They worked well for a small number of larger polygons ("walls") and but for complex scenes with tens/hundreds of thousands of tiny triangles and huge batches in vertex buffers, other techniques like occlusion culling, a sector/portal system and octrees are more useful.

I would try to convert the whole level directly to meshes batched by material. Considering that quake 3 is 10 years old now, I'm quite sure you could render a whole q3 level without any culling at all. But you need to try it out to get the ultimate answer ;)


Top
 Profile  
Reply with quote  
PostPosted: 01.01.2010, 21:58 
Offline

Joined: 30.09.2009, 17:41
Posts: 6
Ok, i also thought about using a quad- or octree-based approach but since i would need to then take care of dividing the geometry by myself and putting them into the specific sectors i didn't like that solution that much ^^ but i think with a bit of reading that could be accomplished.
Occlusion culling? I heard about that technique and basically know what it is but i don't think that i am able to implement something like that and i am not so sure how i then should do the collision stuff. Using a quadtree based approach doing "optimized" collision testing is more or less easy.


Top
 Profile  
Reply with quote  
PostPosted: 01.01.2010, 23:18 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Of course you could use the BSP tree and the PVS information stored in the compiled q3 levels. But then you will really write a quake specific scene manager which probably can't be used for much else. Depends on what you want to do.

Regarding occlusion culling, horde already has support for hardware occlusion queries.


Top
 Profile  
Reply with quote  
PostPosted: 01.01.2010, 23:35 
Offline

Joined: 30.09.2009, 17:41
Posts: 6
If i understand that right, the occlusion culling Horde3D is on a per SceneNode basis isn't it? So it would be kinda useless converting the existing geometry to a more or less huge model.

Yeah that's right, using the BSP tree would be really kinda specific, perhaps trying to implement a Quadtree and combining that with occlusion queries would be nice.


Top
 Profile  
Reply with quote  
PostPosted: 02.01.2010, 20:14 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Solely different models can be occluded, a mesh of a model can't occlude another mesh of the same model. This restriction could be relaxed but the common use case is that a world is composed of many individual models (you build your model asset in a DCC tool and place it in the scene with a special world editor like the horde editor).


Top
 Profile  
Reply with quote  
PostPosted: 02.01.2010, 21:29 
Offline

Joined: 30.09.2009, 17:41
Posts: 6
Ah ok, then i'll implement a new scene node to render my scene (Q3 BSP). I allready had a look into the terrain scene node and the way Horde3D handles that stuff seems pretty nice :)
The only thing i am not so sure about are the textures cause different leafes of the BSP tree may have different materials. I could try putting all the textures needed into one huge texture and alter the texture coordinates. This would save me quite some render state changes but i think it's nearly impossible (or only possible on high end systems) to create such a huge texture.
So i think i have to load several different materials for this single scenenode, but i am not sure if Horde allows using several different textures inside one single scenenode. Is it possible to load several different textures/materials inside one single scenenode and use them for rendering?
The only other possibility i could think of accomplishing the task of rendering BSPs inside Horde is to make a scenenode out of every single leaf but i think that this will hit the performance very badly.


Top
 Profile  
Reply with quote  
PostPosted: 05.01.2010, 01:04 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
If you implement your own scene node, you can use as many textures as you like. You also have to provide a rendering function though.


Top
 Profile  
Reply with quote  
PostPosted: 28.01.2010, 21:39 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
My question is if someone were to take the time to break up the level geometry into a quad/octree, how could that structure be fed into Horde as is? Meaning no extensions and using the regular scene node management functions.


Top
 Profile  
Reply with quote  
PostPosted: 29.01.2010, 00:38 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
You can use horde's group nodes to group together the objects belonging to each "leaf" of the tree (BSP/Oct/Quad/whatever). You can then then implement PVS (etc) in your application, and use the results to activate/deactivate these group nodes.

I did something like this in my "race of death" Horde demo, but the leaf nodes and the PVS data was all created by hand.


Top
 Profile  
Reply with quote  
PostPosted: 30.01.2010, 15:42 
Offline

Joined: 30.09.2009, 17:41
Posts: 6
I just started developing a Q3-BSP extension for Horde. Currently there is just one thing i am wondering about. When and where should i load the .bsp file to stay consistent with the way Horde works. I would supply the name of the .bsp file to load in the attribs of the scene file and then i would simply load the .bsp file by using fopen or sthg like this in the constructor (or to be more exact in one of the functions the constructor calls, e.g. "updateBSPData") of the BSPNode.
I also thought about implementing a new resource type but i am not sure if that's the way Horde wants it to be handled.


Top
 Profile  
Reply with quote  
PostPosted: 31.01.2010, 03:49 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
Horde itself never actually loads any files from the HDD - it leaves that up to the user, by letting the user ask which resources need to be loaded.
So yeah, the most "horde like" solution would probably to create a BSP resource, which is used by your BSPNode. This way the user will automatically load the BSP file for you.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group