Rain Collider Bounding Objects and Collision Detection
Project Explanation
This project was designed to simulate rain in an openGL world. From this project, the best parts of the project are the bounding objects and collision detection of objects.
Lessons Learned:
Bounding Boxes can be completed in O(n) time using Axis Aligned Bounding Boxes (AABB).
Bounding Spheres require O(n²) in order to obtain the median and the radius from the point furthest from the object.
Bounding Boxes can be scaled easily while Bounding Spheres cannot.
Everyone should use a hierarchical Bounding Boxes
Water is very complex and should be implemented in parts.
Cube Maps require a lot of time to debug
Collision detection for boxes are simple and become simpler if using a library that contains an AABB class
Games using rain require a lot of extra computational power.
MESA's openGL implementation is a lot more error tolerant than Nvidia's.
I should have used a Linux workstation with a Nvidia graphics card to test my project.
Different Bounding Objects
This shows how certain bounding objects are better suited for different objects. If the goal is to use one bounding object per object, minimizing volumes provide the closest realism.
Collisions related to world
When the rain hits on an object off the ground, it creates a patch of ground that is undisturbed, similarly to a roof.
Animated example
This shows the collisions against different bounding objects. Basically the pictures before it, but animated and all-in-one.
Resources/Tutorials
BoundingBox: This was constructed using Eigen's AlignedBox3f which is an implementation of AlignedBox - Eigen's AlignedBox
Rain: Rain is represented using triangle strips and transformed
Bounding Objects: Objects are bound in either a box or a sphere, depending on which has less volume in order to minimize wasted space. This could be eliminated if hierarchical bounding objects were used.
Collisions: Collisions are detected between all implemented bounding objects (sphere-sphere, sphere-box, box-sphere, and box-box)
What doesn't work
Running on openGL drivers other than MESA: Due to bugs in the implemented code and issues with GLSL shaders, Nvidia's openGL implementation crashes when attempting to run the program. Sorry!
[Code exists, implementation doesn't work] Texture Mapping: All objects displayed were supposed to implement textures in order to further the realism of the environment.
[Code exists, implementation doesn't work] Sky Box: This is a specific texture map that required cube mapping in order to simulate a full environment.
Water hydrodynamics: When water hits an object, it reacts in multiple ways: merging with other water objects, splitting apart and moving in different directions, bouncing off the object, attaching to the object, or sliding off the object. Unfortunately none of these were able to be implemented in the time I had available.