For those of you that don’t know, BSP stands for Binary Space Partitioning. Game engines often utilize this to make complex game levels because BSP collisions are incredibly efficient. Source, Unreal, and Torque3D all use BSP. Why not for Unity?
Well they use PhysX from NVidia. BSP’s were I think first used in Doom, not sure about Wolfenstein, but that was like 20 years ago. They also have some limitations - the main one I can think of is that they can only really be used for fixed geometry that doesn’t move, which would be like static colliders
in Unity, which PhysX has other optimizations for. There are probably other advantages to PhysX over BSP and part of that is probably the ease of implementing it into Unity versus writing/managing their own physics system. Also in BSP’s they tended to be used to represent where the walls are, as part of the rendering system, and not just for collisions. Nowadays it’s simpler to let the hardware just process tonnes of random triangles which is probably more dynamic and flexible. Anyone else know why BSPs would be used in those other engines?
Wolf3D didn’t use BSP, it was grid-based.
Source uses BSP because GoldSrc used BSP because GoldSrc was based on Quake for which BSP was the most efficient choice at the time. Simple geometry based around big planar surfaces - that’s where BSP excels. It’s not so good when you want to start using more organic or otherwise detailed meshes (hence engines like Source having whole other systems for doing ‘detail objects’ and displacement and so on).
I think Unreal uses it for similar legacy reasons - they’ve built up a toolset and methodology around it now and even though other approaches might be better now it’s just not worth the cost of changing all that.
But BSP’s just a technique for indexing a geometry database. The engine could be using octrees, kd-trees, AABB-trees, or something else instead. BSP is usually not appropriate for non-architecture-based games, of which there are a lot of Unity (particularly on mobile).
Now, if you’re saying BSP but what you actually mean is CSG, then that is supported via third-party plugins such as ProBuilder and GameDraw. Unity don’t provide any built-in mesh creation tools directly inside Unity though because 3DSMax/Maya/Blender already exist so it’s better for the Unity engineers to focus their time on stuff that they can do better than anyone else.
BSP is an optimization.
It was used in the old days, but now it’s irrelevent most of the time.
BSP was used to display polygon only visible in the view frustrum. Very efficient 10 years ago when 3D graphic cards were bad.
BSP need power on the cpu ( find what is visible), to lower the need of 3D render (less polygons to render)
On modern game with modern Hardware, most game need more of CPU power than GPU for the renderer.
GPU draw a enourmous amount of polygon now. And the power it’s necessary to avoid drawing a few of them, isn’t worth it.
Actually BSP render system are slower than brute force system on modern hardware (GPU already skip most unseen polygon with internal system)
Modern engine use portal instead. We didn’t try to get the list of visible polygon, we try to get the list of visible “room” or level chunk.
We skip big amount of polygon with a low CPU consumption.
In Doom 3 they simply supress BSP on the render engine.
We don’t have Physics acceleration card in every PC, that’s probably why they keep the bsp system for collision in Doom3.
Still physiX have a good reputation, and they probably use the best existing technique available.
Unreal and Torque3D probably use BSP because they didn’t touch it for some years
BSP is still faster if you want to do magical things like raytracing your sound or something, but I wouldn’t want the workflow hit. Working with BSP data is a lot slower for production and very limiting in the forms you can use. Bit of a disaster for smaller teams in today’s climate. It still has very valid uses. It’s probably faster than umbra.
BSP isn’t just for drawing, it’s for deciding what should be drawn as well. The typical approach where it’s still sometimes used in unreal, is you will block out the level with BSP walls and floors, then populate with detail meshes. The detail meshes are expensive, have lod and so on, but they’re easily culled out with this system.
But as others have said, its probably a bit old hat now. It still has niche uses where it’s the best thing to use, but niche means it’s better to invest in other solutions in the long term.
Also BSP makes especially sense for indoor first person or over-shoulder camera games. That’s what those other engines are made for. For Unity as a general purpose engine it’s not that useful.
Thanks for all your replies!
There are lots of BSP-esq editors in that asset store if what your asking is why can’t you edit like with Hammer, Worldcraft, or UDK.
Correct me if I am wrong here…
But BSP refers to a very specific algorithm on cutting up geometry into structure that can be traversed to find visibility of surfaces in interior game levels through a very simple algorithm. It is not necessarily a quadtree. BSP systems were used primarily for determining visibility in very low speed, low memory systems. Which did speed up collision but it’s speed up of collision was really a side-effect to it just speeding up what geometry to draw, if you know what geometry a player can see you then only draw that geometry, but you can also only test collision on that geometry as well for speed.
This was really important when the difference between 200 and 2000 quads being draw was significant. It was also highly relevant back in the day when most games were interiors only. But not anymore. A 200 quad mesh vs a 2000 quad mesh is now negligible in drawing time, everything now also has to handle massive outdoor scenes. So chopping up that 2000 quad mesh into smaller chunks to determine visibility requires alot more overhead then just testing visibility on the entire mesh and drawing, or not drawing, the entire thing. If you have a 1 mile by 1 mile chunk of terrain with meshes all over it, the BSP structure of cutting up all those meshes based on visibility would be freaking massive, not to mention it could easily add 16 times as many vertices due to all the various angles of visibility you can have from rolling terrain. If you ever tried to make massive rolling terrain back in the quake or half-life days out of BSP geometry you know that it was pretty damn ridiculous how the BSP algorithm would cut up your geometry.
This is why a system like umbra is used now, and is far better. It places all the mesh data into a quad tree like structure (I believe, again correct me if I’m wrong) it then does visibility calculation through traversing the entire quadtree structure to determine if a mesh in it’s entirety should be drawn or not drawn. This results in a far smaller visibility data structure, and it also doesn’t require your meshes to be cut up.
And again, correct me if I am wrong. I am just typing this out to express my current understanding and would actually hope someone can refine it if I am wrong. But I do think unity’s collision detection does internally organize itself into a quadtree structure as well. This is preferable for alot of the same reasons. It’s just smarter and more efficient for handling massive outdoor scenes.
It’s in no way specific to visibility. That was just one of the major things that motivated its use originally.
A BSP tree is simply a spatial index: every interior node in the tree divides space into the part that is ‘in front of’ the node and the part that is ‘behind’ the node. So, each leaf is a convex volume (assuming that the leaf is fully bounded), and tracing a path from a leaf back up to the root of the tree gives you all the ‘edges’ of that volume. If you used your render polygons to construct the interior nodes then your ‘edges’ become the PVS (or at least you get a mixture of polys and portals).
It’s not at all a quadtree. The clue is in the name: BSP tree nodes only have two children (i.e. binary) while quadtree nodes have four (i.e. quad).
PVS != PCS in general, but with frustum culling taken out of the picture then that’s kinda true. It’s not the main way that BSP trees benefit collision though, because you often need to do collision with things other than the player anyway.
Well, BSP doesn’t have to split geometry. It’s just splitting space. You could have a BSP tree with planes picked such that the planes never intersect any of the detail meshes, and then use that to quickly find out which detail meshes are ‘near’ the player for some reason.
Octree, not quadtree.
Well it uses what PhysX uses, which I believe is whatever OPCODE provides, which I believe is AABB-trees.
Excuse my ignorance, but what exactly is BSP? I tried googling it, but I the best I can get is that BSP is the ultimate in the process of elimination. Is that right, or can someone translate it to English for me?