Vertex Clouds behave differently in Debug and Release

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Vertex Clouds behave differently in Debug and Release

Postby misho » Sun Nov 11, 2018 8:31 pm

I have this annoying problem - my vertex cloud collisions are working in Debug mode, but not working in Release mode... that is, in Release mode, some collision elements seem missing and some seem displaced. My cloud vertices are in a std::vector array of dVectors:

Code: Select all
vector<dVector>   vParameters;


And here is my loading code:

Code: Select all
case COLLISION_VERTEX_CLOUD:
   {
      if (bVerbose) TB_PRINTF("Vertex Cloud.\n");
      int numVertices = CollisionShape->vParameters.size();
      dFloat* const temp = new dFloat[numVertices * 3];
      int count = 0;
      for (int i = 0; i < numVertices; i++)
      {
         temp[count] = CollisionShape->vParameters[i].m_x; count++;
         temp[count] = CollisionShape->vParameters[i].m_y; count++;
         temp[count] = CollisionShape->vParameters[i].m_z; count++;
      }
      collision = NewtonCreateConvexHull(world, numVertices, &temp[0], 3 * sizeof(dFloat), 0.001f, (int)newEntity->GetObjID(), &matrix[0][0]);
      delete[] temp;
   }
   break;
...

if(collision != NULL)
   TBAddSubCollision(newEntity, objectCollision, collision);



I'm at a loss as to why this is happening, because both Release and Debug are loading the same data, and I haven't ever noticed this until I implemented vertex clouds in my code. I also have a log file (for debugging) showing the identical loading data for both Debug and Release.

In this particular case, I have 26 collision elements in a compound STATIC collision. These elements are fairly small, boxy elements with between 6-20 vertices at most, so nothing too taxing.

Any thoughts as to what this may be?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby JernejL » Mon Nov 12, 2018 5:11 am

Are you by chance using newton serialized shapes?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1451
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Vertex Clouds behave differently in Debug and Release

Postby Julio Jerez » Mon Nov 12, 2018 12:41 pm

I do not know, I was not awhere the was a problem with release and debug building compounds.
what does the debug shows?

Jernel are you using serialization?
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 1:49 pm

JernejL wrote:Are you by chance using newton serialized shapes?


No. They are custom shapes designed in 3DS MAX and exported as "x" files in text ASCII format. I read them in and construct vertex clouds. They behave as expected in Debug, but as I mentioned, fail in Release.

Just as an aside, I never found a spec for the vertex cloud, so I just assumed it is dFloat[ x y z x y z x y z ... ]. Is that correct?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 1:55 pm

Julio Jerez wrote:I do not know, I was not awhere the was a problem with release and debug building compounds.
what does the debug shows?


Debug version behaves correctly... as in, there are collision objects in the right place. In Release version, with the same scenario, objects fall through where collision objects should be. Some of the collision objects are present in the right places, and some seem to be misplaced because I get collisions where there shouldn't be any. :?:
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby Julio Jerez » Mon Nov 12, 2018 2:38 pm

I do not know how to fix that without a repro, I have never seemed that kind of bugs before.
There is no special code that work in release and no in debug and the engine build with rigorous float floating point operations.
it may be something wrong somewhere but I do not know what to say without a repro
you had made repro test cases before can you make one?
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 2:44 pm

Julio Jerez wrote:I do not know how to fix that without a repro, I have never seemed that kind of bugs before.
There is no special code that work in release and no in debug and the engine build with rigorous float floating point operations.
it may be something wrong somewhere but I do not know what to say without a repro
you had made repro test cases before can you make one?


Let me check and double check my build settings first (and get the latest build as well, I'm on an Oct 19 build) and see if anything changes. I'll let you know - thanks!
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby Julio Jerez » Mon Nov 12, 2018 3:40 pm

try getting later, there has been many important but subtle bugs fixes all originated because of the optimizations I made to the broad phase in the last months.
people has reported them and many of them has being fixed as they get reported.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 3:47 pm

Julio Jerez wrote:try getting later


Sure - can you let me (us) know when it is ready, please?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby Julio Jerez » Mon Nov 12, 2018 3:52 pm

is ready now.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 4:01 pm

Great, thanks - will report findings.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 4:29 pm

Julio, just a quick question:

What is the behaviour if the two bodies are initially placed so that their collision volumes overlap, and then physics engine kicks in?

Do they repulse each other (like two magnets on the same poles let loose)? or just ignore the overlap?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby Julio Jerez » Mon Nov 12, 2018 4:56 pm

they will move apart based of the minimum distance that resolves the interpenetration.
No sure what happens with compounds, because compound are considered convex simply because they are made of convex pieces, but it is possible that at each step the minimum translation distance of a compound is not a monotonicfucntion, which is a property of convex shapes.
to be safe is best to place then not in deep penetration.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 5:19 pm

Ok, thanks. I assemble my objects (using "hard" hinges) with small gaps to avoid overlaps. I was just checking on the behavior.

FYI, I implemented vertex clouds so that I can more easily build tubular objects out of "planks". This is crucial because parts of rocket components must fit inside other rocket components. I'm just hoping I'm not getting these problems because of the way I'm constructing compounds. Here's the setup I have on one of the components: Red are "primitive" components (7 parametric cones in this case) and blue are "planks" - 16 x 8-vertex cloud collisions...
Image
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Re: Vertex Clouds behave differently in Debug and Release

Postby misho » Mon Nov 12, 2018 10:17 pm

Ok - I updated to the latest, and still the same behavior :roll: . I will see if I can make a test case ASAP.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 552
Joined: Tue May 04, 2010 10:13 am

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 16 guests

cron