Post on 15-Apr-2022
Graphics
Graphics Lab @ Korea University http://kucg.korea.ac.kr
Basic Rendering Methods
Korea Univ.
Computer Graphics Lab.
KUCG
Graphics Lab @ Korea University
Polygon Shading
Spatial Coherence
Illumination calculations for pixels by the same primitive
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat Shading
Constant-intensity Shading
OK for polyhedral objects
Not so good for ones with the smooth surfaces
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat Shading Process
One illumination calculation per polygon
All pixels inside each polygon will be the same color
i i
n
SiDALAE IKIKIKII ))RV()LN(( ii
Polygon Normal Vector
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat Shading in OpenGL
glShadeModel(GL_FLAT)
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shading
Intensity-interpolation Scheme
Produces smoothly shaded polygonal mesh
Shows some illumination highlights
Still can’t capture subtle lighting effects
Needs extremely fine mesh
Effectively reduced by Phong shading
<Flat Shading vs. Gouraud Shading>
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shading Process (1/2)
One lighting calculation per vertex
Interpolates pixels inside polygon
By using the colors computed at vertices
i i
n
SiDALAE IKIKIKII ))RV()LN(( ii
Vertex Normal Vector
Viewer Light
N1
N3
V1 L1
Polygon
N2
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Vertex Normal Vector
Average of the surface normals
From polygons sharing that vertex
N2
N3
N4
N1
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shading Process (2/2)
Bilinearly interpolate colors at vertices
Down and across scan lines
I1
I2 I3
21 I1IA 31 I1IB
BA1I
I
1,,0
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shading in OpenGL
glShadeModel(GL_SMOOTH)
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shading of Highlights
by the Primitives’ Size & Location
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Phong Shading
Normal-vector interpolation shading
Can capture subtle illumination effects in polygon
interiors
Not supported by OpenGL/DirectX
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Phong Shading Process (1/2)
One lighting calculation per pixel
Approximate surface normals for inside points
Viewer Light
N3
V1 L1
Polygon
N2
i i
n
SiDALAE IKIKIKII ))RV()LN(( ii
N1
Pixel Normal Vector
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Phong Shading Process (2/2)
Bilinearly interpolate surface normals at vertices
21 N1NA 31 N1NB
BA1N
N1
N3 N2
N
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat vs. Gouraud vs. Phong (1/2)
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat vs. Gouraud vs. Phong (2/2)
Wireframe Flat Shading
Gouraud Shading Phong Shading
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Wireframe
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Ambient Only
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Flat Shaded Polygons with
Diffuse Reflection
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shaded Polygons with
Diffuse Reflection
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Gouraud Shaded Polygons with
Specular Reflection
http://kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Phong Shaded Polygons with
Specular Reflection
http://kucg.korea.ac.kr