<?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/1964" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2008-05-09T08:41:50+00:00</updated>

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

		<entry>
		<author><name><![CDATA[pcm2008]]></name></author>
		<updated>2008-05-09T08:41:50+00:00</updated>

		<published>2008-05-09T08:41:50+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8362#p8362</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8362#p8362"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8362#p8362"><![CDATA[
Thanks Xeno for your reply.<br>  <blockquote class="uncited"><div>The easiest approach is to first determine that the origin is within A-B (the Minkowski difference). You can do this in 2D using the MPR2D algorithm on my website or the 3D equivalent in Game Programming Gems 7 ("XenoCollide: Complex Collision Made Simple").</div></blockquote>  I've noticed indeed that is very simple to detect the overlap for 2 shapes using MPR, even for 3D case.<br>  <blockquote class="uncited"><div>You now need to find the penetration depth along this contact normal. To do that, run MPR again, using the contact normal as the direction of your origin ray.</div></blockquote>  I think I understood your aproach. I'll try to use it.<br>  <blockquote class="uncited"><div>There's no reason to believe that the direction of minimum penetration is the best choice (or even a good choice) when penetration is that deep.</div></blockquote>  I know that for this case the minimum penetration might not be the best separation at all. In fact that's why I'm trying to use some sort of caching aproach to obtain some temporal coherence, like I've wrote to you in a private message. It's pretty ok, but are there other better methods to use (managing the cache is sometimes tricky)?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2422">pcm2008</a> — Fri May 09, 2008 8:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Xeno]]></name></author>
		<updated>2008-05-08T21:26:47+00:00</updated>

		<published>2008-05-08T21:26:47+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8357#p8357</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8357#p8357"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8357#p8357"><![CDATA[
Thanks!  I understand the problem now.<br><br>For the purpose of this discussion, let me define two distinct terms:<br><em class="text-italics"><strong class="text-strong">Penetration depth</strong></em>: The distance two bodies must be separated along a given vector until they are no longer penetrating.<br><strong class="text-strong"><em class="text-italics">Minimum penetration depth</em></strong>: The smallest penetration depth needed to separate two bodies.<br><br>The MPR2D algorithm that is described on my site (<a href="http://xenocollide.snethen.com/mpr2d.html" class="postlink">http://xenocollide.snethen.com/mpr2d.html</a>) does not attempt to find the penetration depth.  It only detects overlap.<br><br>Given that, let's discuss how to detect the contact normal and penetration depth along that normal using MPR on two shapes, A and B.<br><br>The easiest approach is to first determine that the origin is within A-B (the Minkowski difference).  You can do this in 2D using the MPR2D algorithm on my website or the 3D equivalent in Game Programming Gems 7 ("XenoCollide: Complex Collision Made Simple").<br><br>Once you've identified that the origin is within A-B, you know there's a collision.  You can then continue casting the origin ray to the boundary of A-B.  Once you hit the surface, the normal of the portal is your contact normal.<br><br>You now need to find the penetration depth along this contact normal.  To do that, run MPR again, using the contact normal as the direction of your origin ray.  (You can do this by using "origin - contactNormal" as your interior point.)  The distance between the origin and the surface of A-B along the direction of the contact normal is the penetration depth.<br><br>A note about minimum penetration depth: The MPR penetration depth I described above converges to the minimum penetration depth as the penetration is resolved.  In the case you presented in your post, the objects are very deeply penetrated.  There's no reason to believe that the direction of minimum penetration is the best choice (or even a good choice) when penetration is that deep.<br><br>---Xeno (Gary Snethen)<br><a href="http://xenocollide.com" class="postlink">http://xenocollide.com</a><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2273">Xeno</a> — Thu May 08, 2008 9:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pcm2008]]></name></author>
		<updated>2008-05-07T13:16:44+00:00</updated>

		<published>2008-05-07T13:16:44+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8344#p8344</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8344#p8344"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8344#p8344"><![CDATA[
<blockquote class="uncited"><div> Maybe I can help. What is the actual problem you're seeing?<br><br>I'm having trouble interpreting the image you provided. Can you explain how the image demonstrates the problem?</div></blockquote>  Hi,<br>  First of all I would like to say that is not the author of this applet; I've found it on this forum. So I don't know how MPR is implemented in this applet, but I've tried to follow the steps from your webpage and it seems like the penetration dir is slightly inaccurate for this case.<br>  The red and green polygons are the colliding objects and the blue polygon is their Minkowski difference (MD). The red and green large points are the closest features in the polygones returned by the algorithm, coresponding to the yellow point on the MD.<br>  You can see that the distance from the origin to the yellow point on the MD is not the shortest (I've marked it with a red line). The shortest distance from the origin to the MD (that is the penetration dir) is marked with a green line. I've marked the brown point as the correct point, both on the MD and the two polytopes drawing.<br>  I'll try to make more captures from the algorithm steps for better understanding.<dl class="file"><dt class="attach-image"><img src="https://pybullet.org/Bullet/phpBB3/download/file.php?id=124" class="postimage" alt="pb_01_final.JPG" onclick="viewableArea(this);" /></dt></dl><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2422">pcm2008</a> — Wed May 07, 2008 1:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Xeno]]></name></author>
		<updated>2008-05-05T19:07:24+00:00</updated>

		<published>2008-05-05T19:07:24+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8327#p8327</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8327#p8327"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8327#p8327"><![CDATA[
