New btInternalEdgeUtility has been added

edl
Posts: 16
Joined: Tue Jul 08, 2008 7:28 am

Re: New btInternalEdgeUtility has been added

Post by edl »

I use the default vehicleDemo to modify as this program,after initialization, drive the car inside the tunnel , press "w" to show the wireframe, move the car slowly along the wall. Crash the triangular dense point, sometimes, it suddenly mad.

There is also a problem, when I put this InternalEdge patch used in a large scene,the program just crash after it starts, and I am still checking what 's the problem.

InternalEdge patch is very important, when the scene goes big,when the cars across the shape edge, 50% chance would make car go mad or get a big impulse.
Attachments
VehicleDemo.7z
(12.19 KiB) Downloaded 640 times
car_.GIF
car_.GIF (18.73 KiB) Viewed 20184 times
edl
Posts: 16
Joined: Tue Jul 08, 2008 7:28 am

Re: New btInternalEdgeUtility has been added

Post by edl »

and more,in debug mode, the quaternion value can be zero value.

it cause some trouble

this is the call stack
Attachments
qut_zero.GIF
qut_zero.GIF (15.5 KiB) Viewed 20179 times
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: New btInternalEdgeUtility has been added

Post by Dirk Gregorius »

Maybe the quaternion is not a bug. It depends where the axis comes from. You could construct an identity quaternion in this case well, but it depends on the context.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: New btInternalEdgeUtility has been added

Post by Erwin Coumans »

Thanks a lot for the reproduction case.

The current btInternalEdgeUtility tries to deal with double sided triangles, but that can cause troubles with the heuristic that is used. I'm going to simplify the utility to only work with single sided triangles, that should make it more robust.

The btQuaternion assert is likely a zero-area / degenerate triangle (two vertices are very close or identical). Can you check this?
Thanks,
Erwin
edl
Posts: 16
Joined: Tue Jul 08, 2008 7:28 am

Re: New btInternalEdgeUtility has been added

Post by edl »

Dirk Gregorius wrote:Maybe the quaternion is not a bug. It depends where the axis comes from. You could construct an identity quaternion in this case well, but it depends on the context.
i think you are right, i have two scene,a big one,and another simple small one,the small one didn't encounter this problem.
Erwin Coumans wrote:Thanks a lot for the reproduction case.

The current btInternalEdgeUtility tries to deal with double sided triangles, but that can cause troubles with the heuristic that is used. I'm going to simplify the utility to only work with single sided triangles, that should make it more robust.

The btQuaternion assert is likely a zero-area / degenerate triangle (two vertices are very close or identical). Can you check this?
Thanks,
Erwin
waitting for your single sided mode :lol: .

I have a temporary ignore this problem,the artists making the scene(a very big scene,contain a lot of elements),i have tried ,and found it seems not very easy to find the problem, and i have a lots of work to do , so i abandoned....at least, the release mode is ok....(do not laugh at me lazy :P )
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York
Contact:

Re: New btInternalEdgeUtility has been added

Post by sparkprime »

It'd be good if there was an option to keep the 2-sided behaviour. Has it been established that there is a serious problem in the absence of degenerate triangles? If you have to penetrate the mesh then it could be the same bug as I was reporting with the cylinder spawning slightly within the mesh. So if you do add a single-sided mode I'll test it out too.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: New btInternalEdgeUtility has been added

Post by Erwin Coumans »

sparkprime wrote:It'd be good if there was an option to keep the 2-sided behaviour. Has it been established that there is a serious problem in the absence of degenerate triangles? If you have to penetrate the mesh then it could be the same bug as I was reporting with the cylinder spawning slightly within the mesh. So if you do add a single-sided mode I'll test it out too.
Can you please provide instructions how to reproduce this cylinder issue? A video doesn't help fixing the issue.

Thanks a lot,
Erwin
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York
Contact:

Re: New btInternalEdgeUtility has been added

Post by sparkprime »

I will try but i'm buried at the moment
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: New btInternalEdgeUtility has been added

Post by Erwin Coumans »

I improved the btInternalEdgeUtility, hopefully it works better now, in particular for single sided triangle meshes.

edl, can you please test latest trunk with your race track? By default the btAdjustInternalEdgeContacts favors front facing triangles normals. It has some optional settings for BT_TRIANGLE_CONVEX_BACKFACE_MODE.

@sparkprime: it is best to use single sided triangles, consistently front facing or backfacing. There is some experimental support for double sided triangles, enable it using BT_TRIANGLE_CONCAVE_DOUBLE_SIDED+BT_TRIANGLE_CONVEX_DOUBLE_SIDED.

Thanks for the help,
Erwin
JanK
Posts: 17
Joined: Fri Jan 08, 2010 11:40 am

Re: New btInternalEdgeUtility has been added

Post by JanK »

How does one use the utility in Bullet 2.76 ? For now i have to create the data-structure, put the pointer somewhere and do a lookup manually in a collision-callback. Is this supposed to stay that way?

I think either it should work automatically out of the box, or it should simply be a switch on triangle-meshes to enable or disable it (at creation time).

Jan.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: New btInternalEdgeUtility has been added

Post by Erwin Coumans »

Once the utility has been tested and developers are happy with it, we will do a more tight integration (after 2.76 release later this week)

Have you tried the latest version?

Thanks,
Erwin
edl
Posts: 16
Joined: Tue Jul 08, 2008 7:28 am

Re: New btInternalEdgeUtility has been added

Post by edl »

Erwin Coumans wrote:I improved the btInternalEdgeUtility, hopefully it works better now, in particular for single sided triangle meshes.

edl, can you please test latest trunk with your race track? By default the btAdjustInternalEdgeContacts favors front facing triangles normals. It has some optional settings for BT_TRIANGLE_CONVEX_BACKFACE_MODE.

@sparkprime: it is best to use single sided triangles, consistently front facing or backfacing. There is some experimental support for double sided triangles, enable it using BT_TRIANGLE_CONCAVE_DOUBLE_SIDED+BT_TRIANGLE_CONVEX_DOUBLE_SIDED.

Thanks for the help,
Erwin
i have test the latest googleCode svn ver 1945 with my race track ,it seems the new code work well,
thanks for the work! :D ,if i find problems,i will post it here.
Stillmoon
Posts: 4
Joined: Thu Dec 10, 2009 5:00 pm

Re: New btInternalEdgeUtility has been added

Post by Stillmoon »

I found a very minor issue with btInternalEdgeUtility.h. Line 5 reads

Code: Select all

#include <LinearMath/btHashMap.h>
But since I set the Bullet source directory as a user path, not a system path, I had to change it to

Code: Select all

#include "LinearMath/btHashMap.h"
The quotes appear to be consistent with all other Bullet header #includes.

I'm using SVN revision 1936 of the file.
Last edited by Stillmoon on Fri Feb 05, 2010 3:40 pm, edited 1 time in total.
scarrow
Posts: 2
Joined: Mon Mar 09, 2009 4:10 pm

Re: New btInternalEdgeUtility has been added

Post by scarrow »

I found a small issue in the case of degenerate triangles. In this loop numshared could go to 3 and then try to write a value beyond the end of the array:

Code: Select all

		for (int i=0;i<3;i++)
		{
			for (int j=0;j<3;j++)
			{
				if ( (m_triangleVerticesA[i]-triangle[j]).length2() < m_triangleInfoMap->m_equalVertexThreshold)
				{
					sharedVertsA[numshared] = i;
					sharedVertsB[numshared] = j;
					numshared++;
				}
			}
		}
My modified version looks like this:

Code: Select all

		for (int i=0;i<3;i++)
		{
			for (int j=0;j<3;j++)
			{
				if ( (m_triangleVerticesA[i]-triangle[j]).length2() < m_triangleInfoMap->m_equalVertexThreshold)
				{
					sharedVertsA[numshared] = i;
					sharedVertsB[numshared] = j;
					numshared++;
					if(numshared >= 3)
						break;
				}
			}
			if(numshared >= 3)
				break;
		}
As yet untested, but presumably fine. :)
Stillmoon
Posts: 4
Joined: Thu Dec 10, 2009 5:00 pm

Re: New btInternalEdgeUtility has been added

Post by Stillmoon »

Stillmoon wrote:I found a very minor issue with btInternalEdgeUtility.h. Line 5 reads

Code: Select all

#include <LinearMath/btHashMap.h>
But since I set the Bullet source directory as a user path, not a system path, I had to change it to

Code: Select all

#include "LinearMath/btHashMap.h"
The quotes appear to be consistent with all other Bullet header #includes.

I'm using SVN revision 1936 of the file.
This is now fixed in the svn trunk, thanks Erwin!
Post Reply