jjfreedman / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Patch proposal: Tetrahedron splitting support in btSoftBody::refine #556

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

in the simulator we're working, we use Bullet for simulating volumetric soft 
bodies, as well as rigid bodies. 
My colleague Davide Zerbato noticed how the refine method wasn't refining the 
tetrahedra, so he wrote that part himself.

I don't know what kind of process I should follow to submit a patch, especially 
since it looks like something is still not right. The attached demo shows how 
the soft body is cut and refined correctly, but after the cut the dynamics of 
the two "pieces" of soft body appear to still be coupled.

I hope we'll be able to get feedback with this, and in the end integrate this 
feature into the btSoftBody class.

Attached is the patch made by my colleague Davide Zerbato, all the credit of 
course goes to him. 

To apply the patch use:

`patch -p0 -i refine-tetras.patch'

from the root directory of the Bullet source.

Original issue reported on code.google.com by elvezz...@gmail.com on 13 Oct 2011 at 11:49

Attachments:

GoogleCodeExporter commented 8 years ago
Never mind for the "coupling" issue, the demo only creates a single cluster for 
collision detection, no wonder things don't look right...

Anyway, the results look good for us, is really nobody interested?

Original comment by elvezz...@gmail.com on 17 Oct 2011 at 2:48

GoogleCodeExporter commented 8 years ago
Submitting a patch here is the right way to get code into Bullet. You might 
want to discuss it also in the Bullet physics forums (http://bulletphysics.org) 
to see if others are interested.

I have no time to look at it right now, but try to check it out soon.

Thanks for the contribution!
Erwin

Original comment by erwin.coumans on 17 Oct 2011 at 3:33

GoogleCodeExporter commented 8 years ago
Hi Erwin,

thanks for the reply, I understand you must be busy. We really appreciate it.

I already posted about this on the forum, here is the link: 

http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7520

Original comment by elvezz...@gmail.com on 18 Oct 2011 at 8:10

GoogleCodeExporter commented 8 years ago
I'm going to apply the patch before upcoming release. Sorry for the long delay.

We have been doing a lot of research on GPU physics
(https://github.com/erwincoumans/experiments/downloads)

Original comment by erwin.coumans on 29 Feb 2012 at 5:07

GoogleCodeExporter commented 8 years ago
Cool!

I think I should point out that since then, Davide has done a lot of work on 
post-refine cluster generation. As a matter of fact, the patch we submitted 
will not work very well when using clusters. It will only work if 
generateClusters(0) is called after the refine(..). That's because 
generateClusters() doesn't take into account the connectivity information. We 
have solved that in our own software by writing a custom version of 
generateClusters().

Davide also worked on a more powerful implicit function definition that allows 
for a wide variety of functions to be used for refining. 

I knew about your research on GPU-based physics, we're starting to work too on 
that field as we feel like it'll be easier to customize our own code. 

I'm not sure to what extent we'll be able to share our recent and future work 
on that, but we'll surely let you know.

Original comment by elvezz...@gmail.com on 29 Feb 2012 at 10:28

GoogleCodeExporter commented 8 years ago
Dear Erwin,

I'm happy to say we have been allowed to share Davide's code for fixing the 
cluster generation in btSoftBody::refine(). Attached is the complete patch, 
which replaces the one I originally uploaded altogether.

It is still not perfect, as multiple cuts may generate some incorrect clusters, 
but it's still better than the current version...

Original comment by elvezz...@gmail.com on 29 Feb 2012 at 3:07

Attachments:

GoogleCodeExporter commented 8 years ago
That is great news. 

Is there a way to include a patch to show this in action in one of the demos of 
Bullet/Demos/SoftDemo?

Original comment by erwin.coumans on 29 Feb 2012 at 7:54

GoogleCodeExporter commented 8 years ago
The SoftDemo.cpp I attached in the first post adds a refine() to the "tetra 
cube" creation code, splitting it in half. 
IMPORTANT: To make the demo work after the patch, the generateClusters() at 
line 1339 (the one after the refine) will have to be commented out.

I guess something like that could do the job, perhaps it'll be nicer if the cut 
could be delayed by a bit or could be controlled by the user.
We'll see what we can do...

Do you think this is enough, or did you have something else in mind?

Original comment by elvezz...@gmail.com on 29 Feb 2012 at 8:05

GoogleCodeExporter commented 8 years ago
A cut by a key press would be great (or cut after a delay of a few seconds)

Some cloth demos in SoftDemo can cut using the mouse click, but I suppose that 
is more work.
Thanks!
Erwin

Original comment by erwin.coumans on 29 Feb 2012 at 8:09

GoogleCodeExporter commented 8 years ago
Sure!
By tomorrow we should be able to provide a patch for the soft demo, then.

Original comment by elvezz...@gmail.com on 29 Feb 2012 at 8:24

GoogleCodeExporter commented 8 years ago
I tried applying the patch, but it looks like it is based on an older version 
of btSoftBody.cpp.

Perhaps you could try re-creating the patch based on the latest svn trunk?

Alternatively, please provide a full copy of btSoftBody.cpp to make it easier 
for someone to try to merge it with trunk.

Thanks a lot!

Original comment by erwin.coumans on 1 Mar 2012 at 5:09

GoogleCodeExporter commented 8 years ago
Dear Erwin, we have the patches for the latest svn and updated the SoftDemo. 
Unfortunately, while testing the demo, we got a lot of crashes or assertion 
failures when cutting an cluster-based soft object multiple times, or in a 
scene with multiple soft bodies that are using clusters.
I don't think that is acceptable, we'll work to get this fixed ASAP and let you 
know when we're done. 

Original comment by elvezz...@gmail.com on 1 Mar 2012 at 5:42

GoogleCodeExporter commented 8 years ago
Let's close the issue and re-open if there is some patch available.

Thanks for the effort anyhow!

Original comment by erwin.coumans on 9 Sep 2012 at 9:27

GoogleCodeExporter commented 8 years ago
Oh sure, sorry for the lack of updates.

Actually I'm in the process of writing a new volumetric soft body class with 
tight integration in Bullet. It's already working but not really stable, 
collision detection is slow and we haven't a nice collision response system for 
the soft body yet.

I'm working very hard on this but I have very little theoretical background so 
it's not easy...
Any kind of suggestion/tip is highly appreciated.

Anyway, I'll try to keep you updated!

Original comment by elvezz...@gmail.com on 10 Sep 2012 at 8:26