Hitting assert in dgCollisionConvex.cpp

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Hitting assert in dgCollisionConvex.cpp

Postby Bird » Mon Sep 09, 2013 3:44 pm

Hi Julio,

I'm hitting a problem in this scene. The box is a dynamic box shape and the armadillo is a static mesh.
http://hurleyworks.com/media/flash/Bug/Bug.html

Here's the serialized file:
http://hurleyworks.com/downloads/SerializedNewtonWorld.zip

I'm also getting a crash if I try to use convex decomposition on the armadillo mesh.

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Mon Sep 09, 2013 4:55 pm

ha nice, I will try it tonight
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Bird » Mon Sep 09, 2013 5:05 pm

Julio Jerez wrote:ha nice, I will try it tonight


I'm hitting that assert in other scenes as well. An easy way for you to hit it is if you run the "Primitive convex cast" sandbox demo.

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Mon Sep 09, 2013 5:49 pm

Oh I see what yo umean
Code: Select all
   dgVector floatingVeloc (floatingBody->m_veloc);
   dgVector referenceVeloc (referenceBody->m_veloc);
dgAssert (0);
   dgCollisionInstance* const collConicConvexInstance = proxy.m_referenceCollision;
   const dgVector& scale = collConicConvexInstance->GetScale();
   const dgVector& invScale = collConicConvexInstance->GetInvScale();
   const dgMatrix& matrix = collConicConvexInstance->GetGlobalMatrix();


I did know I check that in, U adde that assert in all te hplacece wh eteh scale is use so that I can make the corrections.
I did not ment to check that is,

tonight if I do not have time to compllet all the refactoring I will remove the changes. It is jus away for me to mark what I need to change
bascially I neen to wrap that code inside a switch case.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Mon Sep 09, 2013 5:50 pm

how can I get a copy of the armadello file?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Bird » Mon Sep 09, 2013 6:00 pm

Julio Jerez wrote:how can I get a copy of the armadello file?


I could use Newton to export an OFF file. Would that work for you?

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Mon Sep 09, 2013 6:59 pm

that would be perfect yes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Bird » Mon Sep 09, 2013 8:05 pm

Julio Jerez wrote:that would be perfect yes.

Here you go. http://hurleyworks.com/downloads/armadillo.zip

I took a look in LWModeler and noticed that there is 1 edge that is shared by more than 2 triangles so it's not a manifold mesh ... maybe that's the problem.

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Mon Sep 09, 2013 8:33 pm

that should be ok that Newton mesh can cope with non manifold meshes
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Tue Sep 10, 2013 11:57 am

Ok, I try to approximate the armadillo and these ar the problem I found. some I fix other need more time

-the model is too small, and when I converted to a collision tree for vertex location, I ran into problem because the collision tree collapses many vertices that are too close.
this can be fix but I nee to make so that does no affect the game run time.
Instead I scale the model in max for a quit solution. Later I can make the same adjust men to the code.

The second problem was that the model is a very high detail model. This make the the convex partition has a hard time differentiating local features from global feature.
the default code is to approximate with 32 convex, but tat was no enough, I try 100, and then 200, but the result si that the approximation gets better but the effect is lot for very small convex that
we can clearly see should ne be part of the approximation.

This is obvious flaw of the algorithm since the it does no take into account the locality of features. to improve this I will add the mesh reduction so that the mesh is smother and many of the local features are remove before the convexification.

the third problem is that it take 15 minute on my machine to do the approximation, the mesh reduction call also help with that.
This weekend I will work on that, after I complete the bugs wit the scaling stuff

I check in the fix the made it crash. you can attest it again but make sure to scale the model up before the conversion.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Thu Sep 12, 2013 7:43 am

Ok I checked in the that fix the bug with the high density mesh, can you try the same scene with the box falling on top of the armadillo?

The serialized one would not work because the armadillo already has a bogus convex decomposition shape
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Bird » Thu Sep 12, 2013 8:48 am

Julio Jerez wrote:Ok I checked in the that fix the bug with the high density mesh, can you try the same scene with the box falling on top of the armadillo?

The serialized one would not work because the armadillo already has a bogus convex decomposition shape

Still not working. Here's a new serialized version. I reduced the poly count down of the Armadillo to 10,000 from 100,000 so maybe it's a little easier for you to work with. :)

http://hurleyworks.com/downloads/low_rez_armadillo_scene.zip

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Thu Sep 12, 2013 9:58 am

Oh I was confused, I though that the armadillo was a compound shape. but is it a solid collision tree.

I know what the problem is. it is relate to a mat limi of faces a collision tree can collet on a quire, is was 128, but tha was to small, then I set to 512 and made a small seltion on the narrow face.
but for that scene. you can se etha the box do hit the to o fteh armadillo, but after that is start to fall and til over the body that made the AABB collect more an more faces until the number of faces is the size of the mesh itself.

the code that select the first 512 with better chance to collide, in fact select the wrong faces.
I have to do a better selection in the situations.

this is no a bug, although I will see if I can make it better. this is a short coming of the collision tree AABB algorithm.
Basically the collision tree is designed for colliding object that are significant smaller that the collision tree itself, but this is a complete extreme case.

I think I can fixed by this the basically to fix this I nee to make a aabb hierarchical partitions.
basically when a box is large than some criteria I nee to programmatically slide the box into two and run the two separate parts, and if tow are still too large do the same.
I believe that algorithm will automatically do an optimal face selection.
Ok I will fix that.


di you try the convex decomposition on the armadillo to see if it passed?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hitting assert in dgCollisionConvex.cpp

Postby Bird » Thu Sep 12, 2013 10:44 am

di you try the convex decomposition on the armadillo to see if it passed?

It's working fine now in my tests and very fast considering how much work it's doing

http://hurleyworks.com/media/flash/ConvexDecompTest/ConvexDecompTest.html

In the video, I'd like Hellboy's tail pieces to more accurately follow the mesh. Could you please tell me which parameter in NewtonMeshApproximateConvexDecomposition() I'd need to change to make it more accurate.

Thanks for taking the time to work on this area of Newton. It's getting me closer to being able to actually release a product. :)

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Hitting assert in dgCollisionConvex.cpp

Postby Julio Jerez » Thu Sep 12, 2013 11:19 am

NewtonMesh* NewtonMeshApproximateConvexDecomposition (const NewtonMesh* const mesh, dFloat maxConcavity, dFloat backFaceDistanceFactor, int maxCount, int maxVertexPerHull, NewtonReportProgress reportPrograssCallback);


in the demos I call in like this
NewtonMesh* const convexApproximation = NewtonMeshApproximateConvexDecomposition (newtonMesh, 0.01f, 0.2f, 32, 100, NULL);

concavity 0.01 an mop more than 32 convexes.

you can check if the descompostion come back with 32 convexes it mean that after if found all of the convexes that fall below the 0.01 concavity, there were more that 32, so it has to combine convexes to meet the conditions of not more than 32 convexes.
you can increase the coconve count maybe 40 or double
. you can make those slidier parameters that the use can play with.

the 0.2, the how far the algorithm will consider faces that oppose each other, for example the back faces of a think wall, as oppose to the back face of a thick wall. this control if disjoint concave pieces are consider to be jointed or no
depending on how far apart are the closed faces.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 11 guests

cron