Since 6.0, Obi includes an advanced collision detection pipeline that will noticeably improve collision detection accuracy. You can use surface collisions with regular cloth, ropes and rods. Surface collisions for softbodies will likely be added in the future. Fluids are not compatible with surface collisions.
You can activate surface collisions in your actor's inspector:
For the most part, you can just enable them and be done with it. However there's some things to keep in mind when choosing surface collisions over regular, particle-based collisions. Also, contacts will contain slightly different information for actors using surface collisions, this is worth noting if you're using contact callbacks.
If you are using surface collisions for an actor, chances are you can the reduce the amount of particles used in it. This will improve convergence speed and performance (since there's less particles and constraints to work with). For instance, reducing rope resolution and enabling surface collisions will result in a rope that's both faster and more robust. The same concept applies to cloth: thanks to surface collisions, lower resolution cloth can be used while maintaining high collision detection accuracy.
Particles that are close to self-intersecting at rest will force the pipeline to perform a lot of self-intersection tests. This will negatively affect performance. It's better to use smaller particles, this will both improve performance and reduce contact gaps between the cloth and collider surfaces. Obi's continuous collision detection will take care of tunneling when using small particles.
Surface collisions work by generating contacts between simplices, instead of individual particles. A simplex could be intuitively defined as the simplest possible convex shape in a given n-dimensional space.
By generalizing particles (points) to higher-order simplices, gaps in between particles disappear and the actor becomes a continuous surface. This allows for robust collision detection even with very few particles per actor. Ropes/rods use edges (aka lines, aka 1-dimensional simplices) to fuse particles into a smooth, continuous cylindrical surface. Cloth uses triangles (aka 2-dimensional simplices) to fuse particles into a smooth, flat continuous surface.
When surface collisions are disabled, all particles are considered points (aka 0-dimensional simplices). So, the traditional particle-based collision pipeline is just a particular case of surface collisions where all simplices are 0-dimensional.
Simplices are defined and stored in blueprints as particle index tuples. For instance, the simplex <1,3,4> is a triangle using particles 1, 3, and 4 as vertices. Simplex <7,8> is a line using particles 7 and 8 as vertices. Particle properties such as radius, mass, or velocity are interpolated over the surface of the simplex using barycentric interpolation, just like varying variables (eg. per-vertex colors) are interpolated to fragments in a rendering pipeline.
Let's take a look at how the 3 collision pipeline phases are altered when dealing with simplices instead of particles:
The broadphase works exactly like it does for particle collisions: all simplices are inserted into a spatial acceleration structure, then collision pairs are generated by testing for bounding box intersections and potential collision courses. It just deals with simplices instead.
Once a potentially colliding pair (simplex-simplex or simplex-collider) has been detected, instead of performing a point-point or point-collider distance test Obi uses an iterative convex optimization algorithm (the Frank-Wolfe algorithm) to determine the actual contact point. This algorithm starts by guessing the contact point to be at the simplex barycenter, and progressively refines this guess over multiple iterations until a error tolerance threshold is reached. You can control the amount of iterations used as well as the tolerance threshold in the solver.
There's three good reasons to use iterative optimization instead of closed-form intersection tests:
To resolve a collision, the position of the simplices involved in the contact needs to be adjusted. This is done by calculating a position delta for the contact point, and interpolating it back to the particles using barycentric coordinates.
Simplices sharing at least one particle will not collide with each other, to avoid constraint fighting. For ropes this is not a problem at all. For cloth however, it can cause vertices to miss collisions against adjacent triangles. This is generally not an issue as it only takes place at the edges of crumpled cloth with close to zero bending resistance, where unsolved self-intersections are not apparent to the naked eye.
Only one contact will be generated for each simplex-collider pair, at the closest points between both. This is no problem for most convex colliders (since two convex shapes can only have one contact manifold) but for concave colliders it can cause missing collisions in some situations, specially where "pointy" collider features are smaller than a single simplex. This is often not an issue as any unsolved collisions are generally detected and resolved in subsequent frames, but can result in jittering.