Triangle Mesh Collision

Started by
5 comments, last by godplusplus 12 years, 7 months ago
Since this project is stalled while I wait for a solution to come to me for the problem I described in my other post (http://www.gamedev.net/topic/609223-c-physics-engine-entities-tunnel-into-each-other/), I've been implementing new collision volumes. What is the cheapest way to test collision between a mesh of triangles, and something else, like a sphere or another mesh? Surely there's something faster than checking every triangle.
Advertisement

Since this project is stalled while I wait for a solution to come to me for the problem I described in my other post (http://www.gamedev.n...nto-each-other/), I've been implementing new collision volumes. What is the cheapest way to test collision between a mesh of triangles, and something else, like a sphere or another mesh? Surely there's something faster than checking every triangle.



You can bound groups of triangles together based on their locality and do AABB checks before you check all the triangles individually?

Cheers, Paul.

Thanks for the reply. One of my next efforts will be a hierarchy of bounding volumes to accomplish this. Before I started, I was just curious if there was something outlandish, like testing two triangles at once or something. But, short of that, back to brute force.
I don't know why you would say a bounding volume hierarchy is "brute force". Brute force would be to test each triangle without any attempt to minimize the number of triangles to test.

So, what are you going to test against the triangles? Are you gonna test spheres? Depending on what you're going to test is the volume you should use for your hierarchy.

Many people just go for the "hierarchy of AABBs", but this one is not necessarily the best or the most efficient.

Depending on the shapes of the meshes and what they are testing against.

For spheres, you may be better off testing against a hierarchy of spheres, since sphere to sphere collision is faster than sphere to AABB collision.

For a game I made last year, I used a spherical BVH and it worked really well to calculate collisions with spheres, rays and line segments.

But yeah, I doubt the whole process of creating a BVH is a "brute force" approach.

bluh


I did say I was going to implement a BVH. But, short of that, back to brute force. At some point, an algorithm becomes a brute force method. I can divide and divide the number of triangles, but knowing if a the test volume is within a box tells me nothing, unless I do a brute force search of all the triangles in the bottom tier of the hierarchy.

This is going off topic.
Spatial partitioning schemes are generally applied to the entities that make up the game world - however there's no reason to stop there. For each reference Shape, you can create an 'internal tree' which partitions the model all the way down to the triangle level.
To find a collision between two such entities, we perform a "dual tree walk", using the partitioning information to quickly identify potentially intersecting triangle pairs - this scheme approaches the efficiency of 'closest feature tracking' algorithms (which take advantage of interframe coherency) and can be considered as a variant 'hillclimbing' algorithm (which attempt to walk the surface features of the moving bodies to track the closest feature pair).
In C++, friends have access to your privates.
In ObjAsm, your members are exposed!

I did say I was going to implement a BVH. But, short of that, back to brute force. At some point, an algorithm becomes a brute force method. I can divide and divide the number of triangles, but knowing if a the test volume is within a box tells me nothing, unless I do a brute force search of all the triangles in the bottom tier of the hierarchy.

This is going off topic.


Funny how you completely disregard my suggestion of, you know, using spheres instead of aabbs (you know, me trying to help out, since by your wording you made it sound like you didn't know how to do a BVH and I was gonna offer my help, even sample code) you instead go directly at my comment of how your definition of brute force is flawed.
Anyway, good luck in finding that magical algorithm that checks two triangles at once (short of checking two triangles on two threads).

This topic is closed to new replies.

Advertisement