# Physics Simulation Forum

 Page 3 of 4 [ 50 posts ] Go to page Previous  1, 2, 3, 4  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: Re: My explicit euler cloth codePosted: Mon Jul 25, 2011 1:44 pm

Joined: Thu May 05, 2011 11:47 am
Posts: 61
DevO wrote:
This should be 3 point constrain only.
The only tricky part is actually properly creating this constrains.
The should be just like distance constrains that are used to replace bending constrains but are using middle point too.
Code:
0-----1-----2
|     |     |
3-----4-----5
|     |     |
6-----7-----8

In this simple case you should have 6 bend constrains.
C(0,1,2), C(3,4,5), C(6,7,8), C(0,3,6), C(1,4,7), C(2,5,8).

Oh I just saw fig.4 and its explanation. Doing that way, I think I could just add in the constraint like this
Code:
for(int j=0;j<numY;j++) {
for(int i=0;i<numX;i++) {
}
}
and i think this should do it. I will do this tomorrow hopefully. I have already commited teh current version though.

Last edited by mobeen on Mon Jul 25, 2011 1:55 pm, edited 1 time in total.

Top

 Post subject: Re: My explicit euler cloth codePosted: Mon Jul 25, 2011 1:53 pm

Joined: Fri Mar 31, 2006 7:13 pm
Posts: 90
Quote:

Please lock at page 5 to Figure 6: algorithm create-bending-constraints and read
4.1. Working with Triangle Meshes.

The constrain should not for an triangle that you have in the mesh.

Code:
for(int j=0;j<numY-2;j++) {
for(int i=0;i<numX;i++) {
}
}
for(int j=0;j<numY;j++) {
for(int i=0;i<numX-2;i++) {
}
}

Something like this should work.

Top

 Post subject: Re: My explicit euler cloth codePosted: Mon Jul 25, 2011 1:57 pm

Joined: Thu May 05, 2011 11:47 am
Posts: 61
Oh ok thanks for that.
One more thing, you didnt tell me how i should refer you in the code.
I have just written special thanks to DevO for his help. Do u want to add in your real name and affiliation?

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 2:37 am

Joined: Thu May 05, 2011 11:47 am
Posts: 61
Ok done. I have committed the final pbd version. You can checkout from svn.

One more thing, if I were to extend it to 3d meshes, how do i create the constraints? I think i would have to create a tetrahedral mesh first and then assign distance constraints to the three shared edge (p2p3, p0p3 and p1p3) and one bend constraint(p2p1) assuming the base of the tetrahedron is p0p1p2 and p3 is the apex vertex as given in the following figure,
Code:
+ (p3)
/|\
(p2) +-|-+(p1)
\|/
+(p0)
Is this how pdb is setup for softbodies?

Another thing I want to ask is how to do simple linear FEM for softbodies? Do u have any idea or reference which might help?

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 3:03 am

Joined: Sun Jul 03, 2005 4:06 pm
Posts: 750
Location: Bellevue, WA
On FEM you might want to start here: http://www.matthiasmueller.info/publications/GI2004.pdf

I found this course awesome since it approaches FEM from the Direct Stiffness Method and Variational perspective. This is very advanced though:

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 3:08 am

Joined: Thu May 05, 2011 11:47 am
Posts: 61
Thanks Dirk for the links. I will surely have a look through these.

On the side note, have u checked out our pbd implementation? Any comments on it?

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 1:09 pm

Joined: Fri Mar 31, 2006 7:13 pm
Posts: 90
Hi,
I just wanted to test one idea regarding float precision and summation.

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 3:03 pm

Joined: Thu May 05, 2011 11:47 am
Posts: 61
Hi DevO.
THanks for the KahanSum stuff. I will run it on my system first thing tomorrow morning. By the way, could u elaborate a bit more on this as this is quite new for me. I assume it is something to do with the floating point inaccuracies during summations however I m not sure. An expert advice would be interesting.

