Compound collision problems after upgrading to newer build

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Fri Jun 07, 2019 4:46 am

Fixed audio issues: https://we.tl/t-zN97mVXuM0
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Fri Jun 07, 2019 9:59 am

I tested for few hour with server button, not assert
I actually removed that assert since is the only place where is used, the other branch also uses it and do not has the assert neither are all other functions.

Go ahead sync and try again, it should be fine now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Sun Jun 09, 2019 10:42 am

Ran a test for over a day with old release dll before assert was removed - no problems, looks good and stable, i will now run the updated debug build for a day.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Mon Jun 10, 2019 2:31 am

I was hurrying so much yesterday that i ran the demo without looking if it worked at all, this now happens - but it happens during startup of the game when building trimeshes, inside NewtonTreeCollisionEndBuild call:

Code: Select all

Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: ..\..\dgCore\dgPolyhedra.cpp
Line: 1129

Expression: deleteCount < dgInt32 (sizeof (deleteEdge) / sizeof (deleteEdge[0]))



call stack:

Code: Select all
>   newton.dll!dgPolyhedra::MarkAdjacentCoplanarFaces(polyhedraOut={...}, face=0x17e35e60, pool=0x183f7060, strideInBytes=32) Line 1129   C++
    newton.dll!dgPolyhedra::OptimizeTriangulation(vertex=0x183f7060, strideInBytes=32) Line 1401   C++
    newton.dll!dgPolyhedra::Triangulate(vertex=0x183f7060, strideInBytes=32, leftOver=0x022c8490) Line 1502   C++
    newton.dll!dgPolyhedra::ConvexPartition(vertex=0x183f7060, strideInBytes=32, leftOversOut=0x022c8490) Line 2735   C++
    newton.dll!dgPolygonSoupDatabaseBuilder::FinalizeAndOptimize() Line 367   C++
    newton.dll!dgPolygonSoupDatabaseBuilder::Optimize(faceId=0, faceBucket={...}, source={...}) Line 669   C++
    newton.dll!dgPolygonSoupDatabaseBuilder::End(optimize=true) Line 481   C++
    newton.dll!dgCollisionBVH::EndBuild(optimize=1) Line 100   C++
    newton.dll!NewtonTreeCollisionEndBuild(treeCollision=0x1815b500, optimize=1) Line 3317   C++
    TDC.exe!004b570e()   Unknown



This is a simple text geometry file with the geometry that crashes:

https://we.tl/t-fpfruTFXyw
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Mon Jun 10, 2019 9:08 am

did you sync last night. I found a bug in function rarely use function
void dgDownHeap<OBJECT,KEY>::Remove (dgInt32 index)
that cause the heap condition to become illegal and I enable the sanity check temporality, to check it out. the problem is that I do not have almost a single test tha check that
I nee to make one.
I will be really really slow, so I have to disable that check afte I fix the function remove.

I just try your demo and it took about had an hour to load with the check, so I place only on the Remove function whi is rare. I do no get any assert or crash in the demo I have.

can you sync again and test, and please send me a demo that reproduces the bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Mon Jun 10, 2019 9:16 am

I can see that the assert comes from one of the two places when remove is called,
but after looking at the call I am see the function removes the last element not intermediate ones,
so is should never fail. Maybe this is a diffrent problem

please sync so you get the version that is not so slow, and if you get the assert please send me the demo that reproduces it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Mon Jun 10, 2019 9:53 am

ok if you Sync after this post, the bug in the remove function is fixed now.

That bug was probably reason why in some cases and optimized mesh had a strange form face.
by since is was so rarely called I never noticed it, the function is use only for optimized polygonal meshed and for build voronoid convex destruction.
anyway I believe is foxed now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Tue Jun 11, 2019 5:12 am

nope, with latest git pull, it still triggers the assert:

Code: Select all
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!

Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: ..\..\dgCore\dgPolyhedra.cpp
Line: 1129

Expression: deleteCount < dgInt32 (sizeof (deleteEdge) / sizeof (deleteEdge[0]))


demo build: https://we.tl/t-NJ3oWPJB3D
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Tue Jun 11, 2019 7:57 am

