Illumination and Shading Jehee Lee Seoul National University.
-
Upload
judith-stevens -
Category
Documents
-
view
217 -
download
2
Transcript of Illumination and Shading Jehee Lee Seoul National University.
![Page 1: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/1.jpg)
Illumination and Shading
Jehee Lee
Seoul National University
![Page 2: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/2.jpg)
Photorealism in Computer Graphics
• Photorealism in computer graphics involves– Accurate representations of surface properties, and– Good physical descriptions of the lighting effects
• Modeling the lighting effects that we see on an object is a complex process, involving principles of both physics and psychology
• Physical illumination models involve– Material properties, object position relative to light sources and
other objects, the features of the light sources, and so on
![Page 3: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/3.jpg)
Illumination and Rendering
• An illumination model in computer graphics– also called a lighting model or a shading model– used to calculate the color of an illuminated position
on the surface of an object– Approximations of the physical laws
• A surface-rendering method determine the pixel colors for all projected positions in a scene
![Page 4: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/4.jpg)
Light Sources
• Point light sources– Emitting radiant energy at a single point– Specified with its position and the color of the emitted light
• Infinitely distant light sources– A large light source, such as sun, that is very far from a scene– Little variation in its directional effects– Specified with its color value and a fixed direction for the light rays
![Page 5: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/5.jpg)
Light Sources
• Directional light sources– Produces a directional beam of light– Spotlight effects
• Area light sources
![Page 6: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/6.jpg)
Light Sources
• Radial intensity attenuation– As radiant energy travels, its amplitude is attenuated by
the factor– Sometimes, more realistic attenuation effects can be
obtained with an inverse quadratic function of distance
– The intensity attenuation is not applied to light sources at infinity because all points in the scene are at a nearly equal distance from a far-off source
2/1 d
local is source if
1infinityat is source if0.1
2210 dadaa
f
![Page 7: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/7.jpg)
Light Sources
• Angular intensity attenuation– For a directional light, we can attenuate the light inten
sity angularly as well as radially
nf cos)(
![Page 8: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/8.jpg)
Surface Lighting Effects
• An illumination model computes the lighting effects for a surface using the various optical properties– Degree of transparency, color reflectance, surface texture
• The reflection (phong illumination) model describes the way incident light reflects from an opaque surface– Diffuse, ambient, specular reflections– Simple approximation of actual physical models
![Page 9: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/9.jpg)
Diffuse Reflection
• Incident light is scattered with equal intensity in all directions
• Such surfaces are called ideal diffuse reflectors (also referred to as Lambertian reflectors)
![Page 10: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/10.jpg)
Diffuse Reflection
• Light intensity is independent of angle of reflection
• Light intensity depends on angle of incidence
![Page 11: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/11.jpg)
Diffuse Reflection
: the intensity of the light source
: diffuse reflection coefficient,
: the surface normal (unit vector)
: the direction of light source,(unit vector)
)(cos LNIkIkI ldld
lI
dk
N
L
![Page 12: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/12.jpg)
Ambient Light
• Multiple reflection of nearby (light-reflecting) objects yields a uniform illumination
• A form of diffuse reflection independent of he viewing direction and the spatial orientation of a surface
• Ambient illumination is constant for an object
: the incident ambient intensity: ambient reflection coefficient, the proportion
reflected away from the surface
aIak
aaIkI
![Page 13: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/13.jpg)
Ambient + Diffuse
0 if
0 if)(
LNIk
LNLNIkIkI
aa
ldaa
![Page 14: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/14.jpg)
Specular Reflection
• Perfect reflector (mirror) reflects all lights to the direction where angle of reflection is identical to the angle of incidence
• It accounts for the highlight
• Near total reflector reflects most of light over a range of positions close to the direction
![Page 15: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/15.jpg)
Specular Reflection
• Phong specular-reflection model– Note that N, L, and R are coplanar, but V may not be
coplanar to the others
nls
nls VRIkIkI )(cos
: intensity of the incident light
: color-independent specular coefficient
: the gloss of the surface
lI
sk
n
![Page 16: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/16.jpg)
Specular Reflection
• Glossiness of surfaces
![Page 17: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/17.jpg)
Specular Reflection
• Specular-reflection coefficient ks is a material property– For some material, ks varies depending on – ks =1 if =90°
• Calcularing the reflection vector R
NNLLR )2(
LNNLR )2(
![Page 18: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/18.jpg)
Specular Reflection
• Simplified Phong model using halfway vector– H is constant if both viewer and the light source are s
ufficiently far from the surface
|| LV
LVH
nsp
nsp
nsp
nsp
HNkIkI
VRkIkII
)(cos
)(cos
![Page 19: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/19.jpg)
Ambient+Diffuse+Specular Reflections
• Single light source
• Multiple light source
• Emission and attenuation
nlsldaa VRIkLNIkIkI )()(
l
nlsldaa VRIkLNIkIkI )()(
l
nlsldattenanglattenradl
aaemit
VRIkLNIkff
IkII
)()(_,_,
![Page 20: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/20.jpg)
Parameter Choosing Tips
• For a RGB color description, each intensity and reflectance specification is a three-element vector
• The sum of reflectance coefficients is usually smaller than one
• Try n in the range [0, 100]• Use a small ka (~0.1)• Example
– Metal: n=90, ka=0.1, kd=0.2, ks=0.5
1 sda kkk
![Page 21: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/21.jpg)
![Page 22: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/22.jpg)
Atmospheric Effects
• A hazy atmosphere makes colors fade and objects appear dimmer
• Hazy-atmosphere effect is often simulated with an exponential attenuation function such as
• Higher values for produce a denser atmosphere
2)()(
)(d
hazy
dhazy
edf
edf
hazehazyobjhazy IdfIdfI )](1[)(
![Page 23: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/23.jpg)
Polygon Rendering Methods
• We could use an illumination model to determine the surface intensity at every projected pixel position
• Or, we could apply the illumination model to a few selected points and approximate the intensity at the other surface positions
• Curved surfaces are often approximated by polygonal surfaces
• So, polygonal (piecewise planar) surfaces often need to be rendered as if they are smooth
![Page 24: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/24.jpg)
Constant-Intensity Surface Rendering
• Constant (flat) shading– Each polygon is one face of a polyhedron and is not a
section of a curved-surface approximation mesh
![Page 25: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/25.jpg)
Intensity-Interpolation Surface Rendering
• Gouraud shading– Rendering a curved surface that is approximated wit
h a polygon mesh– Interpolate intensities at polygon vertices
• Procedure1. Determine the average unit normal vector at each verte
x2. Apply an illumination model at each polygon vertex to o
btain the light intensity at that position3. Linearly interpolate the vertex intensities over the proje
cted area of the polygon
![Page 26: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/26.jpg)
Intensity-Interpolation Surface Rendering
• Normal vectors at vertices– Averaging the normal vectors for each polygon
sharing that vertex
1N
2N
3N
4N
vN
4321
4321 )(
NNNN
NNNNNv
![Page 27: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/27.jpg)
Intensity-Interpolation Surface Rendering
• Intensity interpolation along scan lines– I4 and I5 are interpolated along y-axis, and then– Ip is interpolated along x-axis
• Incremental calculation is also possible
y
x
1
2
3
4 5
p scan line
545
44
45
25
323
252
23
535
221
411
21
244
Ixx
xxI
xx
xxI
Iyy
yyI
yy
yyI
Iyy
yyI
yy
yyI
pp
![Page 28: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/28.jpg)
Intensity-Interpolation Surface Rendering
![Page 29: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/29.jpg)
Gouraud Shading Problems
• Lighting in the polygon interior is inaccurate• Mach band effect
– Optical illusion
![Page 30: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/30.jpg)
Mach Band Effect
• These “Mach Bands” are not physically there. Instead, they are illusions due to excitation and inhibition in our neural processing
The bright bands at 45 degrees (and 135 degrees) are illusory.
The intensity of each square is the same.
![Page 31: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/31.jpg)
Normal-Vector InterpolationSurface Rendering
• Phong shading– Interpolate normal vectors at polygon vertices
• Procedure1. Determine the average unit normal vector at each vertex
2. Linearly interpolate the vertex normals over the projected area of the polygon
3. Apply an illumination model at positions along scan lines to calculate pixel intensities n1
n2n3
![Page 32: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/32.jpg)
Gouraud versus Phong Shading
• Gouraud shading is faster than Phong shading– OpenGL supports Gouraud shading
• Phong shading is more accurate
![Page 33: Illumination and Shading Jehee Lee Seoul National University.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649cee5503460f949bc3b6/html5/thumbnails/33.jpg)
Problems with Interpolated Shading
• Polygon silhouette• Perspective distortion• Orientation dependence• Shared edges