Apart from this, is the pbd implementation (the latest svn one) correct.

Another thing, what about using pbd for soft bodies any ideas how to go about it?

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 3:08 pm

Joined: Sun Jul 03, 2005 4:06 pm
Posts: 750
Location: Bellevue, WA
Here is a possible way how to use PBD to do softbodies:
http://www.matthiasmueller.info/publica ... ticles.pdf

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Jul 26, 2011 3:10 pm

Joined: Thu May 05, 2011 11:47 am
Posts: 61
Thanks Dirk for this.

Top

 Post subject: Re: My explicit euler cloth codePosted: Wed Jul 27, 2011 4:15 am

Joined: Thu May 05, 2011 11:47 am
Posts: 61
WOW, using KahanSum the behaviour is more accurate as compared to not using the KahanSum.
DevO I am grateful to you for pointing this out. I didnt know about this and the errors numerical inprecision generates. Thanks man.

Top

 Post subject: Re: My explicit euler cloth codePosted: Wed Jul 27, 2011 3:12 pm

Joined: Sun Jul 03, 2005 4:06 pm
Posts: 750
Location: Bellevue, WA
Can you elaborate a bit more about the KahanSum and where you added it to the PDB algorithm - maybe a simple example? I will look at the code after this, but it might be nice to discuss this in isolation. I looked at Wikipedia and it seems to deal with Cancelation problems. Good stuff DevO

Top

 Post subject: Re: My explicit euler cloth codePosted: Wed Jul 27, 2011 9:21 pm

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
Thanks for sharing these cloth implementations, it will be helpful.

For FEM, you can also buy the 'Game Physics Pearls' book, and check out chapter 10.

I recently extracted the corotational linear fem implementation from OpenTissue (removed BOOST and only use the necessary code) here:
https://github.com/erwincoumans/experiments (there is a Download button) and check out the dynamics/corotational_fem folder.
You can build it under Windows using Visual Studio 2008/2010 by clicking on the build/msvc2008.bat batchfile and open the new folder.
Attachment:

fem_gwen.png [ 75.86 KiB | Viewed 1707 times ]

I plan to add some collision detection to it. You could use it to simulate cloth as well (thick cloth of a single layer of tetrahedra)
Cheers,
Erwin

Top

 Post subject: Re: My explicit euler cloth codePosted: Thu Jul 28, 2011 1:51 am

Joined: Thu May 05, 2011 11:47 am
Posts: 61
WOW. Thanks Erwin for this. I would surely have a look through those resources.

Thanks,
Mobeen

Top

 Post subject: Re: My explicit euler cloth codePosted: Tue Aug 16, 2011 7:04 pm

Joined: Tue Apr 19, 2011 11:46 pm
Posts: 9
Just my 2 cents about Explicit method..

1. The force between two points are not constant even during the discrete time step. We already know that the force is changing as a result of moving points. The good thing is that we can compute how much the force will change during the time step. Unfortunately it is a function of point velocity and we don't know this until we integrate! So those two information (force change rate and point velocities) are strongly coupled together. That is why we need to solve a linear equation in implicit method.

2. If one point is moving towards the other point, we know that the force change rate is a vector with the same direction of the two points. However, if the point is moving perpendicular to the line of two points, there is still change of force. In this case, the force change rate is dependent on the point velocity direction but not the same direction. So the force change rate is always vector and the relationship with point introduces some 3x3 matrix which is Jacobian matrix. For real-time simulation, we can ignore the perpendicular case, then the Jocobian matrix is no longer needed because the force change rate will be always the same direction as the line of two points. This makes it possible to implement implicit integration without solving linear equation. Below paper explains this concept.

http://www.multires.caltech.edu/pubs/GI99.pdf

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 3 of 4 [ 50 posts ] Go to page Previous  1, 2, 3, 4  Next

#### Who is online

Users browsing this forum: No registered users and 0 guests

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

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities