Basketball Simulation

OpenGl/C++

CPE 471 - Professor Wood

Written By: Tyler Yun

OVERVIEW

For my Final Project, I decided to combine my interest of Basketball and Computer Graphics to create a Basketball Simulation. With a basketball court and fans watching from the sidelines, you are able to control the player's dribble and shot.

The major Computer Graphics principles that I used for this project include:

Overview

BASICS

'C': Hold to Dribble the ball

'Q': Hold to Shoot the ball

Note: Make sure to hold Q so the full shot can be made. (Particle Fireworks appear when the shot is made)

IMPLEMENTATION SPECIFICS

Texture Mapping

I applied texture mapping to create both the basketball and the basketball court. First, I drew a sphere and texture mapped the texture of a basketball to it. For the court, I created a big plane quad and texture mapped a basketball court jpg image to texture map the plane quad.

Image of Basketball Image of Basketball Court
Hierarchical Modeling

I used hierarchical modeling when creating both the audience and the player. By using hiearchical modeling, it was much easier to position the joints and various parts of the player and audience to where I wanted based of the previous part I was rendering on. It also helped with creating the realistic motion of the player shooting the basketball.

Image of Player Image of Audience
Lighting

I used the Blinn-Phong model of lighting to show the reflection of lighting in my project. I set a fixed light position above the player and court. I also used different materials to set the different lighting and shading for various characters (audience and players).

Image of Lighting
Particle System

When the shot has reached the hoop, a particle system is displayed to simulate the rendering of fireworks.

Creating the Shot Arc and Dribble

For simulating the Dribble motion, I used hierarchical modeling to simulate the player's motion of dribbling. For the actual ball moving, I used the sin of time so that the ball would move within a range in the y-axis. For the shot arc, I translated the basketball to a specific coordinate, which was then translated back to its original position. From then, when you rotate the ball, it is rotated in respects to the translated coordinate giving the ball the arc.

RESOURCES

Free OBJ models: Obj Models