Documente Academic
Documente Profesional
Documente Cultură
Outline
Preliminaries
Basic diffuse and Phong shading
Gouraud, Phong interpolation, smooth shading
Formal reflection equation
Motivation
Objects not flat color, perceive shape with appearance
Materials interact with lighting
Compute correct shading pattern based on lighting
This is not the same as shadows (separate topic)
I k I k
Terms can be calculated separately and later added:
multiple light sources
multiple interactions (diffuse, specular, more later)
multiple colors (R-G-B, or per wavelength)
General Considerations
Surfaces have a position, and a normal at every point.
N1
(x1,y1,z1)
N2
(x2,y2,z2)
-L
I : N L
Roughness
Phong Formula
I : ( R gE )
-L
R?
R
E
R L 2( LgN ) N
I : ( N gH )
N H
Outline
Preliminaries
Basic diffuse and Phong shading
Gouraud, Phong interpolation, smooth shading
Formal reflection equation
Vertex Shading
We know how to calculate the light intensity given:
surface position
normal
viewer position
light source position (or direction)
glShadeModel(GL_FLAT)
glShadeModel(GL_SMOOTH)
Flat - Determine that each face has a single normal, and color the
entire face a single value, based on that normal.
Gouraud Determine the color at each vertex, using the normal
at that vertex, and interpolate linearly for the pixels between
the vertex locations.
I1
y1
Ia
I1 ( ys y2 ) I 2 ( y1 ys )
y1 y2
Ib
I1 ( ys y3 ) I 3 ( y1 ys )
y1 y3
Ip
ys
y2
y3
Ia
Ip
Ib
I a ( xb x p ) I b ( x p xa )
xb xa
Scan line
I2
I3
I1 = 0
I2 = 0
area of desired
highlight
I1 = 0
I2 = 0
Outline
Preliminaries
Basic diffuse and Phong shading
Gouraud, Phong interpolation, smooth shading
Formal reflection equation
Motivation
Lots of ad-hoc tricks for shading
Kind of looks right, but?
Radiance
Power per unit projected area perpendicular to the ray
per unit solid angle in the direction of the ray
Symbol: L(x,) (W/m2 sr)
Flux given by
d = L(x,) cos d dA
Radiance properties
Radiance is constant as it propagates along ray
d 1 L1d1dA1 L2 d 2 dA2 d 2
d1 dA2 r 2
d 2 dA1 r 2
dA1dA2
d1dA1
d 2 dA2
2
r
L1 L2
Radiance properties
Sensor response proportional to radiance
(constant of proportionality is throughput)
Far away surface: See more, but subtends
smaller angle
Wall equally bright across viewing distances
Consequences
Radiance associated with rays in a ray tracer
Other radiometric quants derived from radiance
Irradiance, Radiosity
Irradiance E is radiant power per unit area
Integrate incoming radiance over hemisphere
BRDF
Reflected Radiance proportional to Irradiance
Constant proportionality: BRDF [CW pp 28,29]
Lr ( r ) Li ( i ) f ( i, r ) cos id i
Reflection Equation
i r
Lr ( r ) Li (i ) f (i , r )(i gn)
Reflected Radiance
(Output Image)
Incident
BRDF
radiance (from
light source)
Cosine of
Incident angle
Reflection Equation
i r
Sum over all light sources
Lr ( r ) Li (i ) f (i , r )(i gn)
Reflected Radiance
(Output Image)
Incident
BRDF
radiance (from
light source)
Cosine of
Incident angle
Reflection Equation
i r
d i
Lr ( r ) Li (i ) f (i , r )(i gn) di
Reflected Radiance
(Output Image)
Incident
BRDF
radiance (from
light source)
Cosine of
Incident angle