Sunday, June 17, 2012

My OpenGL Adventures: 3D Particle Simulator

Canerus Physics 3D Particle Simulator with C++ & OpenGL






C++ opengl physics particle simulation
Hello 3D World!!

C++ opengl physics particle simulation
Basic planes.

C++ opengl physics particle simulation
Displaying inclined planes without using rotation; rather by evaluating first order equations.

C++ opengl physics particle simulation
Displaying basic shapes by moving on their surfaces with differential equations, instead of using a naive O(N^3) algorithm.   

C++ opengl physics particle simulation
Implementation of polar and spherical coordinates to be able to display spherical objects with improved performance.

The tip of this shape is supposed to be closed at infinity. With a new algorithm, we calculate new points near our viewing frustum, and display them efficiently when they enter the frustum. If we look through the end from a point, perspective gives us an almost ideal shape.

C++ opengl physics particle simulation
Instead of having one surface per equation, we go object oriented and start implementing object classes with attributes like color, size etc.

C++ opengl physics particle simulation
Objects may have more than one surface in them.

C++ opengl physics particle simulation
Composite objects may have more then one objects in them. Instancing becomes important.

C++ opengl physics particle simulation
I improved my surface traversal algorithms and adapted them to the frequently used instancing system. I made sure that nothing is calculated redundantly.

C++ opengl physics particle simulation
Surface based collusion detection attempts with polynomial time algorithms. I could hear the cpu crying :)

C++ opengl physics particle simulation
After spending some time on improving the collusion detection algorithm, I gave acceleration and velocity vectors to objects. They are now environment aware; when an object moves, it sends a notification to a controller, which transmits it to other objects near it. A collusion predictor algorithm is applied between these objects, and if they are predicted to be colliding, the main collusion detection algorithm starts checking if they collided yet.

C++ opengl physics particle simulation
Switching to solid objects

C++ opengl physics particle simulation
Improved collusion detection algorithm and bug fixes.

C++ opengl physics particle simulation
Implemented linear and radial vector fields and added gravitational field to objects. Acceleration calculation with centrifugal and centripetal forces. Smooth orbital movement is observed after improving the time-state algorithm.

C++ opengl physics particle simulation
Added mobile and colored light sources.

C++ opengl physics particle simulation
Detailed control menu.

C++ opengl physics particle simulation


C++ opengl physics particle simulation


C++ opengl physics particle simulation


C++ opengl physics particle simulation


C++ opengl physics particle simulation

No comments:

Post a Comment