GR Collider

This page is a work in progress, about my biggest to date Physics project, GR Collider.

My next personal project was GR Collider

The purpose of this project was to gain experience in several collision detection and physics  algorithms, and as a showcase demo for my portfolio.

Armed with the experience from Vesper3D, the caveats of several physics-related issues as well as a stronger programming experience in general, I undertook this project practically as a demo.

In short, it is a physics engine (unlike the more abstract, academic oriented Vesper3D framework) that basically was my personal training on commercial physics. 

During the creation of Vesper, I  implemented a few quite interesting algorithms for the collision detection, a couple of integrators and a few supporting modules for miscellaneous needed physics (such as gravity).

Its core though are the rigid-body and the collision detection part.

Colliding...

Collision detection was implemented in 3 phases:
  1. Broadphase : Sweep and Prune algorithm on the Axis Aligned Bounding Boxes of objects
  2. Midphase: Creating and decomposing the objects to hierarchies of AABB, and limiting the collision query to small groups of primitives
  3. Narrowphase: Checking the primitive groups for actual collisions using a special implementation of the Separating Axis (actually Plane) Theorem, that was modified to be more suited for disconnected groups of primitives (practically checking pyramidoidal shapes against each other instead of triangles)
Collision response was based on the analytic solutions of Implicit Euler, which were then added as spring forces using Symplectic Euler (i.e., in order to gain the soft response of the Implicit Euler without having to resort to analytic methods, the softening factor was calculated and added as a normal force).

Rigid body physics have been fully implemented, with very good results on inertial simulations.

Supporting the physics engine, my matrix, vector and quaternion libraries were upgraded, as was my then-simple graphics engine.

I also developed a scripting engine to control the demos, which worked with both a console and scripting files. Objects were added as XML files using a custom schema. At the moment, someone running the demo could, if so inclined, play around with scripting, add his own xml files, and control the simulation purely through the script. 

Points of interest:

  • Classing triangle mesh bodies, in format quite like Wavefront obj etc. (in contrast to Vesper's "attribute soups")
  • Rigid body physics. As can be seen in the spinning top demo, the quality of the rigid body characteristics and rotational dynamics is excellent, demonstrating such emergent properties as the gyroscopic phenomenon
  • Resting contact support emerges through the soft constraints
  • Discrete collision detection - as continuous would be too time consuming for the time that I decided I would allot to this project.

The conclusion

Development was stopped when I was satisfied with the quality of the resulting demo. There is of course tons of room for further work, but since time is so limited, I need to be very picky on where I spend it..

This is a direct link to the main GR Collider demo. The demo runs by itself, but if you want to play around with the engine, delete or rename autorun.script to prevent auto start up and/or  type "help" in the console.

No comments:

Post a Comment