Download - Lighting Effects in Computer Games

Transcript
Page 1: Lighting Effects in  Computer Games

Lighting Effects in Computer Games

Stefan Felkel

Page 2: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 2 / 24

Talk Outline Importance of lighting Light Sources Lighting Model Material and OpenGL Shading Multipass Rendering Multitexturing Mapping Techniques Radiosity Examples and Screenshots

Page 3: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 3 / 24

Importance of Lighting

Page 4: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 4 / 24

Light SourcesDirectional Light

Point Light

Spot Light

Parameters: color, intensity OpenGL: up to 8 light sources

Page 5: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 5 / 24

Material Parameters:

Ambient (color)Diffuse (color)Specular (color)Shininess (specular exponent)Emissive (color)

Color determined by these params + params of light source + lighting model

Page 6: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 6 / 24

Lighting Model (1) Good approximation to reality Illumination calculated with LM OpenGL LM

Ambient Lighting Diffuse Lighting Specular Lighting

Total lighting intensity:

Page 7: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 7 / 24

Lighting Model Ambient Lighting

Page 8: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 8 / 24

Lighting Model Diffuse Lighting

View & light-vector: no lighting >= 90°

Page 9: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 9 / 24

Lighting Model Specular Lighting

Page 10: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 10 / 24

Shading

Flat Shading

Gouraud Shading

Phong Shading

Page 11: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 11 / 24

Cube Environment Mapping

6 Textures 1 Cubemap

Page 12: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 12 / 24

Multipass Rendering Lighting calculations done in separate

passes Each successive pass modifies the

result of the pass before Quake III: up to 10 passes

Base texturesLightmapsFog ...

Page 13: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 13 / 24

Multitexturing

In a single pass, multiple textures are accessed

Multiple stage model: output of each stage becomes input for next

Input for 1st stage is fragment color

Page 14: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 14 / 24

Light Mapping (1)

+ =

Lightmap + Texture = Combined Texture

Light maps: low resolution & precalculated Introduced by Quake

Page 15: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 15 / 24

Light Mapping (2)

Multiple light maps packed into single

texture

Page 16: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 16 / 24

Gloss Mapping

+ =

Specularlighting

Gloss maptexture

Diffuselighting Final combined

result

Gloss map: monochrome texture stores specular intensity values

Page 17: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 17 / 24

Radiosity

Based on thermal heat transfer Viewpoint independent Radiosity = radiance exiting from a patch Deals with area light sources Radiosity is used for light map calculation

Page 18: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 18 / 24

Radiosity

Page 19: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 19 / 24

Meshing the Environment

Patch = surface, area, texel (light maps) Every patch gets energy from

surrounding patches

Page 20: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 20 / 24

Examples

Wolfenstein 3D (1992) Doom (1993) GLQuake (1996)

Page 21: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 21 / 24

Wolfenstein 3D (1992)

Screenshot from Wolfenstein (“full-bright”)

Page 22: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 22 / 24

Doom I (1993)

Screenshot from Doom I (Depth Cueing)

Page 23: Lighting Effects in  Computer Games

04/22/23 Stefan Felkel 23 / 24

GLQuake (1996)

Screenshot from Quake II(Radiosity for light map calculation)

Page 24: Lighting Effects in  Computer Games

EndThanks for your attention!