[ODE] Latest CVS with VC++ workspace

Erwin de Vries erwin at vo.com
Fri Jul 4 10:02:02 2003


> - In the sphere-mesh contact generation code I see you do the
> sphere-triangle collision again (with code "ripped from opcode 1.1"). In
> Opcode 1.3 I have a special mode especially thought for this case. You can
> actually disable the final sphere-triangle tests on the Opcode side, since
> you're doing them again to derive contact data. Just add :
>
>  Collider.SetPrimitiveTests(false);
>
> Should go a little bit faster.

You missed it. Line 104 in collision_trimesh.cpp.

> - Beware of temporal coherence. The nasty O(n) loop to find the correct
> cache might very well kill your gains (sphere-mesh is fast already,
> especially on that small bunny). I use another approach in my engine : I
> have a single cache / sphere. The trick is to invalidate the cache as soon
> as the sphere collides with a new mesh. It works well since usually a
single
> sphere collides with the same (usually bigger) mesh for several frames.
You
> lost coherence (falling back automatically to normal mode) when the sphere
> collides simultaneously with multiple meshes.

The O(n) loop sucks indeed. I would like to replace it with something faster
where n is large. The situation you describe is very dependant on the way
you're using the trimesh. I for instance use it to build a tree of a
~250.000 triangle tree instead of lots of small meshes. But i could make the
caches a static member, to prevent insane memory trashing in these
situations.

> - For box-mesh, temporal coherence can actually be *slower* if the contact
> generation code is very expensive. Typically temporal coherence gives more
> triangles to analyze for contact points, so it's only a clear win when the
> contact generation code is fast, as in sphere-mesh. [Now I'm only saying
> this because *my* box-triangle contact code is very exepensive, I don't
know
> about Erwin's one]

I indeed thought about this, and came to the same conclusion that it might
be slower this way. Actually it may be faster to create a fat AABB, and use
that instead.

> In any case those are probably small optimizations that won't make a lot
of
> differences (unless you have 200 spheres on a huge terrain, there it helps
a
> lot).

Which is indeed the thing i'm doing.

> Else my favorite is TC + hybrid trees....

I have not experimented with the new features yet.

Erwin

Ps. Any chance you'll ever release your trimesh-trimesh contact generation
code? I saw it on your page somewhere once.