Dealing with intersection artifacts

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Dealing with intersection artifacts

Postby Julio Jerez » Sun Feb 19, 2012 5:35 pm

Ha I see the propblem now, in this function,
Code: Select all
NewtonMesh* CreateVisualMesh (NewtonBody* const body, char* const name, int maxNameSize) const
{
NewtonCollision* collision = NewtonBodyGetCollision(body);
mesh = NewtonMeshCreateFromCollision(collision);

return mesh;
}

you have to write a name of the mesh, something like this
Code: Select all
NewtonMesh* CreateVisualMesh (NewtonBody* const body, char* const name, int maxNameSize) const
{
Strcpy (name, “myMeshName”);
NewtonCollision* collision = NewtonBodyGetCollision(body);
mesh = NewtonMeshCreateFromCollision(collision);

return mesh;
}


If you do not, then the variable name is undefined and it will write until in find a zero
This is whe the funtion is call from.

Code: Select all
void dScene::NewtonWorldToScene (const NewtonWorld* const world, dSceneExportCallback* const visualContext)
{
   // search for all collision mesh and create make a dictionary
   dTree<dSceneNodeCollisionPair, NewtonCollision*> dictionary;
   
   dScene::dTreeNode* const materialNode = CreateMaterialNode (GetRootNode(), 0);
   for (NewtonBody* body = NewtonWorldGetFirstBody(world); body; body = NewtonWorldGetNextBody(world, body)) {
      NewtonCollision* const collision = NewtonBodyGetCollision(body);
      dTree<dSceneNodeCollisionPair, NewtonCollision*>::dTreeNode* node = dictionary.Find(collision);
      if (!node) {

         //NewtonMesh* const mesh = NewtonMeshCreateFromCollision(collision);
         char meshName[256];
         NewtonMesh* const mesh = visualContext->CreateVisualMesh(body, meshName, sizeof (meshName));

As you can see mesName is a local variable that is not initialized,
This is my fault because I probably has to initialize it with some default value.
Or better break the call back into two, one for getting the name and one for getting the mesh, that way there is not confusion.

Can you try input a null terminated string on the name field, just to see and see if it works.
I will try to run the demo with a gravity of -30. And see what happens.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Sun Feb 19, 2012 6:18 pm

As you can see name is a local variable and is no initialize,
This is my false because I probably has to initialize with some default value. Or better break the call back into two, one for getting the name and one for getting the mesh, that way they is no confusion.

No, that was my bad. The original example code you showed me did have the name variable initialized but I forgot to do it. Sorry about that.

I made a new version of the simplified scene. http://www.hurleyworks.com/downloads/high_energy_poppers.zip
As expected this version doesn't crash on load in the Newton SDK demo app but the camera needs to be moved back in order to see the scene clearly.

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

Re: Dealing with intersection artifacts

Postby Julio Jerez » Mon Feb 20, 2012 9:31 am

bill, give me a few day so that I can complete the feature I am working now.
I have i a separate branck, and I am having many conflict with source controll, with teh lates version.

bascially I can not check in and I can not synck the version you are working.
I need to bring the corrent funtionality to a stable point so that I can integrate all three branches

basically I have four corrent brachne
-the thread
-the AVX solver,
-and the vehicle
-and the collision intansce

all have difrent on teh same core file, so it ie veboming hard to chek it new files.
I need to complete the collsion instance, so that I can sync all branches without having to merge core files.

bascially I am generalizing the collison modifier, so that each shape sopput non uniform scale.
teh will alsop allow for collsion to have user data and it will eliminate the reference counting on collision shape.

I never like the ref counting anyway, and also teh collsion inteface has too many funtion, stuff liek makeunique, GetReference, etc has no place with the engine.
but that's no teh onley benefit.
it will allow for static collision to be shared, and scaled. all collision will support non uniform scale.
I will also allow for the offset marix and the scale to be modified at run time.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Mon Feb 20, 2012 10:54 am

Sounds interesting! Please let us know when you're ready for us to try it out

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

Re: Dealing with intersection artifacts

Postby Julio Jerez » Mon Feb 20, 2012 11:47 am

yes, of course.
thsi si a funtionality that I have being neglcting for years.

General Scale, and teh ability to modific teh matrix is will add lot of flexibility to the engine.
also increase performance since many shape can be reuse the iundeline adjacenty with put having to duplicar the data.

until now I could not do that sine I was usin the matrix of a shape as part of the CRC hash for caching shape.
but the instance layer solve that very nicelly.

you can for exampel have tow boxes of diffrent size, each with diffrent id and user data, and they are still teh same box intenally.
the user data make it possible that there is not need for Triggers since all teh app has to do is to se a user data in the shape and check for that in the callback.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Julio Jerez » Tue Feb 28, 2012 1:00 pm

Oh wow, I made a huge mistake tryin to mak eteh collision inatnce base instead of ref counte base all in one step.

There are too made changes, an dit n acase huge problems.
what I am goin to do is that I will make it incrementally.

I will save the code and start adding one funtionality at a time untill a switch compelley, righ now if I cjeh tshi montrosity I am sure I will braek a lot of stuff.

I will doit in stap at a time starting form teh top. and kjeep teh whiole engien wroki at all time.

so let us solve that bug. what tha energetic bug first, this is much more important.
But first update, because I added few changes that will will need
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Tue Feb 28, 2012 6:00 pm

so let us solve that bug. what tha energetic bug first, this is much more important.
But first update, because I added few changes that will will need

I downloaded the latest SVN 1598 but coreLibrary_300 doesn't compile using vs2008. Here's some of the error messages:

Bird

------ Build started: Project: physics, Configuration: release x64 ------
Compiling...
dgCollisionInstance.cpp
c1xx : fatal error C1083: Cannot open source file: '..\..\..\source\physics\dgCollisionInstance.cpp': No such file or directory
dgCollisionConvexPolygon.cpp
..\..\..\source\physics\dgCollisionConvexPolygon.cpp(25) : fatal error C1083: Cannot open include file: 'dgCollisionInstance.h': No such file or directory
Generating Code...
Build log was saved at "file://e:\Depenencies\NewtonTrunk\coreLibrary_300\projets\windows\project_vs2008\x64\physics\release\BuildLog.htm"
physics - 2 error(s), 0 warning(s)
------ Build started: Project: physics, Configuration: release Win32 ------
Compiling...
dgCollisionInstance.cpp
c1xx : fatal error C1083: Cannot open source file: '..\..\..\source\physics\dgCollisionInstance.cpp': No such file or directory
dgCollisionConvexPolygon.cpp
..\..\..\source\physics\dgCollisionConvexPolygon.cpp(25) : fatal error C1083: Cannot open include file: 'dgCollisionInstance.h': No such file or directory
Generating Code...
Build log was saved at "file://e:\Depenencies\NewtonTrunk\coreLibrary_300\projets\windows\project_vs2008\Win32\physics\release\BuildLog.htm"
physics - 2 error(s), 0 warning(s)
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Dealing with intersection artifacts

Postby Julio Jerez » Tue Feb 28, 2012 6:11 pm

Maybe I foget to check the project file, I will verify tonoght.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Julio Jerez » Wed Feb 29, 2012 10:09 am

Ok I chek in the project file
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Wed Feb 29, 2012 11:21 am

Julio Jerez wrote:Ok I chek in the project file

coreLibrary_300 still doesn't compile cleanly using vs2008. Looks like the problem is that both dgPhysics.h and dgCollisionConvexPolygon.cpp still reference dgCollisionInstance.h which isn't included in the library anymore. Also the vs2008 project file still contains references to both dgCollisionInstance.h and dgCollisionInstance.cpp

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

Re: Dealing with intersection artifacts

Postby Julio Jerez » Wed Feb 29, 2012 12:00 pm

Oh I see I had not added the dgCollisonInstance to SVN, that was the bug
My mistake, I will do it tonight, sorry abpuy that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Julio Jerez » Thu Mar 01, 2012 10:26 am

ok, try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Thu Mar 01, 2012 11:11 am

Julio Jerez wrote:ok, try again.

Worked perfectly!

Here's the simplified scene using SVN 1602 that produces those high-energy bodies : http://www.hurleyworks.com/downloads/highEnergyPoppers.zip
Remember to set gravity to -30 since that's what t I was using for this test http://www.hurleyworks.com/media/flash/Poppers/Poppers.html

If you have any other ideas for scenes that would help you diagnose the problem, I'll be happy to try to create them.

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

Re: Dealing with intersection artifacts

Postby Julio Jerez » Thu Mar 01, 2012 1:01 pm

those pops are unceptable, I will give that high priority.

I will make a modificaltion to teh scene loade so that I frame the sence in camera and also read the gravity setting.
Then I will reasve teh scen and debug that bug, I have negeleted for too long and it is quiet bad.
anyway I will do that this weekend,m hopplly si no more than a day.

setting a hight gravity seems to expose it more quickly so thats good to know.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dealing with intersection artifacts

Postby Bird » Sun Mar 11, 2012 12:31 pm

In case you're not aware, the versions after SVN 1618 don't work again using SSE. Here's a video that shows what happens. http://www.hurleyworks.com/media/flash/CollisionTreeProb/CollisionTreeProb.html

The occasional high energy pieces still are there, but the first piece penetration problem is gone. When NewtonSetPlatformArchitecture is set to 2, then the boxes just fall through the NewtonTreeCollision mesh.

Also, can you suggest a way to keep the pennies from continuing to settle down in the last part of the animation.? It doesn't look very realistic to me ... I tried increasing friction without success
http://www.hurleyworks.com/media/flash/RevenueStream/RevenueStream.html

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

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 3 guests

cron