Optimized Collision Detection



OPCODE is a new small collision detection library. It is similar to popular packages such as SOLID or RAPID, but more memory-friendly, and often faster.





-         C++ interface, developed for Windows systems using VC++ 6.0

-         Works on arbitrary meshes (convex or non-convex), even polygon soups

-         Current implementation uses AABB-trees

-         Introduces Primitive-BV overlap tests during recursive collision queries (whereas standard libraries only rely on Primitive-Primitive and BV-BV tests)

-         Introduces no-leaf trees, i.e. collision trees whose leaf nodes have been removed

-         Supports collision queries on quantized trees (decompressed on-the-fly)

-         Supports "first contact" or "all contacts" modes (ŕ la RAPID)

-         Uses temporal coherence for "first contact" mode (~10 to 20 times faster, useful in rigid body simulation during bisection)

-         Memory footprint is 7.2 times smaller than RAPID's one, which is ideal for console games with limited ram (actually, if you use the unmodified RAPID code using double precision, it's more like 13 times smaller...)

-         And yet it often runs faster than RAPID (according to RDTSC, sometimes more than 5 times faster when objects are deeply overlapping)

-         Performance is usually close to RAPID's one in close-proximity situations

-         Stabbing, planes & volume queries (sphere, AABB, OBB, LSS)

-         Sweep-and-prune and radix-based box pruner

-         Now works with deformable meshes (OPCODE 1.3)

-         Hybrid trees (OPCODE 1.3) keep a maximum of 16 triangles per leaf and reorganize client triangle lists, to eventually need roughly 16 times less ram than OPCODE’s standard trees. In the best case, this goes down to 1.25 byte / triangle, which is 115 times smaller than RAPID’s OBB trees (using floats ! else it’s 168 times). Speed hit is often negligible, and volume queries can actually run faster than OPCODE 1.2 due to less cache misses (reorganizing clients arrays also helps in this regard). They’re also faster for deformable meshes.





Version 1.3

Download OPCODE 1.3

Opcode 1.3 Test Framework


Version 1.2

Download OPCODE 1.2


Version 1.2 has also been ported to Linux by W.P. van Paassen. He also included an Opcode demo in The Demo Effects Collection.


Version 1.1

Download OPCODE 1.1


Version 1.0

Download OPCODE 1.0


You’re free to use them in any commercial or non-commercial program.





A demo is available to compare OPCODE 1.0 and RAPID (requires Windows / DirectX7) :

Download OPCODE Demo


It has been tested on GeForce 1&2, ATI RAGE 128 and INTEL i740 cards. If it doesn’t run on your system (I can’t test all OS / Card / Driver configurations), here’s a summary of the demo.


Note that Opcode 1.3 is faster than version 1.0 !




A little (incomplete) list of projects using OPCODE has been added here.




White paper (for version 1.0 !):



User manual (for version 1.2 !):



Questions ? Suggestions ? Comments ?

Drop me a mail.



-Last updated : June 5, 2003 - Pierre Terdiman


Back to main