Collision Against Uniform Grid (Voxel) Without Creating Mesh

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 7:07 am

Ok here is a patch or a mesh as defined by the collision system. The mesh do no have to be a triangular, it only nee to be made of convex faces
triangleMesh1.png
triangleMesh1.png (15.44 KiB) Viewed 4820 times


I0, i1, i2, i3 are the indices to the vertices of the face indices
M0, in the material assigned that the center face
N is the index to the face normal
N0, N1, N2, N3 are the normal of the adjacent face that share the respective edge to the center face, I call it the edge adjacent normal
A Is the length of the of the larger diagonal of the face, rounded up to the nearest integer.

when a face does no have adjacent face at an edge, the that edge adjacent normal is set to N, the same face normal.

for a voxel data all this values can be synthesized on the flight in the callback from lookup tables based on the cell number.
That's how the terrain collision does it .
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby PJani » Tue Oct 08, 2013 7:15 am

Oh now i understand it :D thnx for the img :)

Hmm you think the vertexes could be generated on the fly? What about large objects? Then i need to load more vertexes. I am looking performance wise.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 8:40 am

Ok the user mesh collision is back working now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Tue Oct 08, 2013 9:00 am

Thanks for getting them working again. I can take a shot at it now. I may need some help but the general idea is to not store an actual mesh for the whole level but generate a small set of faces on the fly in the callback to collide against?
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby PJani » Tue Oct 08, 2013 9:03 am

Yep...also it might be a good idea to use somekind of caching because newton would use same chunk of faces few times before you might need to generate new set of faces.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 9:14 am

you can implement the caching yes, in my view caching provides very little gain on performances, at the expense of lots of memory and complex algorithm.
I would go for the simplicity first and use that as control test, then implement caching and compared to the non cached .

Remember collection the face is usually the fastest part of the collision, each time a body move, contact have to be recalculated, and that cost a lot more than getting the faces.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Tue Oct 08, 2013 12:26 pm

I can work around it but just a heads up that scaled collision shapes don't collide against user meshes. You can replicate it in the ConvexCast demo by replacing the scene collision with the infinite plane. There's only a small area the falling box can collide with, throw it out a bit and it goes straight through the floor. So I guess the collision is working but scaling isn't being taken into account somewhere in the user mesh.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 12:35 pm

you can always keep the scale and bake the scale on the user mesh.

But I believe it should work.
Anyway I will verify tonight, I am late for work now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Tue Oct 08, 2013 12:38 pm

Sure. Just pointing out the problem if you wanted to fix it.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 1:02 pm

what are you scaling, the user mesh of the colliding shape?

They both be should be working, but I will verify tonight.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Tue Oct 08, 2013 1:21 pm

The colliding shape. Just replace the floor of convex shapes with the infinite plane in the ConvexCast demo to replicate it.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 1:51 pm

Ha thanks, I will try that and see what's wrong.

assuming not scaling, do you think the user mesh could work for you?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Tue Oct 08, 2013 2:03 pm

It's hard to say right now. It's going to take me a while to get it working because I'm not too good at maths. It does seem like the best way to go about this though, my only worry is that it may be slow to create all the faces for a very large object that touches a lot of the level. My game wont need that though so it shouldn't be a problem.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Julio Jerez » Tue Oct 08, 2013 5:11 pm

the scale bug is fixed.

build a path of quad for can no be any slower than, you buildh when you cnnage the model. The engioen doe shat for terrain highfield and that is no a factor at all.

But in any case you are the only one who knows what is best for your game.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Against Uniform Grid (Voxel) Without Creating

Postby Layla » Thu Oct 31, 2013 1:17 am

Sorry it took so long, I was working on other things but I managed to get this working. Generating a patch of faces in a user collision is by far the best solution I've tried so far. I haven't even merged faces together yet and it's faster than anything I've tried before, has very little memory usage and I don't need to edit the collision when geometry is added to the map - it just works.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron