NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.13

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Windrider » Tue Jan 12, 2016 3:21 pm

OK, i will check too... it should all be tri-sided polygon and my function was created as such but maybe I made a mistake in the mesh creation in blender.
Windrider
 
Posts: 22
Joined: Mon Nov 02, 2015 2:34 pm

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Jan 12, 2016 4:07 pm

are you sure you poste the correct meshes? the last two mesh are identical, neither one have uv.
only 6 quads, made of 24 vertices.
my guess is a box.

OK, i will check too... it should all be tri-sided polygon and my function was created as such but maybe I made a mistake in the mesh creation in blender.

variable side polygons should work, there are to possibility
either I have a bug when calculating the space when there are variable size polygoins,
or your function to crate the mesh has a bug and it is confused when there are UV or other data.
the fact that there are uv no should make no different make no difference,
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Jan 12, 2016 4:13 pm

Just make sure you list a mesh that actually cause the crash and give the time to test t.
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Windrider » Tue Jan 12, 2016 4:24 pm

The posted mesh were the one givin the crash. They are indeed identical except for the UV coordinates, and yes, it is a simple box! :)

I am testing on my side as well and I indeed think that the problem lies within TV3D engine.

My guess is that the triangles/vertex information I get from an .x file with or without the UV coordinates is different therefore reacts differently when I build the collision tree. I will code a method to drop these info per vertex in the console to confirm.
It indeed makes no sense as UV coords should not affect the vertex info but I can now reproduce the error by ticking on/off the UV coordinate export in blender.

Thank a lot for your support, even better that the issue is not in Newton! ;)

I will confirm and get back to correct this post as such.
Regards
Windrider
 
Posts: 22
Joined: Mon Nov 02, 2015 2:34 pm

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Windrider » Tue Jan 12, 2016 7:07 pm

Apologies,

When switching from newton 3.13 to 3.14, I as well changed a lighting setup in my TV3D mesh and this option affects the GetTriangle information output. Very weird bug!!
I guess this is payback for using a dead 3D engine and being to lazy to upgrade to something else! :)

Once again, thanks for your support which help me to identify my issue and proved once again that Newton is an awesome physic engine with great support! You don't see this quick devotion on many forum!

Cheers
Windrider
 
Posts: 22
Joined: Mon Nov 02, 2015 2:34 pm

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 12:50 pm

I get the same crash here when I load a simple 3ds mesh.
In debug mode, with the optimization it give the dgArray "i >=0" error.
Without the optimization I get the 0xC0000005: Access violation.
If I compile in release mode all work like the normal.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Apr 05, 2016 1:06 pm

David you mean you get a crash in debug but no in release.

This usually means that the memory location is different, by is trashing memory and tha't no good.
could you tell me what line that crash is happing.
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 1:19 pm

The error come from dgCollisionBVH.cpp when it do the CalculateAdjacendy();

Code: Select all
void dgCollisionBVH::EndBuild(dgInt32 optimize)
{
   dgVector p0;
   dgVector p1;

   bool state = optimize ? true : false;

   m_builder->End(state);
   Create (*m_builder, state);
   CalculateAdjacendy();
   
   GetAABB (p0, p1);
   SetCollisionBBox (p0, p1);

   delete m_builder;
   m_builder = NULL;
}


Code: Select all
void dgMemoryAllocator::FreeLow (void* const retPtr)
{
   dgMemoryInfo* const info = ((dgMemoryInfo*) (retPtr)) - 1;
   dgAssert (info->m_allocator == this);

   dgAtomicExchangeAndAdd (&m_memoryUsed, -info->m_size);

#ifdef _DEBUG
   memset (retPtr, 0, info->m_workingSize);
#endif

   m_free (info->m_ptr, dgUnsigned32 (info->m_size));
}


The final error happen in the memset (retPtr, 0, info->m_workingSize);
Edited: this is when the optimization is set to 0.
Last edited by Dave Gravel on Tue Apr 05, 2016 1:57 pm, edited 1 time in total.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 1:33 pm

Ok I find something...
In the dgAABBPolygonSoup.cpp in the void dgAABBPolygonSoup::CalculateAdjacendy ()
At line 520 you have if (normalCount) {
In release mode the normalCount is ok.
In debug mode the normalCount is 0.
The error come from this.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Apr 05, 2016 2:09 pm

this is what is at line 500
Code: Select all
   if (normalCount) {
      dgStack<dgInt32> indexArray (normalCount);
      dgInt32 newNormalCount = dgVertexListToIndexList (&pool[0].m_x, sizeof (dgTriplex), sizeof (dgTriplex), 0, normalCount, &indexArray[0], dgFloat32 (1.0e-6f));

are you saying that in debug mode, is normal count is zero, the code crashed after that?

Is a long time that I wrote that, but what looking at it again, It seem to me that normal count should never be zero, if there is a list one face. only that normal count mean something else.

I will try making normal count zero and see if the crash happens.
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Apr 05, 2016 2:34 pm

umm when I set normalCount to zero, it does no crashes here.
I suspect that they is some stack memory overrun that why you do no get the line where is crashes.

Can you give a sample of a mesh that causes the crash?
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 2:54 pm

You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Julio Jerez » Tue Apr 05, 2016 3:03 pm

can you save the mesh that reproduce the bug, so that I can debug it.
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 3:21 pm

Here my mesh.
https://sites.google.com/site/evadlevarg/Level01.zip

I'm not a very good modeler, maybe something is wrong in my mesh hehe..
I create it with blender3D.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: NewtonTreeCollisionEndBuild - Crash with 3.14 but not 3.

Postby Dave Gravel » Tue Apr 05, 2016 3:48 pm

I don't think it coming from the mesh.
I save a box or a plane from blender to 3ds the same error happen with both.
Maybe it coming from the way how I fill the CollisionTree.

Edited:
Forget it Julio the problem don't come from newton, it come from my mesh loader in debug mode.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 713
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest