Dana Vrajitoru
B583/C490 Game Programming and Design

3D Games

Introduction to 3D Games

Coordinate Systems

Projection

Parallel Projection

Features of the Parallel Projection

Perspective Projection

Features of the Perspective Projection

Types of 3D Games

Elements of a 3D Game

General Game Setting

enum Obj_type {static, collectible, animated, behaving};
enum Surface_type {tstrip, polygon,...};
struct Surface { vector coords;
                 Point3f color;
                 Texture aspect; };
typedef vector Shape;
class Object {
 protected:
  int shape_count; bool active;
  Point3f position, orientation;
  Shape shapes[shape_count];
  Obj_type base_type; float speed;
 public:
  display();
};

Display Settings

Game Controls

Type of Movement

Camera Position

Moving, World Coordinates

Player-Focused Camera

Trackball

Terrain Representation

Height Map and Rendered Terrain:

Images taken from here.

Rendering the height map:

#define AREA_SIZE 128 /* size of (square) map */ 
#define F 16.0 /*world scale of one height map cell*/ 
float height_field[AREA_SIZE][AREA_SIZE];  
void render_height_field( void ) { 
  int x, z; 
  glColor3f(0, 0.5, 0.1); 
  glBegin(GL_TRIANGLE_STRIP); 
  for(x = 0; x < AREA_SIZE-1; x++) { 
    for(z = 0; z < AREA_SIZE; z++) {
      glVertex3f(F*x,F*height_field[x+1][z],F*z); 
      glVertex3f(F*x, F*height_field[x][z], F*z);
    } 
  } 
  glEnd(); 
} 

Rendered Terrain

Level of Detail Techniques (LOD)

Frustum Culling

Methods for Frustum Culling

Roads

Buildings

Procedural Worlds