Physics Engine

This creation of an own physics engine was a university coursework. The task was to create a graphics environment also handling all physics updates within the system. This project did NOT used a physics supporting middleware (like Bullet or PhysX).

  • Timespan: 3 weeks
  • Technologies: OpenGL 3.3, Visual Studio 2013, GLEW, SOIL
  • Platform: Windows

Global Solver

The physics engine is running on an own implemented constraint based system. We can define custom constraints and add them into the system and resolve collisions with constraints. The most simplistic constraint is the distance constraint, which is depicted in the following picture.

Constraints

Octree

As spacial partitioning system, I use an Octree structure.

Octree

Rest State

To reduce the amount of solved collisions even more (beside the Octree), I also introduced a sophisticated rest state detection. First, an object gets to rest when it does not pass a physics change threshold over time. Second, I also detect if currently colliding neighbors already were colliding shortly before. Thence, we do not need to resolve the collision again with the global solver.

In my system objects are green, when they are added as a collision object into the global solver and were solved within the last second. When objects are not colored green, it means that I also do not resolve any collision. That the rest state is working and yet objects are still touching each other is depicted in the picture below.

Collision Manifolds

Collision manifolds are used to calculate the collision response, which will be in the end another constraint for our physics engine.

GPGPU: Particles on the GPU

As an extension of the project, I introduced a particle system, which is completely solved and updated on the GPU. With that, we could easily render 60.000 active particles in the environment.