Source
Ball bouncing in 3D in openGL, constrained in the x, y, z directions at a maximum ceiling and floor. If the ball would have passed that direction maximum, it's position and velocity are set to simulate bouncing. Eulerian integration is used to solve for the position and velocity. On each bounce, the ball's rotation is set based on the velocity not in the impact direction.

Source
Water fountain in 3D, with a user controlled camera. Move left/right/forward/back with a/d/w/s respecively. Click and drag the mouse move the viewing center. Uses a textured and colored sprite image at each point.

Source
Fire simulation very similar to fountain simulation only with altered gravity and initial velocity, and changes color as the particle ages. Particles also fade out as they age.

Source
Fireworks simulation as a combination of a moving particle emitter and a radial particle emitter with color changing particles. Audio effects are keyed to play when the firework starts and when it changes from the moving smoke emitter to stationary radial emitter.

Source
Using Dijkstra's algorithm and a Probabilistic Road Map to navigate a 3D space. The large green sphere is the goal, the large red sphere is the AI, the large black sphere is an obstacle, and the small green spheres are the points found by the probabilistic road map. Use WASD to move the camera in mode 0, the AI in mode 1, and the goal in mode 2. Drag the mouse to rotate camera. Set modes by pressing the corresponding number. Press enter or return to have the AI search. I accidentally made the obstacle too large, but this does not impact the algorithm much.

Source
Using Dijkstra's algorithm and Astar with a Probabilistic Road Map to navigate a 3D space. The large green sphere is the goal, the large red sphere is the AI, the large black sphere are obstacles, and the small blue spheres are the points found by the probabilistic road map. Use WASD to move the camera in mode 0, the AI in mode 1, and the goal in mode 2. Drag the mouse to rotate camera. Set modes by pressing the corresponding number. Press enter or return to have the AI search. Press r to reset the AI's position. Press spacebar to swap between using dijkstra's algorithm and astar. In the video, both algorithms find the same path, but Astar ound it in 23 miliseconds, while dijkstra's algorithm found it in 88 milliseconds.

Built off of plasma effects, this is a two color aurora proof of concept.
For more on plasma effect generation: bidouille.org, lodev.org

Aurora real-time generation utilizing GLSL shaders and transparency with tweaked algorithm and more realistic colors. So much smoother than CPU based rendering!

3D flocking algorithm using Boids simulation model. Each boid is represented as a blue sphere with a smaller green sphere used to visually track the direction vector. The 3 rules used are:
1. boids fly to perceived flock center
2. boids avoid other boids
3. boids match flock direction
Flock center and direction are calculated by looking at each boids' local neighbors, changing the size of this parameter changes the overall flock sizes.
Avoiding other boids uses a 1/x function to determine the multiplier applied to the vector between 2 boids. This means the closer the boids are, the more 'force' repells them. The nearby boids calculation for this rule uses a smaller size than the first and third rules.

In this video we see direction propagation inside a boids flock, as it starts in one end of the formation and propagates throughout. Notice how the boids maintain a respectable distance from each other.

Where it Breaks Down


This video shows 2 boids in direct opposition repelling each other perfecty, as there are no forces to apply variation that would allow them to align.

This video shows the 'strength' of the repelling force, these boids are not perfectly aligned, yet as they get closer the repelling force of rule 2 and the flock direction variable from rule 3 combine to make he boids swerve away from eachother instead of combining.
In addition, the boids jitter a great deal, especially when Rule 2 comes into play. This could be fixed by implementing a maximum turning speed for each boid which should help smooth the way they turn, and implement a better algorithm for dealing with boids intruding too far into each others' space.

Obstacles and Pathfinding



In these videos, black obstacles have been added, along with the a* algorithm from homework 3. To have the boids properly interact with these new objects, 2 new rules are required:
4. boids want to travel to some point on the path
5. boids want to avoid objects
Rule 4 is simply the direction vector pointing to the next point on the path returned by the A* algorithm, and Rule 5 is simply a copy of rule 2, only instead of summing the local boids, uses all objects. One global path is used for all boids, updated to path to a random point in the obstacle maze whenever the end is reached. This path is shown as a red line, a small red sphere marking the current node the boids are pathing to. Notice how even with these new rules, the boids still travel in flocks.

Where it Breaks Down

You may have noticed in the earlier videos, boids will get stuck on the black obstacles, bouncing back and forth on them, slowly moving around it. This is due to the other Rules upon the boid overpowering Rule 5 until Rule 5 overpowers them, creating a very fast flip-flop effect in the direction vector.

Very occasionally, the point picked randomly by the A* algorithm will situate the boids such that the function used to determine whether the goal is reached will fail to register. This function simply determines if for each boid if the distance from the boid to its perceived flock center is larger than the distance from the current path node to the perceived flock center. This will produce jittery behaviour as the boids try to situate themselves as close as possible to the node wild obeying all the other rules.

Boids Source
Boids with Obstacles Source