Any Shape You Desire...
Sensorium is a software library for performing continuous collision detection of geometric objects in 3D space. Continuous collision detection is the process of detecting the first time of contact of moving objects.
Besides continuous collision detection, Sensorium can also be used for static interference tests and distance or penetration-depth computation. A unique feature of Sensorium is the fact that it can perform all these queries on a wide variety of shape types, including deformable triangle meshes, balls, boxes, cones, cylinders, ellipsoids, convex polyhedra, as well as Minkowski sums and convex hulls of arbitrary convex objects. Since it exploits temporal coherence in a number of ways, Sensorium is especially useful for detecting collisions between objects that move smoothly. The motions of objects are controlled by the client application, and are not determined or affected by Sensorium. Although it can be used for physics-based simulations, Sensorium is not a physics engine by itself. Sensorium leaves it up to the application programmer how the laws of physics are implemented.
Sensorium Application Areas
Implementing collision-detection routines for interactive 3D applications can be a daunting task, requiring advanced mathematical and programming skills. Furthermore, in real-time applications collision detection can easily take the lion's share of the available processing power. Sensorium offers a flexible framework for performing exact collision detection on an extensive set of shape types. Sensorium shows that flexibility not necessarily results in poor performance: Sensorium is one of the fastest solutions for performing collision detection currently on the market!
Sensorium is useful in the following areas:
- Game Development. Current 3D games feature a high degree of realism. Needless to say, maintaining a high degree of realism demands advanced collision detection. Sensorium offers the necessary queries for performing ray casts, distance and penetration-depth computation, as used for instance in 1st person shooters and racing games.
- Virtual Reality. Cyberspace has become a reality. VR technology is currently used, for instance, for military or medical training simulations. However, interacting with a highly-dynamic virtual environment in real time remains a big challenge. Haptic feedback devices require refresh rates of 500Hz or higher. Sensorium is capable of performing exact collision detection at these rates.
- Research & Development. Researchers in areas of Robotics, Automotive Industry, Chemistry, Molecular Biology, and Industrial Prototyping, often need to perform simulations that involve a lot of interactions between geometric objects. Sensorium offers a flexible toolkit of query types that can be used in these areas.
Sensorium incorporates a collision-detection pipeline that is composed of three phases:
- 4D Broad Phase. In this phase the object pairs whose axis-aligned bounding boxes overlap at some point during a time interval are detected. The 4D broad phase is highly efficient both in processing time and memory usage. It uses fixed-point rather than floating-point arithmetic which makes it very fast and robust. Furthermore, it aggressively exploits frame coherence which keeps its computational cost low when configurations of objects do not change a lot. A unique feature of the Sensorium broad phase is that it is insensitive to fast movement of groups of objects all heading in the same direction at roughly the same velocity, such as fluid particles and complex characters.
- Complex Narrow Phase. Objects that are composed of many primitives, the so-called complexes, require a bounding-volume hierarchy for quickly culling the non-colliding pairs of primitives. This hierarchy is computed as a pre-processing step. Normally, bounding-volume hierarchies are static structures. They are computed once and cannot be modified. However, Sensorium features fast updates of bounding-volume hierarchies for deformable meshes, thus enabling fast collision detection of animated cloths and skin. Sensorium supports complexes of simplices and is optimized for triangle meshes.
- Convex Narrow Phase. In this phase, pairs of potentially-colliding primitives are tested for exact collisions. Depending on the desired type of response, Sensorium will determine the first time of contact, the contact point and normal at the earliest contact, a witness point of an intersection, or the penetration-depth vector and its witness points. The penetration-depth vector is the shortest translation that brings the objects in touching contact. It is useful for determining contact data in case of interpenetration.
Sensorium offers a complete framework rather than a set of separate tools. Using Sensorium is easy. You simply define the shapes you want to use, define the collision response you would like to receive, place the objects in space by specifying each objects position and orientation, and attach them to a scene of objects. The rest is handled by the framework. Sensorium's interface is quite flexible:
- Motion is specified using arbitrary affine transformations (translations, rotations, and non-uniform scalings).
- Polygonal complexes are specified using client-defined vertex arrays. A vertex array can be of any type and may contain any data besides xyz coordinate data. This feature enables sharing of dynamic vertex data between Sensorium and, for example, procedural animation code.
- Collision response is defined by the client by means of call-back functions. Response callbacks are defined per pair of response classes rather than per object pair. With each object a response class is associated. The response class of an object may change over time.
- Objects may be shared among multiple scenes. This feature is useful when collision detection is required for multiple tasks. For instance, it is possible to maintain at the same time a sound scene, a scene used for visibility culling, and a scene for physics simulations.
Any Shape You Desire
Sensorium offers you the freedom to represent your objects using virtually any convex shape type imaginable. It has an extensive set of basic primitive types, including balls, boxes, cones, cylinders, barrels, lemons, disks, line segments, triangles, and other polytopes. Queries on convex polyhedra run in logarithmic time and are CPU-cache friendly for lightning-fast performance.
From these basic primitives more exotic convex shapes can be constructed using affine transformations, Minkowski sums, and convex hulls. Minkowski sums enable you to fatten objects by adding arbitrary convex shapes. For instance, objects can be expanded spherically, for example, a ball can be 'added' to an arbitrary shape. The resulting object is the set of points whose distance to the shape is at most the ball’s radius. This technique is useful for creating dilated objects with rounded edges, or 'sensitive' areas around an object.Another powerful tool for creating convex shapes is convex-hull construction. Any pair of convex objects can be ‘shrink-wrapped’ and used as a new object. For instance, the hull of a pair of balls of different sizes represents a tapered capsule that can be used, for instance, as limbs of an animated character.
Controlling both performance and memory footprint is key in real-time applications. Many applications require special customization of the Sensorium library. Sensorium has been designed with code-level performance-enhancements in mind:
- Any number type can be used within Sensorium, whether it be single-, double- or arbitary precision numbers. The Sensorium C++ code fully abstracts from the underlying number type. Numerical issues are resolved nicely even for the less accurate number formats. The use of a 32-bit floating-point format is often a requirement for games that run on current PC graphics hardware and consoles.
- Core routines can easily be replaced by custom routines. The generic design of Sensorium allows for plugging in your own platform-dependent routines.
- Compressed AABB trees reduce the memory footprint of complex shapes considerably. This is useful for platforms that have limited memory, such as game consoles.
- The use of transcendental functions is kept to a minimum, and can be avoided for a limited number of shape types. This is useful for platforms with less powerful FPUs.
The only requirement is the availability of a modern C++ compiler. Sensorium currently compiles under GNU gcc version 2.95 and up, Clang 3.4 and up, and Microsoft Visual C++ 9.0 and up.
 All images of shape types were rendered using the ray cast routine from Sensorium