Jump to content
  • Advertisement
Sign in to follow this  
Bitem2k

Building Bsp/Octrees

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how i would go about combining multiple Mesh's with multiple vertex buffers into a single bsp/oct tree? i.e My level consists of many different meshes, for instance walls, floor, tables etc. All the examples i have found on the net have wanted a single list of polygons to build the tree from. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by 5MinuteGaming
How are you storing the Polygon data or face data from the Vertex buffers.


Hi thanks for replying.

At the moment im stuck and cannot procede until i know what im doing (to save time later if i chose the wrong solution.

As i stated before i intend to have multiple x files making up my world, but as of yet ive no idea how to implement it! Any ideas would be appreciated.


thanks

Share this post


Link to post
Share on other sites
What you could do is merge all vertex lists into one and keep an extra list with object IDs. That way you can assign vertices to proper nodes (assuming you are building an octree) and still know to which object they belong.

You should store the object IDs in the nodes as you will probably need them later on.

Share this post


Link to post
Share on other sites
Quote:
Original post by head_hunter
What you could do is merge all vertex lists into one and keep an extra list with object IDs. That way you can assign vertices to proper nodes (assuming you are building an octree) and still know to which object they belong.

You should store the object IDs in the nodes as you will probably need them later on.


That makes sence, but how would i go about creating the combined list?

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by Bitem2k

That makes sence, but how would i go about creating the combined list?

Thanks


Well, no fancy stuff there... the way I do it is concatenate all vertex lists into one. For example :

If Object1 consists of vertices v1, v2 and v3 and Object2 of vertices v4, v5 and v6, the final list will be : { v1, v2, v3, v4, v5, v6 } and the object ID list will be : { 1, 1, 1, 2, 2, 2 }.

Obviously, the object ID list will have elements which repeat themselves many times but there are lots of clever ways to "compress" it.

Share this post


Link to post
Share on other sites
Ok, Sorry to sound horrendously stupid here ( i have searched the internet long and hard for information on how to implement an octree )

so say i concentrate the objects vertex data into one list, what would the method that generates the octree look like?

The way i understood it was that the octree is generated by an arranged list of polygons. If i just add the vertices on to the end of the list will this work?

How does the algorithm know where to place the polygons in relation to the octree?

Thank you very much for helping me out as im close to pulling my hair out!

Share this post


Link to post
Share on other sites

One way..
Create one vertexbuffer full of all the vertices you want in the octree. At each child node (where gemoetry is stored) you can keep an indexbuffer or triangle list. Then you can use these to index into your global vertexbuffer for each visible child node.

Hope it helps

Share this post


Link to post
Share on other sites
If you haven't searched the Ultimate Game Programming website at http://www.ultimategameprogramming.com/, I would recommend their Octree tutorial to be found under the OpenGL section.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!