Forum > Miscellaneous

BSP Tree (WMO)

<< < (2/3) > >>

schlumpf:
I would add it to both.

Gamh:

--- Quote from: "schlumpf" ---As indicated with 1) and 4), I wouldn't even start with properly cutting but rather just do a one-node "tree" that has just a leaf node with all faces. It might work quite well.
--- End quote ---

I second that, especially if your model is small enough (a small house, a rock, etc). For bigger models, you will have problems at some point, I don't remember what the threshold is exactly, but collisions will start to misbehave.

If you really want to generate your own, here are BSP tree generators I coded a while ago with Tharo, if you can shift through the awful style : C++ and Python. They aren't perfect because they do not check if a triangle goes through a node without having vertices in it; it then has no collision. This can happen when there are "stretched triangles", with one vertex being far from the two others.

abdalrahman9:
Thank you Gamh, hopefully this will help me in writing my own bsp tree. I appreciate it!!

abdalrahman9:
I have another question, now we know that the first plane's distance is based on the origin (0,0,0). However, what of the second cut/plane? Is it's reference on the position of the new plane or still the origin (0,0,0)? The wiki states that the reference changes with the plane but i am not sure if that is the case. I am using the WestFallLightHouse.wmo as my test wmo because it has only one group. When i tried creating the bsp planes in 3ds max it seemed that the plane's distances were based on (0,0,0) though i only did the first couple. Yet, there are those that have the same distance with the same plane type which is very weird. An example is nodes 7 and 8 which are both plane types 0 and distance of 6. The only difference between them is the children. Why would they create two planes/cuts in the same place but then have different children? Does this mean the distance is based on the parent plane or am i just not understanding something?

Gamh:

--- Quote from: "abdalrahman9" ---Does this mean the distance is based on the parent plane or am i just not understanding something?
--- End quote ---

No I think you're right, the fDist value is relative to the parent node, or maybe from (0, 0, 0). The wiki explains that better than me:


--- Quote ---fDist is where split plane locates based on planetype, ex, you have a planetype 0 (YZ-plane) and fDist 15, so the split plane is located at offset ( 15, 0, 0 ) with Normal as ( 1, 0, 0 ), I think the offset is relative to current node's bounding box center. The BSP root ( ie. node 0 )'s bounding box is the WMO's boundingbox, then you subdivide it with plane and fdist, then you got two children with two bounding box, and so on. you got the whole BSP tree.
--- End quote ---

Also fun fact, despite being a float fDist is always an integer value.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version