Graphics CSCI 343, Fall 2005 Lecture 19 Lighting and Shading II - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Graphics CSCI 343, Fall 2005 Lecture 19 Lighting and Shading II

Description:

It uses 4 vectors to calculate the color and intensity of a point on a surface. ... We can use y instead of f in our calculation of specular reflection: ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 13
Provided by: csFre
Category:

less

Transcript and Presenter's Notes

Title: Graphics CSCI 343, Fall 2005 Lecture 19 Lighting and Shading II


1
Graphics CSCI 343, Fall 2005Lecture
19Lighting and Shading II
2
The Phong Reflection Model
The phong reflection model leads to efficient
computation of surface lighting and gives
reasonably realistic renderings. It uses 4
vectors to calculate the color and intensity of a
point on a surface.
l
n
n normal to the surface at p l direction to
light source v direction to viewer (COP) r
direction of perfectly reflected ray (determined
by n and l)
v
p
r
I Ia Id Is LaRa LdRd LsRs
3
The complete Phong reflection model
Putting all the terms together gives the full
Phong reflection model
4
Computing Dot Products
Computing Dot Products in 2 dimensions. Recall
that
where q is the angle between the two vectors.
What is this dot product in terms of x1, y1, x2,
y2?
(x1, y1)
q
(x2, y2)
Similarly, in 3D
5
Finding the Normal to a plane
A plane can be defined by 3 non-colinear points,
p0, p1, and p2. These points define 2 vectors,
p1-p0, and p2-p0 The normal to the plane is the
cross product between the two vectors
(p1-p0)x(p2-p0). The direction of the
normal determines the outward facing side of the
plane.
p2
p1
p0
6
Computing a cross product
Suppose
Then
7
Example of a cross product
Suppose
Then
8
Normalizing the length to 1
The length of the normal vector should always be
set to 1.
Suppose
Then
and
9
Special Cases of NormalsA plane
For a surface defined as a function of x, y and
z, the normal is specified as
For a plane defined as ax by cz d
0, we can show that the normal is (but we
still need to normalize the length to 1).
10
Special Cases of Normals A sphere
For a point, p (x, y, z) on a sphere defined
as x2 y2 z2 -1 0
n ?
Normalized, n' ?
11
Computation of r
n
r must lie in the same plane as l and
n. Therefore,
r
l
qi
qr
From the above three equations we can derive r in
terms of l and n (we will do this in class)
12
The halfway vector
Computing r takes a lot of computation. We can
approximate the angle between r and v by
computing the halfway vector.
h
n
r
l
y
qi
v
f
What is f in terms of y?
2y f
The angle between n and h, y, is 1/2 the angle
between r and v, f.
We can use y instead of f in our calculation of
specular reflection
We adjust a' to account for the fact that y lt f
Write a Comment
User Comments (0)
About PowerShow.com