42
ELIS – Multimedia Lab Game Technology

Game Technology

  • Upload
    howe

  • View
    42

  • Download
    0

Embed Size (px)

DESCRIPTION

Game Technology. Overview. Game Engines Rendering Culling Setup Drawing Phong Lighting Physics Collision Detection Forces Integration Scripting Production. Simplified Game Architecture. Game Scripts. Game Engine. Sound. Scene Manager. Renderer. Graphics Card. AI. Physics. - PowerPoint PPT Presentation

Citation preview

Page 1: Game Technology

ELIS – Multimedia Lab

Game Technology

Page 2: Game Technology

2/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Game Engines• Rendering

• Culling• Setup• Drawing

• Phong Lighting• Physics

• Collision Detection• Forces• Integration

• Scripting• Production

Overview

Page 3: Game Technology

3/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Simplified Game Architecture

Game Engine

Rend

erer

SceneManager

Sound

Physics

GraphicsCard

AI

Game Scripts

Page 4: Game Technology

4/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• “Engine” is independent of one particular game• Scripts define individual game behavior and game play

Game “Engines”

Page 5: Game Technology

5/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Engine Overview

Game Engine

Rend

erer

SceneManager

Sound

Physics

AI

Page 6: Game Technology

6/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Different parts of engine all need to access the “world”• Linear search of all objects is slow for large worlds• Create sub-linear structure• O(1) or O(log(n))• Hash structures• Tree structure

Need for Scene Structures

Quad Tree

Page 7: Game Technology

7/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Examples of Scene Structures

Wolfenstein 3D:Regular 2D GridTomb Raider:

Regular 3D GridQuake:3D BSP, Arbitrary world geometryGTA:

Complex trees, streaming, LOD

Page 8: Game Technology

8/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Engine Overview

Game Engine

Rend

erer

SceneManager

Sound

Physics

AI

Page 9: Game Technology

9/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Renderer Overview

Renderer

Culling SetupGraphics

CardDraw

• OpenGL• DirectX

Page 10: Game Technology

10/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• The scene is presented to the renderer to draw it.• Contains all objects in the game world• Sending everything to the graphics card is slow• Send only limited set of objects visible by camera

View Culling

To be culled

Page 11: Game Technology

11/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Use fast operations provided by the scene manager• Example: 2D Quad Tree

Optimizing Culling

Level1 Level2 Level3 Level…

Page 12: Game Technology

12/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Renderer Overview

Renderer

Culling SetupGraphics

CardDraw

• OpenGL• DirectX

Page 13: Game Technology

13/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Prepare data for efficient rendering• Sort objects per material• Create batches• Calculate per object shader parameters

• Send to Graphics Card for rendering

Setup

Page 14: Game Technology

14/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Renderer Overview

Renderer

Culling SetupGraphics

CardDraw

• OpenGL• DirectX

Page 15: Game Technology

15/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Recapitulation

Rendering

YU

X

Z

V

Texture Coordinate

Vertex

Triangle

Page 16: Game Technology

16/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Light intensity is dependent on surface normalCosine Law

Same amount light reaches both surfaces.

• Light distributed over small area.• Surface will appear bright.

• Light distributed over larger area.• Surface will appear dark

Page 17: Game Technology

17/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Simplified Light-Surface interactions

Diffuse• Light scattered in all

directions equally.

Specular• Light reflected in one

particular direction.

Many real-life materials can be modeled by a combination of specular and diffuse models.

Page 18: Game Technology

18/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Based on these observations create simple ad-hoc model to calculate lighting.

Diffuse Term Specular Term

max(0, L.n) Cd Cl + max(0, R.n)e Cs Cl

Phong Lighting

Calculate area hit by light rays

Take color of surface Take color of

light sourceCheck if camera looking in reflected direction

Make the reflected beam narrow

Take color of surface

Take color of light source

Page 19: Game Technology

19/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Additional lights and shadows

More than one light• Independent of each other.• Add output of Phong

equations for all lights

Shadows• Mask out contribution of

