Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 93 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: Sat Jan 16, 2010 2:13 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
The first version of btInternalEdgeUtility has been added in the Bullet svn repository. This helps avoid/reduce collisions with internal edges, see also description here: http://code.google.com/p/bullet/issues/detail?id=27

Right now it still uses a contact added callback, but once the utility has been tested properly we can integrated it more tightly. There is a preprocessor code included.
See a modified ConcaveDemo as example code attached to also http://code.google.com/p/bullet/issues/detail?id=27#c15
In this demo you can press 'n' to disable the utility, to see the cube hitting the internal edges.

Initialization:
Code:
btBvhTriangleMeshShape* trimeshShape = ...;
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
//now you can adjust some thresholds in triangleInfoMap  if needed.

//btGenerateInternalEdgeInfo fills in the btTriangleInfoMap and stores it as a user pointer of trimeshShape (trimeshShape->setUserPointer(triangleInfoMap))
btGenerateInternalEdgeInfo(trimeshShape,triangleInfoMap);

At run-time:
Code:
static bool CustomMaterialCombinerCallback(btManifoldPoint& cp,   const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{

///make sure colObj0 is the triangle mesh

   if (enable)
   {
      btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
   }
}


The code is a bit complicated, because we tried to make it work with arbitrary double-sided triangle meshes.

Feedback is welcome,
Thanks,
Erwin


Top
 Profile  
 
PostPosted: Sat Jan 16, 2010 3:29 am 
Offline

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
Looks nice, I will try and find time to have a go this weekend, if not next weekend.

Any idea how slow the preprocessing step is compared to other overheads like building the bvh?


Top
 Profile  
 
PostPosted: Sat Jan 16, 2010 3:50 am 
Offline

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
By the way I added 3 new patches to the issue tracker

http://code.google.com/p/bullet/issues/detail?id=330
http://code.google.com/p/bullet/issues/detail?id=331
http://code.google.com/p/bullet/issues/detail?id=332

Can you at least apply 330 before it rots as it is just some trivial and harmless fixes for gcc warnings


Top
 Profile  
 
PostPosted: Sat Jan 16, 2010 6:01 am 
Offline

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
I tried it, at first I got the two collision objects the wrong way round (oops) and of course the bumps were still there.

Once I sorted that out, it worked rather well. It seems to be as smooth over the curvy surfaces as the conventional hack we all know and hate, but there were fewer weird behaviours on sharp edges. Exactly what you intended, basically. Nice job!


Top
 Profile  
 
PostPosted: Sat Jan 16, 2010 4:58 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
sparkprime wrote:
[...] it worked rather well. It seems to be as smooth over the curvy surfaces as the conventional hack we all know and hate, but there were fewer weird behaviours on sharp edges. Exactly what you intended, basically. Nice job!

I'm glad to hear it working well.

What are the remaining weird behaviours? Can you create a reproduction case in that modified ConcavePhysicsDemo.cpp?
Thanks!
Erwin


Top
 Profile  
 
PostPosted: Tue Jan 19, 2010 8:25 am 
Offline

Joined: Tue Jul 08, 2008 7:28 am
Posts: 16
Erwin Coumans wrote:
sparkprime wrote:
[...] it worked rather well. It seems to be as smooth over the curvy surfaces as the conventional hack we all know and hate, but there were fewer weird behaviours on sharp edges. Exactly what you intended, basically. Nice job!

I'm glad to hear it working well.

What are the remaining weird behaviours? Can you create a reproduction case in that modified ConcavePhysicsDemo.cpp?
Thanks!
Erwin


Great work, can i ask a stupid question? when I build a plane(as the land), and then divided it into several regions (mesh), according to the sample, an update mesh needs to be done(calculateAabbBruteForce & refitTree), but how to determine which mesh need to be updated?(when i update all the mesh,the cpu consume is quite a lot!) Is there any easy function can be used? when the scene is big, to determine the need for update of the mesh would be a trouble thing... ...


Top
 Profile  
 
PostPosted: Tue Jan 19, 2010 8:39 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
edl wrote:
Great work, can i ask a stupid question? when I build a plane(as the land), and then divided it into several regions (mesh), according to the sample, an update mesh needs to be done(calculateAabbBruteForce & refitTree), but how to determine which mesh need to be updated?(when i update all the mesh,the cpu consume is quite a lot!) Is there any easy function can be used? when the scene is big, to determine the need for update of the mesh would be a trouble thing... ...

Can you make the question more clear?

1) Bullet has no 'mesh', what do you mean by that? Did you mean a btBvhTriangleMeshShape?

