Lighting Effects in Computer Games
description
Transcript of Lighting Effects in Computer Games
Lighting Effects in Computer Games
Stefan Felkel
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
04/22/23 Stefan Felkel 3 / 24
Importance of Lighting
04/22/23 Stefan Felkel 4 / 24
Light SourcesDirectional Light
Point Light
Spot Light
Parameters: color, intensity OpenGL: up to 8 light sources
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
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:
04/22/23 Stefan Felkel 7 / 24
Lighting Model Ambient Lighting
04/22/23 Stefan Felkel 8 / 24
Lighting Model Diffuse Lighting
View & light-vector: no lighting >= 90°
04/22/23 Stefan Felkel 9 / 24
Lighting Model Specular Lighting
04/22/23 Stefan Felkel 10 / 24
Shading
Flat Shading
Gouraud Shading
Phong Shading
04/22/23 Stefan Felkel 11 / 24
Cube Environment Mapping
6 Textures 1 Cubemap
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 ...
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
04/22/23 Stefan Felkel 14 / 24
Light Mapping (1)
+ =
Lightmap + Texture = Combined Texture
Light maps: low resolution & precalculated Introduced by Quake
04/22/23 Stefan Felkel 15 / 24
Light Mapping (2)
Multiple light maps packed into single
texture
04/22/23 Stefan Felkel 16 / 24
Gloss Mapping
+ =
Specularlighting
Gloss maptexture
Diffuselighting Final combined
result
Gloss map: monochrome texture stores specular intensity values
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
04/22/23 Stefan Felkel 18 / 24
Radiosity
04/22/23 Stefan Felkel 19 / 24
Meshing the Environment
Patch = surface, area, texel (light maps) Every patch gets energy from
surrounding patches
04/22/23 Stefan Felkel 20 / 24
Examples
Wolfenstein 3D (1992) Doom (1993) GLQuake (1996)
04/22/23 Stefan Felkel 21 / 24
Wolfenstein 3D (1992)
Screenshot from Wolfenstein (“full-bright”)
04/22/23 Stefan Felkel 22 / 24
Doom I (1993)
Screenshot from Doom I (Depth Cueing)
04/22/23 Stefan Felkel 23 / 24
GLQuake (1996)
Screenshot from Quake II(Radiosity for light map calculation)
EndThanks for your attention!