Bounce 3D
3D Bounce is essentially a toy which simulates perfectly elastic sphere collisions.
The simulation begins with several balls bouncing off walls of a cube and off of each other.
The mass of each ball is proportional to its radius so large balls can send small balls off at large
velocities while small balls can do little to affect the trajectory of larger balls.
Balls can be added and removed from the simulation and playfully manipulated in different ways.
The cube that contains the balls can be resized to be any rectangular solid.
The user can fully manipulate the camera through panning, rotating and zooming as well as focus the camera on balls in the simulation.
Just as balls can be created and removed, lights can be created and removed from the world as well.
Overall, 3D Bounce is just a program that provides a way to waste perfectly good time while demonstrating
many techniques of 3D graphics programming.
The idea for this project came from one of my first java programs which is a similar two dimensional simulation. You can check it out here.
- Basic Controls
- left click + drag - create a ball with a radius
- left click + drag a ball- drags the ball, when released the ball has a velocity depending on the speed it was thrown
- after creating a ball another left click is required to set the ball's velocity
- Shift-left click selects a ball
- Ctrl-left click toggles the selection of a ball
- Space - pause/unpause the simulation
- a - add a ball with random radius and velocity to the scene
- A - toggles drawing the axes
- backspace - deletes the last created ball
- delete - deletes all selected balls
- 0 - deletes all the balls
- Ctrl-0 - stops every ball (sets their velocity to zero)
- v - toggle drawing the velocity vectors
- g - toggle drawing the grid
- C - toggle drawing the cursor
- s - toggle snapping cursor to the grid
- S - toggle drawing shadows
(severely slows down the simulation, especially with multiple lights. I recommend using [ to decrease the ball quality)
- n - steps the simulation a small amount of time
- [ - decreases the ball quality
- ] - increases the ball quality
- Advanced Controls
- l - change to light mode
In light mode left clicking will create a light rather than a ball.
Also delete and backspace will delete the last light created rather than delete balls.
The maximum number of lights is 7.
- b - changes to ball mode (the default)
- Shift-number (1-9) - saves the state of the balls to that number
- number (1-9) - loads the state of the balls saved to that number
- Middle click + drag - scales the box in the x, y, or z direction
- x - makes middle click scale in the x axis
- y - makes middle click scale in the y axis
- z - makes middle click scale in the z axis
- Camera Controls
- right click + drag - perform camera transform
- R - puts camera control in rotation mode
- Z - puts camera control in zoom mode
- P - puts camera control in pan mode
- r - resets the camera
- c - after selecting two balls, locks the camera on one ball and focuses on the other
- c - after selecting one ball, focuses the camera on the ball
Graphics Techniques Used:
- Camera manipulation through model view transforms.
- Lighting through dynamic light creation.
- Material properties applied to the balls in the simulation.
- Picking which is used to select balls for various functions such as deletion and assigning camera focus.
- Projection which is used to project the 2D mouse coordinates into a 3D world in order to create balls and lights in intuitive places.
- Very basic hierarchical modeling demonstrated in drawing velocity vectors relative to a ball (which are hierarchically modelled for drawing the arrow tips).
- Bitmapped text and display lists for displaying simple messages and coordinates.
- Collision detection between planes and spheres.
- Transparency applied to the box, selected balls, and a grid representing the coordinate system.
- Shadow volumes to project shadows onto any object in the scene.
Executables
Mac
Windows
Linux
Linux
Screenshots:
Sources:
Angel, Edward. OpenGL: A primer. Boston: Addison Wesley, 2005.
Everitt, Cass and Mark J. Kilgard. "Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering." 12 Mar 2002 <http://arxiv.org/pdf/cs.GR/0301002>.
Kilgard, Mark. "Improving Shadows and Reflections via the Stencil Buffer." <http://developer.nvidia.com/object/Stencil_Buffer_Tutorial.html>.
"OpenGL FAQs for Developers." Opengl.org. 2007. 23 February 2007 <http://www.opengl.org/resources/faq/>.