<blockquote class="uncited"><div>Hi,<br>I've recently discovered MPR as a collision detection/ penetration depth algorithm. I think it's good but I think the original paper for 2D (from XenoCollide) has a flaw.</div></blockquote>Maybe I can help.  What is the actual problem you're seeing?<br><br>I'm having trouble interpreting the image you provided.  Can you explain how the image demonstrates the problem?<br><br>---Xeno (Gary Snethen)<br><a href="http://xenocollide.com" class="postlink">http://xenocollide.com</a><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2273">Xeno</a> — Mon May 05, 2008 7:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pcm2008]]></name></author>
		<updated>2008-05-02T18:26:41+00:00</updated>

		<published>2008-05-02T18:26:41+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8300#p8300</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8300#p8300"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=8300#p8300"><![CDATA[
Hi,<br>I've recently discovered MPR as a collision detection/ penetration depth algorithm. I think it's good but I think the original paper for 2D (from XenoCollide) has a flaw.<br>Take a look at this image from the 2D applet. It looks like the MPR has problems with long objects.<br>I think the problem is the refinement step. I don't think that one should choose the portal that contains the origin as the refined portal. Most likely one should choose the portal that has the property: the projection of the origin on the portal is contained in that portal. Try and rerun the steps of the algorithm for this case and see where the MPR starts to go wrong.<br>The reason I think the projection rule should be used is that if the origin is contained in the Minkowski sum (difference) then the shortest distance (penetration distance) will ALWAYS be a projection of the origin to one of the exterior edges, for the 2D case.<br>This rule might alter the ability of the MPR to also detect if two objects penetrate but one could use GJK to detect if the objects penetrate (very fast) and then use MPR for penetration distance/direction.<dl class="file"><dt class="attach-image"><img src="https://pybullet.org/Bullet/phpBB3/download/file.php?id=120" class="postimage" alt="pb_02.JPG" onclick="viewableArea(this);" /></dt></dl><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2422">pcm2008</a> — Fri May 02, 2008 6:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2008-04-07T13:18:53+00:00</updated>

		<published>2008-04-07T13:18:53+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7881#p7881</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7881#p7881"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7881#p7881"><![CDATA[
That makes sense.. I guess I'm just screwed!  <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Mon Apr 07, 2008 1:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erin Catto]]></name></author>
		<updated>2008-04-07T05:56:42+00:00</updated>

		<published>2008-04-07T05:56:42+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7880#p7880</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7880#p7880"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7880#p7880"><![CDATA[
raigan: The issues you state illustrate a big problem with position based systems. You have to allow the system to violate the position constraint before you can apply any correction. Correct me if I'm wrong, but you can't prevent penetration, you can only try to measure it without missing something. This makes the whole problem much more nonlinear than velocity constraints, which are linear by definition.<br><br>In a velocity based system the position corrections should be much smaller and therefore are typically close to being linear.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=12">Erin Catto</a> — Mon Apr 07, 2008 5:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2008-04-07T02:02:14+00:00</updated>

		<published>2008-04-07T02:02:14+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7877#p7877</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7877#p7877"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7877#p7877"><![CDATA[