Phong equation if in shadow.

Page 20: Game Technology

20/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Attenuation• Further from source light gets dimmer• Theoretically infinite radius

• Light Culling• At certain point assume light level zero• Use techniques similar to view culling

Attenuation & Light Culling

Page 21: Game Technology

21/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• We evaluate this equation to determine the lighting at a certain point.

Full equation

i

i

ie

iii S )Cl Cs .n)R max(0, Cl Cd .n)L (max(0, i

Shadow contributionAdd all lights in scene

Phong for ith light

Page 22: Game Technology

22/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Object:

Evaluate on CPU

Triangle:

<Not used in practice>

Vertex:

Evaluate in vertex shader

Pixel

Evaluate in pixel shader

Where to evaluate equation?

Page 23: Game Technology

23/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Where to store equation parameters

• Per object

• Per pixel (in texture)

Page 24: Game Technology

24/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Normals are geometric property of surface

• Low poly surface: Renders fast but low lighting detail

• Normalmapping: Store approximate normals in texture

Normal/Bump mapping

Page 25: Game Technology

25/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Using the GPU to evaluate model: Shaders

Page 26: Game Technology

26/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Shadow Mapping

Texture: Stores length of blue arrows• Check green length to blue to determine shadows

Depth as seen from light source

Page 27: Game Technology

27/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Shadow Techniques - Comparison

SM PCF 5x5 Bil.PCF 5x5 VSMStencil

Page 28: Game Technology

28/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Engine Overview

Game Engine

Rend

erer

SceneManager

Sound

Physics

AI

Page 29: Game Technology

29/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Physics Overview

CollisionDetection Forces Integration

Page 30: Game Technology

30/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Physics Overview

CollisionDetection Forces Integration

Page 31: Game Technology

31/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Broad phase• Use the scene manager to determine nearby objects

• Narrow phase• Object – Object interactions• To simplify calculations, use simple shapes:

• Spheres, boxes, …

Collision Detection

Page 32: Game Technology

32/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Example of simplification

Collision detection – Rag Dolls

Page 33: Game Technology

33/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Physics Overview

CollisionDetection Forces Integration

Page 34: Game Technology

34/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Forces acting on the objects are accumulated• “Traditional” forces:

• Gravity• Collisions• …

• “Simulation” forces• Collision detection• Constraints

• “Game” forces• Explosions, magic, • Not simulated correctly what looks fun

Forces

Page 35: Game Technology

35/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Physics Overview

CollisionDetection Forces Integration

Page 36: Game Technology

36/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Good old Newton

• Object’s state vector is integrated using numerical integration methods• Euler• Runge Kutta

Integration

trv

dd

tva

dd

Page 37: Game Technology

37/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Use computational power of the GPU• Parallelize algorithms• For example:• PhysX engine by NVIDIA• Uses CUDA to drive the GPU

Physics on the GPU

Page 38: Game Technology

38/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Engine Overview

Game Engine

Rend

erer

SceneManager

Sound

Physics

AI

Game Scripts

Page 39: Game Technology

39/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

Scripting

• Script programmers & technical artists• AI & Behavior• Physical properties• Animation behavior

World Objec t

Static Objec t

Tree

Birc h

Fir

House

Phy sic s O bj ect

Monster

Zombie

Shark

Vehicl e

Tank

Jeep

Pla yer

Pla yer

Page 40: Game Technology

40/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• “Making the game”• Use engine to create an unique game• Mainly artists, designers and script writers

Production

Page 41: Game Technology

41/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

GDD• Visual

description

• Function in game

Concept art• Han

d drawn idea

Modelling• 3D

model of object is constructed

Rigging• A

skeleton is added to the model

Animation• The

skeleton is animated

• Motion capture

Texturing• A

texture is made for the model

Integration• AI

Code• Load

assets in game

Production – Asset Pipeline

Text

Page 42: Game Technology

42/42

ELIS – Multimedia Lab

Game TechnologyCharles Hollemeersch

28/11/2008

• Contact:• [email protected]

Questions?