illumination
DESCRIPTION
Illumination. outer cone. Inner cone. Point Light (Emit in all directions). Spot Light (Emit within a cone). Light Sources. Directional Light (Infinitely far away). Radial Intensity Attenuation. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/1.jpg)
IlluminationIllumination
![Page 2: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/2.jpg)
Light Sources
Directional Light(Infinitely far away)
Point Light(Emit in all directions)
Spot Light(Emit within a cone)
Inner
cone
outer
cone
![Page 3: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/3.jpg)
Radial Intensity Attenuation
The amplitude of a radiant energy at the distance dl is attenuated by the factor 1/dl
2.
For realistic effects:
1/ (a0+a1dl+a2dl2) local
fl,radatten(dl)= 1.0 infinity
![Page 4: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/4.jpg)
Directional Light Sources
00 < ≤ 900
Object is within the spot light if cos ≥ cos l
Vobj . Vlight = cos Vlight
Vobj
l
![Page 5: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/5.jpg)
Angular Intensity Attenuation
fangatten() = cosa
1.0 if light source is not spotlight
fl,angatten = 0.0 if Vobj.Vlight=cos < cos l (outside of spotlight cone)
(Vobj . Vlight )al otherwise
Vobj
Vlight
l
![Page 6: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/6.jpg)
Extended Light Sources
Warn Model
Approximate it as a light-emitting surface
![Page 7: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/7.jpg)
Ambient Lighting
Background Light
A surface that is not directly exposed to a light source may still be visible due to the reflected light from nearby objects.
Ia: intensity parameter of ambient reflection
Ambient reflection is: independent of viewing direction and
surface orientation depends on the surface properties
eye
![Page 8: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/8.jpg)
Ambient Lighting
![Page 9: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/9.jpg)
Ambient Lighting Not created by any light source A constant lighting from all directions Contributed by scattered light in a surrounding
ambientambientambient LMC RGB multiplies separatelyMaterial Color Light Color
![Page 10: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/10.jpg)
Diffuse Lighting
Light is scattered with equal intensity in all directions, independent of the viewing direction.
The surface appears equally bright from any viewing angle.
Ex: rough or grainy surfaces
![Page 11: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/11.jpg)
Diffuse Lighting
• Assume light bounces in all directions
Diffuse surface
![Page 12: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/12.jpg)
Diffuse Lighting
![Page 13: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/13.jpg)
Diffuse Lighting
Surface Normaln
Surface Normaln
Surface Normaln
Full Reflection NonePartial
L
![Page 14: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/14.jpg)
Diffuse Lighting
DiffuseMaterial Color Light Color
Ambient +Diffuse
)()0,max( diffdiffambientambientdiff LMnLLMC Ambient + Diffuse
![Page 15: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/15.jpg)
Diffuse Lighting
Lambert’s cosine law:The amount of radiant energy coming from
any surface area dA in a direction N relative to the surface normal is proportional to cosN.
radiant energy per unit time intensity = -------------------------------------
projected area
cosN / (dA cosN) = constant
N (surface normal)
Radiant energy direction
N
N
dA
![Page 16: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/16.jpg)
Diffuse Lighting
Background lighting with ambient light
Iambdiff = kd Ia
kd : Fraction of the incident light that is to be scattered as diffuse reflections (diffuse reflection coefficient)
![Page 17: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/17.jpg)
Diffuse LightingIl,incident = Il cos
Il,diff = kd . Il,incident = kd . Il cos
kd . Il (N.L) if N.L > 0Il,diff =
0.0 if N.L ≤ 0
L = (Psource-Psurf) / |Psource-Psurf|
Ambient and point-source: ka . Ia + kd . Il (N.L) if
N.L>0Idiff =
ka . Ia if N.L≤0
N (surface normal)
L (to incident light source)
A (area)
A cos
cos= N.L
![Page 18: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/18.jpg)
Diffuse Lighting
![Page 19: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/19.jpg)
Diffuse Lighting
![Page 20: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/20.jpg)
Specular Lighting
The incident light is reflected in a concentrated region around specular reflection angle.
Ex: a bright spot on shiny surfaces
![Page 21: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/21.jpg)
Specular Lighting
![Page 22: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/22.jpg)
Specular Lighting Create shining surface (surface perfectly reflects) Viewpoint dependent
Ambient +Diffuse +SpecularMaterial Color Light Color
Specular
![Page 23: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/23.jpg)
Specular Lighting
N – surface normalL – to light sourceR – direction of ideal specular
reflectionV – to viewer – viewer angle relative to specular
reflection directionif =0, ideal reflector (mirror)
NRL
V
![Page 24: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/24.jpg)
Specular Lighting
Sets the intensity of specular reflection proportional to cosns.
ns: specular reflection exponent
100 or more => shiny
near 1 => dull
infinite => perfect reflector
![Page 25: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/25.jpg)
Specular Lighting
A larger ns shows more concentration of the reflection
![Page 26: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/26.jpg)
Specular Lighting
![Page 27: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/27.jpg)
Phong Model
W(): specular reflection coefficient of the surface
Il,spec = W() Il cosns
opaque surface: W()=constant=ks (0.0-1.0)
transparent surface: reflection is appreciable if approaches to 900.
NRL
Shiny surface(large ns)
NRL
Dull surface(small ns)
![Page 28: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/28.jpg)
Phong Model
cos = V . R
Il,spec = W() Il cosns
ks Il (V.R)ns if V.R>0 & N.L>0
Il,spec =
0.0 if V.R<0 & N.L≤0
R = (2N.L)N - L
NRL
V
![Page 29: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/29.jpg)
Phong Model
H: halfway vector between V and L
H=(L+V) / |L+V|
Replace V.R (cos) by N.H (cos)
ks Il (N.H)ns if V.R>0 & N.L>0
Il,spec =
0.0 if V.R<0 & N.L≤0
Requires less computation
NRL
V
H
![Page 30: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/30.jpg)
Lighting
![Page 31: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/31.jpg)
Diffuse and Specular Lightings
I = Idiff + Ispec
= ka Ia + kd Il (N.L) + ks Il (N.H)ns
![Page 32: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/32.jpg)
Multiple Light Sources
I = Iambdiff + ∑nl=1 (Il,diff + Il,spec )
= ka Ia + ∑nl=1 Il (kd(N.L) + ks(N.H)ns)
![Page 33: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/33.jpg)
Surface Light Emission
Ex: light bulb, etc.
- Position a directional light source behind the surface- Simulate the emission with a set of point light sources
distributed over the surface
Radiocity model can be used to model realistic surface emission.
![Page 34: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/34.jpg)
Surface Light Emission Color is emitted by the material only
ssn
ddaaeall LMHnLMnLLMCC ))0,(max()()0,max(
Ambient +Diffuse +Specular +Emissive
Material EmissiveColor
+
Ambient +Diffuse +Specular
![Page 35: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/35.jpg)
Surface Light EmissionExtending the Light Model:
I = Isurfemission + Iambdiff + ∑nl=1 fl,radatten fl,angatten (Il,diff + Il,spec )
kd . Il (N.Ll) if N.L > 0Il,diff =
0.0 if N.L ≤ 0
ks Il max{0.0, (N.Hl)ns } if V.R>0 &
N.L>0Il,spec =
0.0 if V.R<0 & N.L≤0
1/ (a0+a1dl+a2dl2) local
fl,radatten(dl)= 1.0 infinity
1.0 if light source is not spotlight
fl,angatten = 0.0 if Vobj.Vlight=cos < cos l
(Vobj . Vlight )al otherwise
![Page 36: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/36.jpg)
Surface Light Emission
Intensity Overflow:
- If any term exceeds the maximum intensity, set the intensity to maximum.
- Divide the intensity if each term by the magnitude of the largest term to scale intensities between 0.0-1.0
- Set negative intensities to 0.0.
![Page 37: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/37.jpg)
RGB Color
Il = (IlR, IlG, IlB)
ka = (kaR, kaG, kaB)
Ex: for blue component
IlB,diff = kdB IlB (N.Ll)
Il,spec = ksB IlB max{0.0, (N.Hl)ns}
![Page 38: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/38.jpg)
LuminanceLightness or darkness of a color (Brightness)
luminance = ∫visible f (f) I(f) df
f: frequencyI(f): intensity of light component with frequency f that is radiating in a particular
direction(f): experimentally determined proportionality function that varies with f and
illumination level
Green component contribute most to the luminanceBlue component contribute least to the luminance
luminance = 0.299 R + 0.587 G + 0.114 B orluminance = 0.2125 R + 0.7154 G + 0.0721 B
![Page 39: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/39.jpg)
Transparency
Transparent: objects behind are seenOpaque: objects behind cannot be seenTranslucent: objects behind appear blurred
Transparent surfaces produce reflected and transmitted light.
Translucent surfaces have both diffuse and specular transmission. Ray tracing can be used.
![Page 40: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/40.jpg)
Light Refraction
Snell’s Law:sin r = (i/r) sin i
i: angel of incidencei: index of refraction for the incident
material r: index of refraction for the refracting
material
Ex:air: 1.0glass: 1.61
NRL
T
i
r
i
reflection
refraction
i
r
airglass
air
![Page 41: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/41.jpg)
Light Refraction
T = [(i/r) cos i - cos r] N - (i/r)L
Gives realistic effect but requires calculation
Ray tracing
NRL
T
i
r
i
reflection
refraction
i
r
![Page 42: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/42.jpg)
Light Refraction
Ignoring path shift due to refraction:
I = (1-kt) Irefl + kt Itrans
Itrans: transmitted intensity
Irefl: reflected intensity
kt: transparency coefficient 1.0 – transparent0.0 – opaque
(1-kt): opacity factor
NRL
T
i
r
ireflection
refraction
i
r
![Page 43: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/43.jpg)
Light Refraction
In Depth-Buffer Approach: Process opaque surfaces first Then, compare the depths of the transparent surfaces
with the depth-buffer If a transparent surface is visible, combine its intensity
with the intensity that is previously stored in the frame buffer.
![Page 44: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/44.jpg)
Light Refraction
![Page 45: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/45.jpg)
Light Refraction
![Page 46: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/46.jpg)
Atmospheric Effects
fatmo(d) = e-d or fatmo(d) = e-(d)2
d: distance of the object to the viewing position: to set a positive density value for the atmosphere
Higher value means denser atmosphere, where colors are muted.
Combining atmosphere color with the object’s color:
I = fatmo(d) Iobj + (1- fatmo(d)) Iatmo
![Page 47: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/47.jpg)
Shadows
Generated by a visible surface detection method
Surfaces that are visible from the view position are shaded according to the lighting model, which can be combined with texture patterns
Shadow areas are displayed with ambient light only or ambient light combined with textures
![Page 48: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/48.jpg)
Polygon Rendering
Constant-Intensity Surface Rendering
Accurate in the following cases:
Polygon is not a section of a curved surface
All light sources are sufficiently far from the surface (N.L is constant)
Viewing position is sufficiently far from the surface (V.R is constant)
![Page 49: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/49.jpg)
Polygon Rendering
![Page 50: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/50.jpg)
Polygon Rendering
Gouraud Surface Rendering
Linearly interpolates vertex intensities across the polygon faces.
1. Determine the average unit normal vector at each vertex of the polygon
2. Apply an illumination model at each polygon vertex to obtain the light intensity at that position
3. Linearly interpolate the vertex intensities over the projected area of the polygon
![Page 51: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/51.jpg)
Polygon Rendering
Gouraud Surface Rendering
(1) At each vertex, average the normal vectors of the polygons that share the same vertex, to obtain the normal vector of the vertex:
∑nk=1 Nk
NV = --------------------
| ∑nk=1 Nk |
V
N
N
NN
NV
![Page 52: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/52.jpg)
Polygon Rendering
Gouraud Surface Rendering
(3) Interpolate vertex values to obtain the intensities at the intersection of a scan line with the polygon
P
y
x
![Page 53: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/53.jpg)
Polygon Rendering
Scan conversion algorithm
RGB(255,0,0)
RGB(0,255,0)RGB(0,0,255)
RGB(127,0,127) RGB(127,127,0)
RGB(127,64,64)
Scan line
![Page 54: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/54.jpg)
Polygon Rendering
Phong Surface Rendering
Interpolates normal vectors.N N3
N1
N2
![Page 55: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/55.jpg)
Polygon RenderingPhong Surface Rendering
For each polygon:1. Determine the average unit normal vector at each vertex of
the polygon2. Linearly interpolate the vertex normals over the projected area
of the polygon (similar to Gouraud method)3. Apply an illumination model at positions along scan lines to
calculate pixel intensities using the interpolated normal vectors
Apply the same incremental methods to obtain normal vectors on successive scan lines.
![Page 56: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/56.jpg)
Polygon Rendering
Flat shading Gouraud shading Phong shading
Source: Michal Necasek
![Page 57: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/57.jpg)
Texture Mapping
Texel: a component of texture description
Four RGB components:- Red component- Green component- Blue component- an index into a color table or a single luminance value
![Page 58: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/58.jpg)
Texture Mapping
Linear Texture Patterns (1D) s - coordinate texture space
s
0.0
1.0
3 x n elements
RGB
![Page 59: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/59.jpg)
Texture Mapping
Surface Texture Patterns (2D) s,t - coordinate texture space
s(0,0)
3 x m x n elements
t
(1,0)
(0,1)
![Page 60: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/60.jpg)
Texture Mapping
Surface Texture Patterns (2D)
Texture space(s,t-coord)
Texture-surface transformation
Viewing and projection transformation
Texture space
Object space
Image space
Texture-surface transformation
Viewing and projection transformation
Method 1
Method 2
Object space(u,v-coord)
Image space(x,y-coord)
![Page 61: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/61.jpg)
Texture Mapping
Surface Texture Patterns (2D)Method 1: Mapping from Texture Space to Object Space –
u = u(s,t) = au s + bu t + cu
v = v(s,t) = av s + bv t + cv
Mapping from Object Space to Image Space – use viewing and projection transformations
Disadvantage: If the texture patch does not match up with the pixel boundaries, the fractional area of pixel coverage must be calculated.
![Page 62: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/62.jpg)
Texture Mapping
Surface Texture Patterns (2D)
Method 2:
MVP-1: inverse viewing-projection
transformation
MT-1: inverse texture-map transformation
Pattern Array
projected pixel area
pixel areaSurface
MVP-1MT
-1
![Page 63: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/63.jpg)
Texture Mapping
Volume Texture Patterns (3D) s,t,r - coordinate texture space
s
3 x m x n x k elements
t r
![Page 64: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/64.jpg)
Surface Light Emission
Divide surfaces to eliminate the overlap.
![Page 65: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/65.jpg)
Depth Cueing
fdepth(d) is multiplied by each pixel’s color
fdepth(d) = (dmax-d)/(dmax-dmin)
d: distance of a point from the viewing position
dmin: 0.0
dmax: 1.0
![Page 66: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/66.jpg)
OpenGL
glPolygonMode(GL_FRONT_AND BACK, GL_LINE)• displays both visible and hidden edges
glEnable (GL_FOG) glFogi (GL_FOG_MODE, GL_LINEAR)
• generates fog effect. Uses depth cueing.
glEnable (GL_CULL_FACE) glDisable (GL_CULL_FACE) glCullFace (mode)
• used for backface removal• GL_BACK (default), GL_FRONT (if inside a building),
GL_FRONT_AND_BACK
![Page 67: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/67.jpg)
OpenGL glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
• initializes GLUT, requests a depth buffer and a frame buffer
glClear (GL_DEPTH_BUFFER_BIT)• initially depth buffer has the background color. It must be cleared every
time before displaying a new frame.
glEnable (GL_DEPTH_TEST) glDisable (GL_DEPTH_TEST)
• to activate depth buffer routines
glClearDepth (maxDept)• to set maxDepth to another value (0.0 – 1.0)
glDepthRange (nearNormDept, farNormDept)• to adjust normalization values (defaults: near- 0.0, far- 1.0)
![Page 68: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/68.jpg)
OpenGL
glDepthFunction (testCondition)
• to specify a test condition for depth-buffer routines
• GL_LESS (default), GL_GREATER, GL_EQUAL, GL_NOTEQUAL, GL_LEQUAL, GL_GEQUAL, GL_NEVER, GL_ALWAYS
glDepthMask (writeStatus)
• to set the status of depth-buffer routines
• TRUE: read/write
• FALSE: read only
![Page 69: Illumination](https://reader036.vdocuments.site/reader036/viewer/2022062518/568143d5550346895db06382/html5/thumbnails/69.jpg)
Light Sources
Point light source
Infinitely distant light source