<blockquote class="uncited"><div>We have dealt with this in some games by generating 'future' contact/non-penetration constraints that happen at the time of impact. So they are generated before bodies are penetrating, perhaps similar to some of Trinkle-Steward approaches.<br><br>Have you considered this?</div></blockquote>I'm not sure what you mean by "happen at the time of impact" -- once you reach that point in time while moving things forward during CCD, you start solving those constraints? <br><br>What I'm doing is very similar to the Steward-Trinkle stuff I've read (from what I understand). Sadly it's also as slow -- especially for "round" shapes made of many tiny faces.. too many constraints get generated.<br><br>If you simply mean using CCD queries in order to generate constraints for collisions which _may_ occur during the next/current frame, this is what we do. My problem with this is that it's slow in two ways -- one, you're generating a lot of constraints that never need to be solved (even if you early-out during processing, you at least need to calculate the current value of the constraint function) , and also you can't just solve all of these constraints since many of them don't make sense (i.e objects are far apart: during prediction they passed through each other so a constraint was generated, but now that we're solving, other constraints/collisions have kept them from following the predicted path).. so you need to do some collision/geometric query type stuff to ensure it still makes sense to apply the constraint, which makes them more expensive. Plus, the rules for determining whether a constraint makes sense are very "ad-hoc".<br><br>At least, this is my theory for why Box2D is much faster when it comes to collision. If there's some way to use a position-level solver during CCD in the same way that velocity-level solvers are used, I'd really like to hear about it!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Mon Apr 07, 2008 2:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erwin Coumans]]></name></author>
		<updated>2008-04-06T23:42:05+00:00</updated>

		<published>2008-04-06T23:42:05+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7876#p7876</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7876#p7876"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7876#p7876"><![CDATA[
<blockquote class="uncited"><div>As I mentioned, the problem is that you can't actually do anything useful at the TOI, since the error is at the velocity level.<br>[...]<br>BUT only if collision constraints were generated before they were penetrating </div></blockquote>We have dealt with this in some games by generating 'future' contact/non-penetration constraints that happen at the time of impact. So they are generated before bodies are penetrating, perhaps similar to some of Trinkle-Steward approaches.<br><br>Have you considered this?<blockquote class="uncited"><div>the only problem being the usual super-thin + super-fast-rotating objects, in which case my predictive collision generation fails (since it's a linear approximation).</div></blockquote>You could try to linearize the rotation too, and project/combine linear and angular motion. This conservative advancement CCD approach is described in Mirtich's PhD thesis, and more recently in the 'Fast' and 'Catch' papers by Zhang/Kim et al. But again, you will need to allow some penetration, otherwise you get stuck into a 0 time-of-impact situation.<br><blockquote class="uncited"><div>My main gripe with convex decomposition is that it assumes static/rigid shapes, and we're trying to do very fluid, morphing vector shapes.</div></blockquote>I got not much experience in deformable objects, but that might change: we are adding a <a href="http://www.bulletphysics.com/BulletSoftBody.zip" class="postlink">softbody contribution</a> to Bullet for upcoming version, dealing with rope, cloth and deformable volumes. This approach differs significant from PBD, but softbody versus softbody collision detection is still work in progress.<br><br>Thanks,<br>Erwin<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2">Erwin Coumans</a> — Sun Apr 06, 2008 11:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2008-04-06T23:25:21+00:00</updated>

		<published>2008-04-06T23:25:21+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7875#p7875</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7875#p7875"/>
		<title type="html"><![CDATA[Re: Minkowski Portal Refinement (MPR) for 2D]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=7875#p7875"><![CDATA[
<blockquote class="uncited"><div>There should be no difference between 1st order velocity-level or 0-order position-level constraint solving in combination with CCD and CP. In both cases, at the time of impact, a discontinuity happens and contact constraints have to be solved, and the direction of motion typically changes. This means the time of impact queue needs to be recomputed for objects involved. So even with velocity-level solving the position and velocity of objects involved change. Why do you think that position level differs?</div></blockquote>The problem is the "contact constraints have to be solved" part -- at the TOI, you _can't_ solve position constraints because they aren't violated!! I may be boneheadedly missing something.. my understanding is that CCD with a velocity-level solver is iterative, with each pass through looking something like this:<br><br>-advance to TOI<br>-solve collision (modify velocity of 2 objects)<br>-continue (i.e calculate next TOI/interacting pair)<br><br>As you said, rather than solving the collision, you can add it to a list and solve it together with the other constraints.. the problem is that since the velocities aren't changed, objects still pass through each other (before the solver step, during the "generate constraints" swept-collision step) and this incorrect movement can generates other constraints which should never exist, and which cause problems (fighting each other or "ghost" collisions between two non-touching objects). <br><br>The only solution I could find is to perform some simple collision-type queries, which is where I am currently. The other alternative was, as you mentioned earlier, to just move to the time of first impact and stop, however this tends to undermine one of the big advantages of this solver, which is that it supports large mass ratios (1:100).. if you stop at time of first impact, you get heavy objects stopped dead by tiny ones. Probably some rule-based solution might work, but I gave up on it.<br><br>I think a better approach might be to use a velocity-level solver for the CCD part (again, I might be totally wrong about what everyone else is doing, but AFAIK this just means cancelling the velocity of the contact point along the collision normal). <br><blockquote class="uncited"><div>Predictive generation of contacts is exactly what CCD is about: it gives you the next time of impact and contact points. This means you simply simulate up to the next toi. So if we assume that CCD provides this information, what exactly is the problem?</div></blockquote>As I mentioned, the problem is that you can't actually do anything useful at the TOI, since the error is at the velocity level.<br><br><blockquote class="uncited"><div>Shallow penetration should not cause issues, but it is possible to combine CCD with zero-penetration. Doom 3 and later idSoftware games use zero penetration, in combination with some clever rules between objects that are in contact. Jan Paul van Waveren provided me a paper and further information that will be part of a chapter on continuous collision detection in my upcoming book. In practice of several games we found it works very well to allow a little bit of penetration. Especially in contact situation, allowing a tiny bit of penetration reduces the number of TOI events dramatically.</div></blockquote>I definitely agree that being able to deal with some amount of overlap is important, since it _always_ happens in practice (especially when you're not a numerical computing genius). My system can handle penetration in that objects which are penetrating will be pushed out of each other, BUT only if collision constraints were generated before they were penetrating (i.e using distance queries, not penetration-depth). So far this works great, and lets us handle concave shapes -- the only problem being the usual super-thin + super-fast-rotating objects, in which case my predictive collision generation fails (since it's a linear approximation).<br><blockquote class="uncited"><div>Is your system 2D or 3D? If 2D, how does stability compare to Box2D?</div></blockquote>2D; I actually haven't been able to build Box2D for about a year (at some point Erin changed something which broke compilation under code::blocks and it's never worked for me since.. plus I haven't had the energy to fight with stupid c++ build crap) so I'm not sure about the recent state, but it's much better behaved than the split-impulse solver for articulated bodies. <br><br>The main thing is that you don't need to tweak anything, it just converges -- you can randomly position the objects and they'll snap together, without any "only move things by X amount per iteration" type hacking -- and it can handle large mass ratios. I don't know about stacking -- friction is still being figured out -- but for articulated characters it's great.<br><br>It's the Muller PBD-solver, applied to rigid bodies. I'm not an expert on numerical solvers, but I _think_ it's a non-linear solver, similar to "damped least-squares fit". At least, the third formula on this page looks very similar to the formula presented in the PBD solver: <a href="http://en.wikipedia.org/wiki/Gauss-Newton_algorithm" class="postlink">http://en.wikipedia.org/wiki/Gauss-Newton_algorithm</a><br><br>One great thing I've noticed is that if the situation is impossible (i.e a chain of bodies with the two ends anchored too far from each other) it doesn't explode/oscillate like the impulse-based solvers tend to do, it just gets as close as it can to a solution.<br><blockquote class="uncited"><div>by the way, concave-concave collision deserves its own topic. Bullet's penetration-based method seems to work pretty well in actual games, including for concave objects. For better quality I would recommend using convex decomposition. It is possible to use 3D concave triangle meshes in Bullet and ODE (like GIMPACT etc), but it convex decomposition gives better stability and contact information. Havok and Ageia PhysX also avoid concave triangle meshes in favor of convex decomposition.</div></blockquote>[/quote]<br><br>My main gripe with convex decomposition is that it assumes static/rigid shapes, and we're trying to do very fluid, morphing vector shapes. We've even got some "skinned physics" working -- collision geometry verts can be bound (with different weights) to multiple bones, and constraints involving the geometry will correctly adjust the bones' states. Not sure if this is super-useful/needed though <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>The main issue we're running into is the software-engineering side -- it's really difficult for us not-great-coders to figure out a nice system which hides everything, so that the solver doesn't care whether things are skinned or rigid, and just treats everything generically as a big pile of DOF and constraints involving the DOF.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Sun Apr 06, 2008 11:25 pm</p><hr />
]]></content>
	</entry>
	</feed>
