Thanks for your insights both!
Quote
but what is preventing you from using a mixture of CCD and DCD?
Nothing other than I'd hoped there was something more performant. This is in fact what I have written for now: a Ray Triangle intersection for CCD with Closest-Point-On-Triangle for DCD.
Quote
The capsules are aligned along the triangle normal, so the long part is hidden inside the skin
Interesting system! It sounds similar to Qian et al's circumsphere. I was thinking of trying something like this.
Quote
Personally i don't believe triangle vs. vertex can ever work
I suspect this as well.
When considering collision detection techniques though I always mentally compare them against the ideal (and most correct) triangle based system. The problem is this is always hypothetical (and I am bad at estimating performance), so I have decided to build a triangle based system for bench-marking.
If it turns out fast enough to use that's a big bonus, as there are some advantages of triangle meshes over sphere/point based representations, such as better friction emulation.
It didn't occur to me before that what is really needed for a penalty force based response (which I think is the nicest approach because it automatically handles numerical precision error and cloth offset/arbitrary particle size) is a moving-sphere-triangle test, as opposed to a point triangle test, so I've been reading about these.
Since there doesn't seem to be a consensus on the best, I decided to do some performance tests. I picked a few algorithms and put them in a test rig. They were refactored to remove most of the early returns to better emulate behaviour on a GPU. The test rig was configured to generate 100000 rays or so cast into a volumne containing a triangle, then across multiple repeats with multiple particle sizes their execution times were measured.
The algorithms I tested are below, not all of them were 100% working as this is preliminary, but they were working enough I am comfortable using the measurements as a guideline.
1. Moller-Trumbore with a distance offset.
Used as the benchmark. The intersection distance is adjusted so its always a set distance above the surface of the triangle. Not a proper implementation because the ray must still hit the triangle.
2. Flip Code
Implementation I found here: http://www.flipcode.com/archives/Moving_Sphere_VS_Triangle_Collision.shtml
3. Fauerby
Fauerby's intersection test. This didn't work as written, possibly porting mistake.
4. Eberly
Eberly's intersection test (https://www.geometrictools.com/Documentation/IntersectionMovingSphereTriangle.pdf). This didn't work as written as some of the pseudocode functions are missing.
5. Geometric
My own implementation. Uses geometric tests against primitives approximating the Minkowski sum of the radius and triangle, as opposed to finding roots like most of the others (though cylinder intersection still requires it)
The results (in microseconds, per ray)
Algo Avg (us) StdErr (us)
_____________________________________ _______ _________
MollerTriangleCollisionDiagnostics 0.76056 0.0019454
GeometricTriangleCollisionDiagnostics 2.29 0.0094226
FlipCodeTriangleCollisionDiagnostics 2.8112 0.010876
FauerbyTriangleCollisionDiagnostics 1.4425 0.0035103
EberlyTriangleCollisionDiagnostics 6.3413 0.019937
Interesting to start with. I am glad the Geometric solution is competitive, because conceptually its simple and more hackable than the root finding methods I feel anyway (I can sort of imagine how DCD could be integrated with it already). I think its worth trying to fix Fauerby's, being only half as slow as a basic ray-triangle intersection despite doing considerably more. Eberly's I won't pursue, given that I want a GPGPU implementation eventually and its not a fair comparison after I've gutted all its optimisations!