ha this is nice side effect of that heap bug fix.
the optimized is one that uses that heap delete function for when a heap became too large and need to remove dead edges.
Since the old delete function could break the heap condition the, in the case of large grids mesh like you use, the function was simply termination with a suboptimal polygonization of a triangular mesh.
now that the heap is correct, the function keeps adding more face as long as they are flat and has the same face id.

the buffer is local and was set to 4096 elements. I made it 8 time larger, that should be sufficient for very big flat meshes, but if assert again, then I will have to replace it with a dgArray.
the reason I use the stack make less memory fragmenting.

anyway sync again and if you can check your polygonal optimization should be a little nicer, with few edges that could clearly see could be removed but that for some reason the optimized missed.
that's not to say there will still be not more of those edges because the conditions for merging two coplanar faces are strict, otherwise the collision with convex faces fail miserably.

any way please sync and try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Tue Jun 11, 2019 9:57 am

Excellent! the crash is gone and meshes do look more optimal now, me and my weird use of newton for a top down game :)

I hope to one day implement user mesh for map since that would probably be faster, even if shapes would be less optimal - but i still don't understand how that works, and last time i tried this, i had crashes and a lot of difficulties in implementing raycast part.

An idea: maybe user mesh could use null pointer for rayHitCallBack and in that case use NewtonUserMeshCollisionGetFacesInAABB data for raycasting directly - newton could just raycast those polygons that app return?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Tue Jun 11, 2019 10:31 am

can you post a picture of the wire frame now.
also what do you mean by this.
I hope to one day implement user mesh for map since that would probably be faster, even if shapes would be less optimal - but i still don't understand how that works, and last time i tried this, i had crashes and a lot of difficulties in implementing raycast part.


do you make the mesh procedurally by some algorism?
in any case it onle affect that loading wich you can save by serializing the tree an will be almost instantaneous.

speed wise ther will be not difference. in fact collsion tree may be far faster since is generate fewer faces to collide with unless you can produce you faces already optimal precedurally.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Tue Jun 11, 2019 2:37 pm

map is a kind of voxel actually, each block in grid has a model shape and various side textures.
A trimesh grid is totally fine, but optimized mesh is probably better in the end.

loading from serialization takes a fair amout of time, game will rebuild its serialized cache each time newton.dll checksum changes, and will report this in the loading text log.
When you run it 2nd time, it will be much faster, but it still takes a fair amout of time to load serialized meshes, since there are a lot of them - see data\maps\cache folder.

Game can visualize the newton mesh, press F1, then go to debug controls, then check draw newton map.
if you want solid rendering, check draw newton materials - that draws face colors based on shapeID.

it can also show car and object shapes, check draw newton entities checkbox for that.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound collision problems after upgrading to newer bui

Postby Julio Jerez » Wed Jun 12, 2019 12:01 am

ah I see.
I did the final optimization on the heap. now Remove is also logn(n) time complexity

I did teh F1 thing and yes the work mesh is near perfect. I would say that indeed is the most optimal convex decomposition of a mesh according to Voronoid triangulation criteria.
The voronoi method triangulate the mesh is such way that each triangle have the maximum surface area which lead to the less possible triangulation of teh mesh. of course this is on teh ideal case, the boundary condition impose constrain the most be respected, so the mesh is not optimal on that regard, but this one is pretty darn good, I am very proud of the result.

anyway if you sync thsi will be the last update on this issue.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound collision problems after upgrading to newer bui

Postby JernejL » Wed Jun 12, 2019 7:05 am

Tested: The deserialization is now lightning fast, althru takes slightly longer to optimize meshes themselves, but this is a good tradeoff :)

I plan to change engine to use one mesh per world section - currently, i used separate meshes for walls, water and floor but that is still from times before faceID was availible.

I use faceid a lot now - from truck & trailer trick to get some things conditionally collidable,
but i also use faceid to have parts of map that is solid for cars, but i ignore when doing raycasting for bullets - so i have wall fences you can shoot thru :)

For map, faceid corresponds to a texture material - like metal, wood, concrete, dirt..
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests