<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/404" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2007-01-27T03:40:20+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/404</id>

		<entry>
		<author><name><![CDATA[stbuzer]]></name></author>
		<updated>2007-01-27T03:40:20+00:00</updated>

		<published>2007-01-27T03:40:20+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3360#p3360</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3360#p3360"/>
		<title type="html"><![CDATA[Stan's cloth simulation demo/discussion]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3360#p3360"><![CDATA[
Oh, what a really stupid mistake I made <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br>When looking for an error, I tryed subtracting p1, but forget to add it back <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br>Now it works fine, great thanks!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=1364">stbuzer</a> — Sat Jan 27, 2007 3:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[clanzotti]]></name></author>
		<updated>2007-01-27T01:07:21+00:00</updated>

		<published>2007-01-27T01:07:21+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3357#p3357</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3357#p3357"/>
		<title type="html"><![CDATA[Re: bridson]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3357#p3357"><![CDATA[
Hi,<br><blockquote class="uncited"><div>Thank you for your detailed answer.</div></blockquote>Glad if i can be of help, i'm struggling with cloth simulation for years.<br><blockquote class="uncited"><div>The main problem for me with baraff's approach was, that you can easily end    up having some frame with some penetration because the simulation fixes the penetration at the next timestep (which is also a new frame in my example).</div></blockquote>In fact you dont. Just give to your graphics pipeline the fake result and 'adjust' the errors in the beginning of the next timestep.<br><blockquote class="uncited"><div>I also implemented Bridson's paper (<a href="http://www.cs.ubc.ca/~rbridson/docs/cloth2002.pdf" class="postlink">http://www.cs.ubc.ca/~rbridson/docs/cloth2002.pdf</a>) but i ended up having problems with instability.  I saved the work and I will see if I can get it up again. Maybe there is some obvious glitch I didn't see.</div></blockquote>Bridson's paper is targeted at the resolution of cloth/cloth collisions, so for the resolution of the cloth/rigid body collision you should try to apply the Baraff's method.<br><br>At least for static objects...<br><blockquote class="uncited"><div>But in total you're right: I think that an iterational attempt could be the most successfully in solving collisions.</div></blockquote>Actually it is the most 'robust' method we know, but still it needs more research to handle general cases.<br><blockquote class="uncited"><div>Ah! One thing left: I think that there is a problem with Bridson's attempt: He's moving points and changing velocities without taking the spring forces into account. That can introduce "jumping" behaviour at the next timestep IMHO. </div></blockquote>Not really, he take into account spring forces implicitly by appling impulses to the velocity during the collision resolving process. <br><blockquote class="uncited"><div>(Additional: And this method can't be used with second order schemes like BDF-2 since it introduces discontinues. -IMHO)</div></blockquote>BDF-2 solve for position instead of velocity, but at the end of timestep you  can calculate the mean velocity and you can apply the Bridon's method too.<br> <blockquote class="uncited"><div>And now, I'll dig for my implementation of that <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"></div></blockquote>Dig more and more! Ehehe, and let we see how it progress <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";-)" title="Wink"><br><br>Regards,<br><br>Carlo Lanzotti<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=111">clanzotti</a> — Sat Jan 27, 2007 1:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2007-01-26T16:23:28+00:00</updated>

		<published>2007-01-26T16:23:28+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3350#p3350</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3350#p3350"/>
		<title type="html"><![CDATA[Stan's cloth simulation demo/discussion]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3350#p3350"><![CDATA[
<blockquote class="uncited"><div>Thanks, Dirk. It is hard to say where the problem is.<br>I tryed manys of variants to get my bending constraints work, but it seems to me that it was waste of my time <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"></div></blockquote>I've implemented much of that paper in 2D, and I also had a hard time getting the bending constraints to behave well. In the end, I switched to a different formulation (using atan instead of acos), and things have been working very well. It's possible that there were errors in my acos-based code though.<br><br>My constraint function was: C = (atan2(n1) - atan2(n2)) - theta<br>Where n1,n2 are the normals you're trying to constrain, and theta is the desired angle.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Fri Jan 26, 2007 4:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2007-01-26T15:58:06+00:00</updated>

		<published>2007-01-26T15:58:06+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3349#p3349</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3349#p3349"/>
		<title type="html"><![CDATA[Stan's cloth simulation demo/discussion]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3349#p3349"><![CDATA[
I think you forgot to calculate everything w.r.t. p1. In the paper they assume p1 = (0,0,0). This means you have to use:<br><br>// Given x1, x2, x3, x4 the vertices of the bending element<br>p2 = x2 - x1;<br>p3 = x3 - x1;<br>p4 = x4 - x1;<br><br>Then you proceed as normal to compute the displacements which are applied on the original coordinates (x) again then....<br><br>HTH,<br>-Dirk<br><br>PS: I only skimmed your code, so the question might be already ansered by Genscher<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Fri Jan 26, 2007 3:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Genscher]]></name></author>
		<updated>2007-01-26T15:34:18+00:00</updated>

		<published>2007-01-26T15:34:18+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3348#p3348</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3348#p3348"/>
		<title type="html"><![CDATA[Stan's cloth simulation demo/discussion]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3348#p3348"><![CDATA[
<blockquote class="uncited"><div>I only dont understand why collision detection, setting the constraints and position alterations are ran after simulation step?<br>why dont do like that:<br>1. detect collisions and set constraints and alterations values<br>2. simulate </div></blockquote>Well, you can't know where your particles will flow and you will miss all collisions where the objects are in a distance &gt; epsilon.<br>You simply can't know where you cloth is heading in advance <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";-)" title="Wink"><br><br>You can only solve half of the collision response in advance. And that's all collisions within a range of epsilon. If your cloth is moving more than epsilon or any other rigid body in the scene, then you will most likely miss a collision.<br><br>You have two chances to prevent this<br>1. dynamically reduce the timestep so that your cloth/rigid body only moves &lt; epsilon.<br>2. implement some function which calculates the TOI (time of impact). you will need to do a rewind-step to prevent this sort of collisions IMHO<br><blockquote class="uncited"><div>I assume Bridson's method you mean is the method proposed by Robert Bridson in his "Robust Treatment of Collisions, Contact and Friction for Cloth Animation" ?  </div></blockquote>And yes, that's our faourite paper <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";-)" title="Wink"><br><br>Greetings<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=646">Genscher</a> — Fri Jan 26, 2007 3:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stbuzer]]></name></author>
		<updated>2007-01-26T14:22:18+00:00</updated>

		<published>2007-01-26T14:22:18+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3346#p3346</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3346#p3346"/>
		<title type="html"><![CDATA[Re: collision constraints]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3346#p3346"><![CDATA[
Thanks you guys, very interesting <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><blockquote class="uncited"><div>Hi<br><blockquote class="uncited"><div>Hello!<br>In total I wonder how baraff solved the problem of having a non-penetration free state.<br><br>It seemed to me that he do it like this:<br>1. simulate()<br>2. set constraints and position altering to apply them in the NEXT ROUND<br><br>so you could easily end up in a non-penetration free state after one step, right?</div></blockquote>Yes, this is the method proposed in the paper and it work quite well in most cases. Also you should check when a constraint need to be released to prevent sticking just at the beginning of the next timestep.</div></blockquote>I only dont understand why collision detection, setting the constraints and position alterations are ran after simulation step?<br>why dont do like that:<br> 1. detect collisions and set constraints and alterations values<br> 2. simulate<br><br>I assume Bridson's method you mean is the method proposed by Robert Bridson in his "Robust Treatment of Collisions, Contact and Friction for Cloth Animation" ?<br>I planned to use it within position-based cloth simulator.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=1364">stbuzer</a> — Fri Jan 26, 2007 2:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Genscher]]></name></author>
		<updated>2007-01-26T14:15:51+00:00</updated>

		<published>2007-01-26T14:15:51+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3345#p3345</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3345#p3345"/>
		<title type="html"><![CDATA[bridson]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3345#p3345"><![CDATA[
Thank you for your detailed answer.<br><br>The main problem for me with baraff's approach was, that you can easily end    up having some frame with some penetration because the simulation fixes the penetration at the next timestep (which is also a new frame in my example).<br><br>I also implemented Bridson's paper (<a href="http://www.cs.ubc.ca/~rbridson/docs/cloth2002.pdf" class="postlink">http://www.cs.ubc.ca/~rbridson/docs/cloth2002.pdf</a>) but i ended up having problems with instability.  I saved the work and I will see if I can get it up again. Maybe there is some obvious glitch I didn't see.<br><br>But in total you're right: I think that an iterational attempt could be the most successfully in solving collisions.<br><br>Ah! One thing left: I think that there is a problem with Bridson's attempt: He's moving points and changing velocities without taking the spring forces into account. That can introduce "jumping" behaviour at the next timestep IMHO. <br>(Additional: And this method can't be used with second order schemes like BDF-2 since it introduces discontinues. -IMHO)<br><br>And now, I'll dig for my implementation of that <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"><br><br>Greetings so far<br>genscher<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=646">Genscher</a> — Fri Jan 26, 2007 2:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[clanzotti]]></name></author>
		<updated>2007-01-26T13:53:11+00:00</updated>

		<published>2007-01-26T13:53:11+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3344#p3344</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3344#p3344"/>
		<title type="html"><![CDATA[Re: collision constraints]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3344#p3344"><![CDATA[
Hi<br><blockquote class="uncited"><div>Hello!<br><br>I tried different ways to solve collisions. <br><br>One way i followed was like this:<br>1. check for near faces and constrain (using z-vector like in the baraff paper) them not to move any further<br>2. simulateStep()<br>3. check for in-between collisions during position change x to x+1 <br>4. if there where collisions, constrain and solve them<br>4. do simulateStep() again with all constraints</div></blockquote>I assume you are applying the constraints at the next timestep instead of rewinding the simulation and restart again. (?)<br><blockquote class="uncited"><div>A second way was like baraff said:<br>1. enforce constraint like this (cloth against  not moving rigid body ):<br>[snip]</div></blockquote>This only work well for cloth-cloth contacts/collisions, for cloth rigid body collision you should use the PCG/filtering constraint method.<br><blockquote class="uncited"><div>In total I wonder how baraff solved the problem of having a non-penetration free state.<br><br>It seemed to me that he do it like this:<br>1. simulate()<br>2. set constraints and position altering to apply them in the NEXT ROUND<br><br>so you could easily end up in a non-penetration free state after one step, right?</div></blockquote>Yes, this is the method proposed in the paper and it work quite well in most cases. Also you should check when a constraint need to be released to prevent sticking just at the beginning of the next timestep.<br><blockquote class="uncited"><div>My only idea how to solve that would be some additional step(s) like<br>1. simulate<br>DO UNTIL MAX_ITER OR PENETRATION_FREE<br>   2. set delta x and delta y<br>   3. simulate with constraints<br>END</div></blockquote>The problem with this approach is that you have to handle the over-elongation of your springs caused by the position correction you apply at the contact points, otherwise you'll cause other collisions/penetrations to happen in the next timestep. <br><br>Maybe a better apporach is to handle the post-correction (for interpenetrations/overelongations) phase with the Bridson's method and then use the Baraff's method to handle colliding/resting contacts at the beginning of the next timestep.<br><br>The drawback of the Baraff's method is that the contacts constraints can be applied only to single particles (E.g. edge/edge contacts can not be handled).<br><br>Regards,<br><br>Carlo Lanzotti<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=111">clanzotti</a> — Fri Jan 26, 2007 1:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Genscher]]></name></author>
		<updated>2007-01-26T12:21:00+00:00</updated>

		<published>2007-01-26T12:21:00+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3343#p3343</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3343#p3343"/>
		<title type="html"><![CDATA[collision constraints]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3343#p3343"><![CDATA[
Hello!<br><br>I tried different ways to solve collisions. <br><br>One way i followed was like this:<br>1. check for near faces and constrain (using z-vector like in the baraff paper) them not to move any further<br>2. simulateStep()<br>3. check for in-between collisions during position change x to x+1 <br>4. if there where collisions, constrain and solve them<br>4. do simulateStep() again with all constraints<br><br>this was pretty effective but also time consuming <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";-)" title="Wink"><br><br>A second way was like baraff said:<br>1. enforce constraint like this (cloth against  not moving rigid body ):<div class="codebox"><p>Code: </p><pre><code>float  k      = 5000; // very stiff springfloat  L   = epsilon; // this is the closest distance they should getfloat3 f;float3 stretch_force = float3(0,0,0);float3x3 dfdv;if(length&lt;L) // only apply force if distance between points is smaller than epsilon{stretch_force = (k * (L - length)) * dir;F[i] += stretch_force;dfdv = dfdx_spring_type1(dir,L,length,k);dFdV.blocks[i].m   -= dfdv;  // diagonal chunk dFdX[b,b]}</code></pre></div>I inserted some spring constraint between the collision points. But that resulted in very big forces since a particles could get this force applied many times. I also had a solution for this (checking directions in which a particle is constrained already).<br><br>In total I wonder how baraff solved the problem of having a non-penetration free state.<br><br>It seemed to me that he do it like this:<br>1. simulate()<br>2. set constraints and position altering to apply them in the NEXT ROUND<br><br>so you could easily end up in a non-penetration free state after one step, right?<br>My only idea how to solve that would be some additional step(s) like<br>1. simulate<br>DO UNTIL MAX_ITER OR PENETRATION_FREE<br>   2. set delta x and delta y<br>   3. simulate with constraints<br>END<br><br>Did I miss something?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=646">Genscher</a> — Fri Jan 26, 2007 12:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stbuzer]]></name></author>
		<updated>2007-01-26T10:25:12+00:00</updated>

		<published>2007-01-26T10:25:12+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3342#p3342</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3342#p3342"/>
		<title type="html"><![CDATA[Stan's cloth simulation demo/discussion]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3342#p3342"><![CDATA[
Thanks, Dirk. It is hard to say where the problem is.<br>I tryed manys of variants to get my bending constraints work, but it seems to me that it was waste of my time <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br>Cloth represented by 26 x 26 grid, fixed at 2 top vertices, after applying an impulse comes to rest in a very strange manner. Its rest state looks like this:<br><a href="http://img266.imageshack.us/my.php?image=bendinghelllu4.png" class="postlink"><img src="http://img266.imageshack.us/img266/2708/bendinghelllu4.th.png" class="postimage" alt="Image"></a><br><br>May be you can help me. This is my code on computing initial bending angle 'phi':<div class="codebox"><p>Code: </p><pre><code>sPoint3&amp; p1 = m_X[bendEdge-&gt;p1];sPoint3&amp; p2 = m_X[bendEdge-&gt;p2];sPoint3&amp; p3 = m_X[bendEdge-&gt;p3];sPoint3&amp; p4 = m_X[bendEdge-&gt;p4];sPoint3 n1 = normalize(cross(p2,p3));sPoint3 n2 = normalize(cross(p2,p4));F32 cos_angle = dot(n1, n2);bendEdge-&gt;phi = acosf(cos_angle);</code></pre></div>(p1,p2,p3,p4 indices are 100 % valid, I've checked)<br><br>And here is a code projecting bending constraints:<div class="codebox"><p>Code: </p><pre><code>sPoint3&amp; p1 = m_P[p1i];sPoint3&amp; p2 = m_P[p2i];sPoint3&amp; p3 = m_P[p3i];sPoint3&amp; p4 = m_P[p4i];sPoint3 n1 = cross(p2,p3);sPoint3 n2 = cross(p2,p4);F32 p2p3 = 1.0f / n1.length();F32 p2p4 = 1.0f / n2.length();n1 *= p2p3;n2 *= p2p4;F32 d = sMATH-&gt;clamp(dot(n1,n2), -1.0f, 1.0f);sPoint3 cross_p2n2 = cross(p2, n2);sPoint3 cross_p2n1 = cross(p2, n1);sPoint3 q3 = p2p3 * (cross_p2n2 - cross_p2n1*d);sPoint3 q4 = p2p4 * (cross_p2n1 - cross_p2n2*d);sPoint3 q2 = (-p2p3)*(cross(p3,n2) + cross(n1,p3)*d) -p2p4*(cross(p4,n1) + cross(n2,p4)*d);sPoint3 q1 = -q2 - q3 - q4;F32 angle_diff = acosf(d) - m_bendConstr[j].phi;F32 sum_w = m_w[p1i] + m_w[p2i] + m_w[p3i] + m_w[p4i];F32 sum_q = q1.lengthSquared() + q2.lengthSquared() + q3.lengthSquared() + q4.lengthSquared();F32 p_i = -4.0f * k_bend * sMATH-&gt;sqrt(1.0f - d*d) * angle_diff;sum_w *= sum_q;if( sum_w &gt; fEpsilon )   p_i /= sum_w;p1 += (p_i * m_w[p1i]) * q1;p2 += (p_i * m_w[p2i]) * q2;p3 += (p_i * m_w[p3i]) * q3;p4 += (p_i * m_w[p4i]) * q4;</code></pre></div>I checked it several times according to the paper.<br>May be I misunderstanding something.<br><br>And did you face any difficulties with these constraints?<br><br>And what cloth simulation model do you consider the best(in your opinion) for realtime applications?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=1364">stbuzer</a> — Fri Jan 26, 2007 10:25 am</p><hr />
]]></content>
	</entry>
	</feed>
