Building Bsp/Octrees

Started by
9 comments, last by Bitem2k 18 years, 8 months ago
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.
Advertisement
How are you storing the Polygon data or face data from the Vertex buffers.
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
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.
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

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.
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!

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
Im so very stuck, that im going to be forced to purchase many books!

thanks for your help though.

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.

This topic is closed to new replies.

Advertisement