

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















Ron Goldman
Department of Computer Science
Rice University
Illumination and Shading
Standard Assumptions
Illumination Models
Shading Models
Uniform Shading
Assumptions
Polygon Normals
Normal to a Polygon
k
k + 1
k
k + 1
k
k + 1
Newell’s Formula
k
k + 1
k = 0
m
| N |= 2 × Area ( Polygon ) (Green’s Theorem)
2 P 1
3
Gouraud Shading
Purpose
Method
Strategy
vertex
polygon vertex ∈ Polygon
vertex ∈ Polygon polygon
(Normalized Average)
Observation
Polygon
Scan Line
Vertex
Vertex
Edge
Vertex Vertex
Vertex
Vertex
Edge
Edge
Edge
Edge
Edge
Scan Line
Incremental Intensity Computation
Along a Scan Line
1
= ( x 1
, y 1
, z 1
2
= ( x 2
, y 2
, z 2
( x , y , z ) ( x^ +^ Δ x ,^ y^ +^ Δ y ,^ z^ +^ Δ z )
Δ x = 1
}
1
2
Δ x = 1 ⇒ Δ t = 1 /( x 2
− x 1
2
1
)Δ t = ( I 2
1
) /( x 2
− x 1
Next Scan Line
1
= ( x 1
, y 1
, z 1
2
= ( x 2
, y 2
, z 2
( x , y , z )
( x + Δ x , y + Δ y , z + Δ z )
Δ y = 1
2
1
Δ y = 1 ⇒ Δ t = 1 /( y 2
− y 1
2
1
)Δ t = ( I 2
1
) /( y 2
− y 1
Orientation Dependence and Independence
Problem
Solution
Note
Barycentric Coordinates and Coordinate Independence
( 1 − t ) I 1
1
2
3 €
( 1 − s ) I 1
1
2
3 €
β 1
β 2
β 3
I = ( 1 − u ) ( 1 − t ) I 1
u ( 1 − s ) I 1
sI 3
I = β 1
1
2
3
I = ( 1 − u )( 1 − t ) + u ( 1 − s )
β 1
1
β 2
2
β 3
3
Barycentric Coordinates
β 1
β 2
β 3
P = β 1
1
2
3
1
2
1
) + β 3
3
1
β 1
,β 2
,β 3
unique
Naive Phong Shading
Purpose
Method
Strategy
polygons to which the vertex belongs.
vertex
polygon vertex ∈ Polygon
vertex ∈ Polygon polygon
(Normalized Average)
Incremental Normal Computation
Along a Scan Line
1
= ( x 1
, y 1
, z 1
2
= ( x 2
, y 2
, z 2
( x , y , z ) ( x^ +^ Δ x ,^ y^ +^ Δ y ,^ z^ +^ Δ z )
Δ x = 1
}
1
2
Δ x = 1 ⇒ Δ t = 1 /( x 2
− x 1
2
1
)Δ t = ( N 2
1
) /( x 2
− x 1
Next Scan Line
1
= ( x 1
, y 1
, z 1
2
= ( x 2
, y 2
, z 2
( x , y , z )
( x + Δ x , y + Δ y , z + Δ z )
Δ y = 1
2
1
Δ y = 1 ⇒ Δ t = 1 /( y 2
− y 1
2
1
)Δ t = ( N 2
1
) /( y 2
− y 1
Clever Implementation -- Diffuse Reflection
Diffuse Reflection
diffuse
p
k d
p
k d
( 1 − t )( L • N 1
) + t ( L • N 2
( 1 − t ) N 1
J ( t ) = ( 1 − t )( L • N 1
1
2
-- Similar to Gouraud (Scalars)
-- Avoids Dot Products Along Scan Lines
N ( t ) = ( 1 − t ) N 1
next
current
d next
next
next
next
-- Normalization by Newton’s Method
Clever Implementation -- Specular Reflection
Specular Reflection
specular
p
k s
n
specular
p
k s
( )
n
N = ( 1 − t ) N 1
specular
p
k s
2 ( 1 − t )( L • N 1
) + t ( L • N 2
{ }
Similar to Gouraud
( 1 − t )( V • N 1
) + t ( V • N 2
{ }
Similar to Gouraud
( 1 − t ) N 1
2
Constant
n
( 1 − t ) N 1
2
2
= ( N + Δ N ) • ( N + Δ N ) -- No Square Root
Spherical Linear Interpolation
Slerp
slerp ( N 1
2
, t ) =
sin ( 1 − t ) φ ( )
sin( φ)
1
sin t φ ( )
sin( φ)
2
cos( φ) = N 1
2
sin( φ) = 1 − ( N 1
2
2
-- avoids square roots
Δsine and
Δcosine
sin(Δ t φ) and
cos(Δ t φ)