Professional Documents
Culture Documents
Sampling a scene
ideally, need to consider light coming to the viewer from each point on each surface in a scene
Points in a scene
points are the smallest units of our scene: can think of them having no area or infinitesimal area there are an infinite number of visible points: mathematically intractable
Surface elements
only consider a finite number of differential pieces of surface figure out how much light comes to the viewer from each of these pieces of surface
Global/local
Illumination
Lights and Shadows
from Pixars Luxo Jr.
most light striking a surface element comes directly from emissive light sources in the scene (direct illumination) sometimes light from source is blocked by other objects surface element is then in shadow from that light source
eye
object
indirect illumination
object object
light
Inter-Object Reflection light bounces off other objects toward our surface element when that light reaches our surface element, it brightens it (indirect illumination) Global Illumination simulates what happens when other objects affect the light reaching a surface element Local Illumination does not worry about this.
BRDFs In general, behavior of light is simulated by bi-directional reflectance distribution functions (BRDFs)
- Lambertian and Phong approximations model simple BRDF - given incoming light ray at surface point, BRDF is used to calculate how much of that light ray will be reflected in a particular outgoing direction (function of incoming and outgoing angles) - can be obtained from analytical model - or measurements of actual surfaces
Shading Model
Determines where the illumination model is applied and the arguments it receives Some shading models invoke an illumination model for each pixel; others invoke an illumination model for selected points, shading the rest by interpolation
Reflection models calculate light intensity at a given point.
Graphics: A Hack!
Caveat : Most illumination models used in graphics (especially in interactive 3D graphics h/w) are approximations picked for efficiency not accuracy- they are not physically based) An important reseach goal develop modelsefficient and physically correct The intensity and wavelength of light reflected from a surface depends on the incident wavelength, angle of incidence, nature (roughness) of the surface material, and its electrical properties (permittivity, permeability and conductivity). (road example..)
I k I k
Illumination Models
Local Illumination
Defines single light and single surface interaction
Global Illumination
Defines interchange of lights between all surfaces
Incident flux
Reflected flux
Absorbed flux
Transmitted flux
t
diffuse Traditional graphics LIMs are: Fast to compute Heuristic and incomplete (incomplete)
Specular
Ambient reflection
Independent of object position and viewer position Constant Exists in most environments some light hits surface from all directions a way of approximating contributions from indirect lighting
I = Ia K a Ia = Intensity of ambient light Ka= Fraction reflected, 0<= Ka<=1 Diffuse (Lambertian) reflection
Typical of dull matte surfaces Independent of viewer position Dependant of light source position (in this case a point source again a non-physical abstraction)
Diffuse reflection
I Sin () I Cos () N
Specular Reflection
Specular reflection
Typical of bright and shiny surfaces Color depends on material and how it scatters light energy In plastics it is color of point source and in metal its the color of metal In other materials will combine color of light source and color of material Dependant on light source position and viewer position
Specular Reflection
To Point lightL Source N
Early model by Phong neglected effect of material color on specular highlight made all surfaces look plastic For perfect reflector, see light iff = 0 For real reflector , reflected light falls off as increases
Phong approximation : cosn As n increases , highlight is more concentrated, surface appears glossier
N S
Ncos
R = 2N (N. L) - L
(if the normal to the surface were oriented along h, the viewer would see the brightest specular light) (psi is double of phi if all vectors are co-planar)
Example
Only differences in these teapots are the parameters in the Phong model
Dot products
N If N.L is ve, the light is behind the surface, and so cannot illuminate it.
L N
If N.V is ve, the viewer is beneath the surface, and so cannot see the illumination. (both cases, illumination set to zero) V
Light Sources
In the Phong Model, we add the results from each light source Each light source has separate diffuse, specular, and ambient terms to allow for maximum flexibility even though this form does not have a physical justification Separate red, green and blue components Hence, 9 coefficients for each point source Idr, Idg, Idb, Isr, Isg, Isb, Iar, Iag, Iab
Material Properties
Material properties match light source properties
Nine absorbtion coefficients
glShadeModel(GL_FLAT)
glShadeModel(GL_SMOOTH)
Constant Shading
Single Intensity value per polygon If Polygon mesh is an approximation to curved surface, faceted look is a problem Facets are exaggerated by mach band effect
Intensity Intensity Distance along surface Actual Distance along surface
---Perceived
Mach band effect: discrepancies between actual and perceived intensities due to bilateral inhibition A photoreceptor in the eye responds to light according to the intensity of the light falling on it minus the activation of its neighbors
I (c j ) e(c j ) a k e(ck )
k j
0 ak 1
Gouraud Shading
Use for polygon approximations to curved surfaces Linear Interpolation of intensity along scan Lines Eliminates intensity discontinuities polygon edges still have gradient discontinuities, so mach banding is improved but not eliminated Must differentiate real ( desired) creases from those induced by polygonal approximations (e.g, shared edges of a cuboid vs edges in polygonized sphere) Step 1 Calculate bogus vertex normals as average of surrounding polygons noormals
Gouraud Shading
N1 Nv N4 N3 N2
Nv = (N1 + N2 + N3 + N4)/ ||N1 + N2 + N3 + N4|| Since neighboring polygons sharing vertices and edges are approximations to smoothly curved surfaces and wont have greatly differing surface normals, this approximation is a reasonable one
Gouraud Shading
Step 2 Interpolate intensity along polygon edges Step 3 Interpolate along scan Lines
I1
Y1
YS Y2 Y3 Ia = I1* Ys-y2/y1-y2 + I2 * y1-ys /y1-y2 I2 I3 Ib = I1* Ys-y3/y1-y3 + I3 * y1-ys /y1-y3 Ip
Gouraud Shading
Gouraud vs constant shading Integrates nicely with scan line algorithm I / y is constant along polygon edge
Surface
Intensity
Constant
Gouraud -----
Nc Na Nb
Ia
I
Ib
Gouraud
Ia
Ib
Phong
Phong Shading
Also called normal vector interpolation
Interpolate N rather than I Especially important with specular reflection Computationally expensive at each pixel to Recompute N ----- must normalize , requiring expensive square root Recompute I
Bishop and Weimer developed fast approximation using taylor series expansion ( in SIGGRAPH 86)
Global Illumination: Global illumination model with texture, bump, and reflection mapping
Should also model inverse square law energy density fall off I = Ia ka * (Ip kd)(N. L), where fatt = 1 / (dL)2 dL= path length from light to object to viewer This makes surfaces with equal kd(N. L) differ in appearance important if overlap
N N
Formula often creates harsh effects we do not often see objects illuminated by point lights Instead use fatt = min(1 / c1 + c2dL + c3 (dL)2, 1)
Refractive Transparency
Modelling refracted light complicates matters! UnRefracted (Geometrical) line of sight Refracted (optical) line of sight
i
i Line of sight
Transparent object
Snells Law
Medium 1 Medium 2
sin t = sin i i / t
Polygon 1 Polygon 2