Plane brushes with Bullet?
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
Plane brushes with Bullet?
Hi,
Quake 3 BSP files store the collision detection in brushes, which are just a couple of planes forming a convex volume.
Is there a collision shape suitable for such a brush? I didnt find anything in the doxygen reference that fits.
Quake 3 BSP files store the collision detection in brushes, which are just a couple of planes forming a convex volume.
Is there a collision shape suitable for such a brush? I didnt find anything in the doxygen reference that fits.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Plane brushes with Bullet?
Yes, you can represent each convex brush as a btConvexHullShape, by converting the plane equations into a convex point cloud.
Bullet provides a utility in LinearMath/btGeometryUtil to make this easy:
There is a demo in Bullet/Demos/BspDemo that loads a Quake 3 BSP, and lets you shoot boxes against those brushes.
Erwin
Bullet provides a utility in LinearMath/btGeometryUtil to make this easy:
Code: Select all
class btGeometryUtil
{
public:
static void getPlaneEquationsFromVertices(btAlignedObjectArray<btVector3>& vertices, btAlignedObjectArray<btVector3>& planeEquationsOut );
static void getVerticesFromPlaneEquations(const btAlignedObjectArray<btVector3>& planeEquations , btAlignedObjectArray<btVector3>& verticesOut );
static bool isInside(const btAlignedObjectArray<btVector3>& vertices, const btVector3& planeNormal, btScalar margin);
static bool isPointInsidePlanes(const btAlignedObjectArray<btVector3>& planeEquations, const btVector3& point, btScalar margin);
static bool areVerticesBehindPlane(const btVector3& planeNormal, const btAlignedObjectArray<btVector3>& vertices, btScalar margin);
};
Erwin
dv_ wrote:Hi,
Quake 3 BSP files store the collision detection in brushes, which are just a couple of planes forming a convex volume.
Is there a collision shape suitable for such a brush? I didnt find anything in the doxygen reference that fits.
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
Ah, thanks, tried out the demo.
But I noticed that with complex maps the demo has serious performance issues. As an example, try this map out: http://lvlworld.com/readme.php?t=t8dm6 or this one: http://lvlworld.com/readme.php?t=pn03 . Especially in the latter case the demo slows down to a crawl. Any suggestions? I guess one is not supposed to send many small convex hulls to bullet, right? (t8dm6 has 1876 brushes, pn03 has even 2265!)
But I noticed that with complex maps the demo has serious performance issues. As an example, try this map out: http://lvlworld.com/readme.php?t=t8dm6 or this one: http://lvlworld.com/readme.php?t=pn03 . Especially in the latter case the demo slows down to a crawl. Any suggestions? I guess one is not supposed to send many small convex hulls to bullet, right? (t8dm6 has 1876 brushes, pn03 has even 2265!)
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
A few thousand static convex objects should be no problem, so it's probably a graphics/rendering issue. I will check out your maps later.
Can you press 'p' and see where the performance it going?
Thanks,
Erwin
Can you press 'p' and see where the performance it going?
Thanks,
Erwin
dv_ wrote:Ah, thanks, tried out the demo.
But I noticed that with complex maps the demo has serious performance issues. As an example, try this map out: http://lvlworld.com/readme.php?t=t8dm6 or this one: http://lvlworld.com/readme.php?t=pn03 . Especially in the latter case the demo slows down to a crawl. Any suggestions? I guess one is not supposed to send many small convex hulls to bullet, right? (t8dm6 has 1876 brushes, pn03 has even 2265!)
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
I commented out the line drawing block (GL_ShapeDrawer.cpp:406) so that the hulls are not drawn - its still very slow.
Lookin at the profiling results there is a considerable increase. performDiscreteCollisionDetection and updateAabbs are at 0.04 - 0.05, whereas other maps with about ~200 brushes give me numbers at 0.003. Anyway, here are the csvs: http://dv.dword.org/stuff/results-csv.zip
(redm08 is a map with 208 brushes).
Lookin at the profiling results there is a considerable increase. performDiscreteCollisionDetection and updateAabbs are at 0.04 - 0.05, whereas other maps with about ~200 brushes give me numbers at 0.003. Anyway, here are the csvs: http://dv.dword.org/stuff/results-csv.zip
(redm08 is a map with 208 brushes).
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
On my Macbook Pro the T8DM6 bsp level has a discrete collision detection time of 0.002607 with some boxes spawned.
What kind of machine are you running this under?
Which version of Bullet?
CPU type/clockspeed?
Operating system, compiler, build system?
Is the performance slow, even if you don't add any boxes?
Did you make any changes to the BspDemo ?
Did you make sure it is release mode, not debug?
Thanks for the feedback,
Erwin
What kind of machine are you running this under?
Which version of Bullet?
CPU type/clockspeed?
Operating system, compiler, build system?
Is the performance slow, even if you don't add any boxes?
Did you make any changes to the BspDemo ?
Did you make sure it is release mode, not debug?
Thanks for the feedback,
Erwin
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
Oh, never mind. I added these lines to CMakeLists.txt:
and now bullet is compiled with -O3 -DNDEBUG.
Now I get 0.0007 for both updateAabbs and the discrete collisions in redm08, and 0.008 - 0.01 for pn03, 0.004 for T8dm6. This stays quite constant, even after firing over 20 boxes.
I am using Ubuntu on a Pentium4 2.4GHz HT with 1 GB RAM, gcc 4.1.2, Bullet 2.42b. Other than commenting out the GL_LINES part out I didn't change anything.
Code: Select all
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF (NOT CMAKE_BUILD_TYPE)
Now I get 0.0007 for both updateAabbs and the discrete collisions in redm08, and 0.008 - 0.01 for pn03, 0.004 for T8dm6. This stays quite constant, even after firing over 20 boxes.
I am using Ubuntu on a Pentium4 2.4GHz HT with 1 GB RAM, gcc 4.1.2, Bullet 2.42b. Other than commenting out the GL_LINES part out I didn't change anything.
-
- Posts: 6
- Joined: Wed Jan 10, 2007 12:08 am
How about 6000? With -O3 and -NDEBUG, I get bad results using http://lvlworld.com/readme.php?t=chartres . Again, updating the AABBs and performing the discrete collision detection are bottlenecks, both using 0.012 time. Overall I get stuttering movement, whereas motion is very smooth with simpler maps. Since the maps I'm using can be as complex as chartres (brush-wise, not graphics-wise) this is of interest to me.Erwin Coumans wrote:A few thousand static convex objects should be no problem, so it's probably a graphics/rendering issue.
-
- Posts: 4
- Joined: Thu Feb 22, 2007 3:17 pm
Hei,
I've got the same problem.
Performance decrease very quickly when i add some convex shape inside a bsp level. My software is running 60fps with no sphere, and falls to 15fps with only 10 spheres !
My level is about 3000 brushes.
The display doesn't affect these results.
Haven't searched yet where exactly is the problem (just know it's related to bullet), I will seek further in the next days, but if you've got an idea...
I've got the same problem.
Performance decrease very quickly when i add some convex shape inside a bsp level. My software is running 60fps with no sphere, and falls to 15fps with only 10 spheres !
My level is about 3000 brushes.
The display doesn't affect these results.
Haven't searched yet where exactly is the problem (just know it's related to bullet), I will seek further in the next days, but if you've got an idea...
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
-
- Posts: 4
- Joined: Thu Feb 22, 2007 3:17 pm
Yes, an AABB tree will certainly help a lot !
Here you can find the 3000 brushes bsp map : http://zescript.free.fr/download/urban.zip
Here you can find the 3000 brushes bsp map : http://zescript.free.fr/download/urban.zip
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
-
- Posts: 4
- Joined: Thu Feb 22, 2007 3:17 pm
OK, thank you for the release !
I haven't tested yet into the same level, but it seems better.
Also, I mainly use shapes without contact response (to make some phantoms or triggers, and control myself the way they react).
In the bullet code, no island is computed for this kind of shapes, so I changed that, and it's really better.
thx,
greg
I haven't tested yet into the same level, but it seems better.
Also, I mainly use shapes without contact response (to make some phantoms or triggers, and control myself the way they react).
In the bullet code, no island is computed for this kind of shapes, so I changed that, and it's really better.
thx,
greg
-
- Posts: 4
- Joined: Thu Nov 15, 2007 8:25 pm
Re: Plane brushes with Bullet?
I was investigating some unexpected performance issues in a level consisting of many static RBs and a single dynamic.
I am using btDiscreteDynamicsWorld.
As far as I can tell, the AABBs of all objects in the scene ( static and dynamic ) are queried, transformed and fed to the broadphase twice each substep.
Once in btDiscreteDynamicsWorld::updateAabbs() and another time in btCollisionWorld::performDiscreteCollisionDetection().
Is this intentional or have I set up my statics incorrectly somehow to trigger this updating?
Thanks
/Peter
I am using btDiscreteDynamicsWorld.
As far as I can tell, the AABBs of all objects in the scene ( static and dynamic ) are queried, transformed and fed to the broadphase twice each substep.
Once in btDiscreteDynamicsWorld::updateAabbs() and another time in btCollisionWorld::performDiscreteCollisionDetection().
Is this intentional or have I set up my statics incorrectly somehow to trigger this updating?
Thanks
/Peter