���Chapter IX
Lighting
All class materials including this PowerPoint file are available at
https://github.com/medialab-ku/openGLESbook
Introduction to Computer Graphics with OpenGL ES (J. Han)
Phong Lighting Model
9-2
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-3
Phong Lighting Model - Diffuse Term
point light source
directional light source
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-4
Phong Lighting Model - Diffuse Term
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-5
R
G
B
intensity 1
1
1
1×1=1
1×0=0
1×0=0
(1,0,0)
Phong Lighting Model - Diffuse Term (cont’d)
R
G
B
intensity 1
0.5
1
1×0.5=0.5
0.5×1=0.5
1×0=0
(0.5,1,0)
md = (1,0,0)
md from the texture
(0.5,1,0)
(0.5,0.5,0)
(1,0.5,1)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-6
Phong Lighting Model - Specular Term
Introduction to Computer Graphics with OpenGL ES (J. Han)
rather than an RGB color. It enables the
highlight on the surface to end up being
the color of the light source.
9-7
cos2ρ
cos64ρ
cosρ
Phong Lighting Model - Specular Term (cont’d)
ss = (1,1,1) &
ms = (0.95,0.95,0.95)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-8
Phong Lighting Model – Ambient and Emissive Terms
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-9
Phong Lighting Model
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-10
Vertex Shader and Rasterizer (revisited)
Introduction to Computer Graphics with OpenGL ES (J. Han)
Vertex and Fragment Shaders (revisited)
9-11
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-12
Per-fragment Lighting
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-13
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
Scan Conversion (revisited)
9-14
a scan line 🡪
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-15
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-16
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-17
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-18
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-19
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-20
Per-fragment Lighting (cont’d)
Introduction to Computer Graphics with OpenGL ES (J. Han)
Texturing and Lighting (revisited)
9-21
texturing only
texturing +
lighting (CH9)
Introduction to Computer Graphics with OpenGL ES (J. Han)
9-22
Why Per-fragment Lighting?
per-vertex lighting
per-fragment lighting
Introduction to Computer Graphics with OpenGL ES (J. Han)