2) why do you need to update the btBvhTriangleMeshShape at run-time? Do you want to deform some triangles at run-time?

3) What do you mean by 'update of the mesh' exactly? refitTree? Or do you want a faster / incremental version of btGenerateInternalEdgeInfo, only for the triangles that changed?
Thanks,
Erwin


Top
 Profile  
 
PostPosted: Tue Jan 19, 2010 9:53 am 
Offline

Joined: Tue Jul 08, 2008 7:28 am
Posts: 16
Erwin Coumans wrote:
edl wrote:
Great work, can i ask a stupid question? when I build a plane(as the land), and then divided it into several regions (mesh), according to the sample, an update mesh needs to be done(calculateAabbBruteForce & refitTree), but how to determine which mesh need to be updated?(when i update all the mesh,the cpu consume is quite a lot!) Is there any easy function can be used? when the scene is big, to determine the need for update of the mesh would be a trouble thing... ...

Can you make the question more clear?

1) Bullet has no 'mesh', what do you mean by that? Did you mean a btBvhTriangleMeshShape?

2) why do you need to update the btBvhTriangleMeshShape at run-time? Do you want to deform some triangles at run-time?

3) What do you mean by 'update of the mesh' exactly? refitTree? Or do you want a faster / incremental version of btGenerateInternalEdgeInfo, only for the triangles that changed?
Thanks,
Erwin


sorry for my poor words. i build the plane made of btBvhTriangleMeshShape, and make concave shape move on the btBvhTriangleMeshShape,i see the sample "ConcavePhysicsDemo.cpp" ,

it run
Code:
      trimeshShape->getMeshInterface()->calculateAabbBruteForce(aabbMin,aabbMax);
      trimeshShape->refitTree(aabbMin,aabbMax);

in the clientMoveAndDisplay(); function. it is in the displayCallback .i don't wan't to deform some triangles in run-time
my 'update of the mesh' means ,update the refitTree, i see the refitTree function has been call every frame,so i call it.

i am sorry, i just see that ,it only needed when it is a m_animatedMesh.....


Top
 Profile  
 
PostPosted: Tue Jan 19, 2010 2:49 pm 
Offline

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
Erwin Coumans wrote:
sparkprime wrote:
[...] it worked rather well. It seems to be as smooth over the curvy surfaces as the conventional hack we all know and hate, but there were fewer weird behaviours on sharp edges. Exactly what you intended, basically. Nice job!

I'm glad to hear it working well.

What are the remaining weird behaviours? Can you create a reproduction case in that modified ConcavePhysicsDemo.cpp?
Thanks!
Erwin


It's quite subtle, and probably not that important. What I do is spawn a cylinder on a 90 degree edge like in this video

http://www.youtube.com/watch?v=aQNiVzEWXD4

(the behaviour is no where near as severe as this anymore)

and then reset and compare the behaviour with/without the adjustment.

There are some cases when it's right on the edge (bearing in mind my cylinder spawn might be slightly penetrating the mesh) where without adjustment it sits neatly on the edge but with the adjustment it gets angry and falls off. I'll see if I can reproduce it somehow in the demo but it's an edge case (haha) so perhaps not a big deal. Making a wall shape and putting primitives along the top might be the way to do it.


Top
 Profile  
 
PostPosted: Tue Jan 19, 2010 5:41 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
sparkprime wrote:
It's quite subtle, and probably not that important. What I do is spawn a cylinder on a 90 degree edge like in this video

There are some cases when it's right on the edge (bearing in mind my cylinder spawn might be slightly penetrating the mesh) where without adjustment it sits neatly on the edge but with the adjustment it gets angry and falls off. I'll see if I can reproduce it somehow in the demo but it's an edge case (haha) so perhaps not a big deal. Making a wall shape and putting primitives along the top might be the way to do it.

