Home     Current Work     Modeling     Rendering     Animation     Dynamics     Programs     Resume  

Creating 9-Ball Pool


This is a game I created with my brother, Brian. The game is written entirely in OpenGL and successfully implements much of the physics of pool but neglects spin when calculating collisions. Our original project proposal is below.

9-BALL POOL
Brian Townsend : townsend
Matt Townsend : matownse

The program will be an interactive 9-ball game. Two players can play against each other abiding by the typical rules of 9-ball, which will be programmed into the game. The scene will include a pool table and the balls on it, a cue, three light sources above the table, and some sort of textured room.

1. Physical Realism (30) - Brian
a) Frictional Force (5)
- balls should be subject to a frictional force that accurately simulates the real frictional force of pool balls on the felt of a pool table
b) Rail Banks (5)
- balls should bounce off the rails of the table with the correct banking angle and velocity
c) Ball Sliding/Rolling (10)
- after contact, the balls should slide for a short period of time before the frictional force of the felt forces them into a natural roll, and the roll should be displayed as rotating textures on the balls
d) Ball Collisions (10)
- balls should bounce off each other obeying the laws of conservation of momentum and with physically correct velocities

2. Interactivity (30) - Brian
a) Camera Movement (10)
- camera rotation and tilt around a selected ball (default cue ball) during shot setup
b) Ball Selection/Marking (10)
- capable of selecting any ball on the table to rotate around and placing a mark on the ball to aid in shot aim
c) Laser Aim (5)
- red laser shot from cue through cue ball to aid in shot aim
d) Game Rules (5)
- the game should keep track of the rules, such as what player is up, ball-in-hand options with the cue ball, table scratches, etc. for ball in hand the gui will allow the user to put the ball anywhere on the table assuming it does not overlap with another ball on the table

3. Modeling / Geometry (20) - Matt
a) Table (10)
- create a realistic-looking table geometry using primitives, should include rails, pockets, and legs
b) Lights (5)
- create three light structures above the table to portray lamps typically found above a pool table
c) Cue (5)
- create a realistic-looking cue that includes tip, grip, and knob on the end

4. Shadows (10) - Matt
-use projective shadowing to cast shadows from the balls onto the plane of the table from three light sources
5. Texture Mapping (10) - Matt
-texture map the balls, wood and felt on the table, the cue, and the pockets for a realistic appearance

The Game - Screenshots



The white spot on the 2-ball in the above image is a mark placed there by the current player. The game allows a player to center on a certain ball to line it up with the pocket and then place a mark on that ball where contact should be made. The laser aim can then be used to aim the cue ball at the mark for more accurate shots. The above image shows a shot of the pool cue. The texture applied to the cue can be seen below.

This image shows a closeup of one of the pockets. The backs of the pocket (black) were done with strategic placement of cylinders with modified sweep angles (around 200 degrees). The pockets themselves are hemispheres (actually slightly more than hemispheres) with a pocket texture applied to them, shown below. With no aid from modeling software packages, the placement of the pockets turned out to be quite time consuming.

Texture Mapping



The above images show the texture maps applied to the top of the table. They were created in Adobe Photoshop with the help of a wood texture image that we found on the internet. The tabletop image was saved in .png format with a transparent center, and it was placed slightly above (1.6*ballradius) another rectangle with a simple felt texture map placed on it. The felt image includes a dark region along the outside to be interpreted as the shadow of the rail above it. This was an easy way to get a shadow from the rail without including it in our projective shadows.



The image on the left is the texture map used to wrap around the cue. This was created from a number of textures found on the internet along with examinations from pictures of pool cues. It also includes a very small blue area at the tip to simulate the look of chalk.
The image in the center is an example of a texture map applied to one of the balls.
The image on the right shows the texture map applied to the pockets. It was actually created from an image of a brown belt that was duplicated to form a mesh-like pattern. The pockets were spheres with modified sweep angles.

>> Back