The btInternalEdgeUtility is explicitly designed to deal with this case. If you can reproduce it, please share a repro case. This is an old video, can you create a video using the latest btInternalEdgeUtility code?
Quote:
Making a wall shape and putting primitives along the top might be the way to do it.

Such test is already part of the test demo.

How big is the cylinder and the triangles in the triangle mesh? Did you leave the collision margin for cylinder default to 0.04? And the collision margin of the static triangle mesh, btBvhTriangleMeshShape is default as zero? You left the default settings of btTriangleInfoMap in btInternalEdgeUtility as default?

Thanks,
Erwin


Top
 Profile  
 
PostPosted: Wed Jan 20, 2010 2:49 am 
Offline

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
I tried reproducing it and found the behaviour was only odd if the 'spawn' point of the cylinder made it penetrate the trimesh... Here is a new movie although it's not very clear. Please ignore the shadow and sky animation as I forgot to disable that animation while stepping the physics engine and taking the screenshot sequence.

http://www.youtube.com/watch?v=X2MlUVaFGqU

I put an explanation in the summary part of the video.

The trimesh margin is 0 yes, the cylinder is here http://gritengine.svn.sourceforge.net/v ... /Tyre.tcol

Anything not specified is the default value. The edge preprocessing stuff is all left to the defaults.

I had a look at the demo, I think by the time the shape reaches the edge of the wall, it is already 'stable' which is why this does not occur.


Top
 Profile  
 
PostPosted: Wed Jan 20, 2010 4:33 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
sparkprime wrote:
I tried reproducing it and found the behaviour was only odd if the 'spawn' point of the cylinder made it penetrate the trimesh....


Are you sure it is related to btInternalEdgeUtility /normal correction? So it doesn't happen when normal correction is switched off?
What is the collision margin of the cylinder? How deep is the penetration? Are you using split impulse?

More important: can you wrap up some C++ code to reproduce your issue, either a Bullet demo or perhaps using your engine (without requiring user input preferably),
Thanks,
Erwin


Top
 Profile  
 
PostPosted: Wed Jan 20, 2010 7:16 am 
Offline

Joined: Tue Jul 08, 2008 7:28 am
Posts: 16
Allow the car to slow run, until the car crash to the ground, at the rallying point of many triangles, car start shaking violently, this maybe a bug? it seems, cars suffer from a lot of impact force. :?

the ground is btBvhTriangleMeshShape,and the car is btConvexHullShape


Attachments:
-_-.JPG
-_-.JPG [ 52.07 KiB | Viewed 5838 times ]
Top
 Profile  
 
PostPosted: Wed Jan 20, 2010 2:38 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
edl wrote:
Allow the car to slow run, until the car crash to the ground, at the rallying point of many triangles, car start shaking violently, this maybe a bug? it seems, cars suffer from a lot of impact force. :?

the ground is btBvhTriangleMeshShape,and the car is btConvexHullShape


I assume this is also using the btInternalEdgeUtility, and not changing any of the default values (collision margins etc)?

Can any of you help provide the full source code to reproduce this issue, or re-create it in a Bullet demo?
Thanks,
Erwin


Top
 Profile  
 
PostPosted: Thu Jan 21, 2010 2:16 am 
Offline

Joined: Tue Jul 08, 2008 7:28 am
Posts: 16
Erwin Coumans wrote:
edl wrote:
Allow the car to slow run, until the car crash to the ground, at the rallying point of many triangles, car start shaking violently, this maybe a bug? it seems, cars suffer from a lot of impact force. :?

the ground is btBvhTriangleMeshShape,and the car is btConvexHullShape


I assume this is also using the btInternalEdgeUtility, and not changing any of the default values (collision margins etc)?

Can any of you help provide the full source code to reproduce this issue, or re-create it in a Bullet demo?
Thanks,
Erwin


yes ,i use btInternalEdgeUtility and not changing any of the default values (collision margins etc)
everything is default value

full source code maybe difficult,but i will try to give you a bullet demo...today or tomorrow...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 93 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group