llumination homas Funkhouser Princeton University C0 426, Fall 2000 ay Casting mage aycastcamera camera, cene scene, int width, int height { mage image = new magewidth, height; for int i = 0; i < width; i { for int j = 0; j < height; j { ay ray = ConstructayhroughPixelcamera, i, j; ntersection hit = Findntersectionray, scene; image[i][j] = GetColorscene, ray, hit; } } return image; } Wireframe 1
ay Casting mage aycastcamera camera, cene scene, int width, int height { mage image = new magewidth, height; for int i = 0; i < width; i { for int j = 0; j < height; j { ay ray = ConstructayhroughPixelcamera, i, j; ntersection hit = Findntersectionray, scene; image[i][j] = GetColorscene, ray, hit; } } return image; } Without llumination ay Casting mage aycastcamera camera, cene scene, int width, int height { mage image = new magewidth, height; for int i = 0; i < width; i { for int j = 0; j < height; j { ay ray = ConstructayhroughPixelcamera, i, j; ntersection hit = Findntersectionray, scene; image[i][j] = GetColorscene, ray, hit; } } return image; } With llumination 2
llumination How do we compute radiance for a sample ray? image[i][j] = GetColorscene, ray, hit; ngel Figure 6.2 Goal Must derive computer models for... Emission at light sources cattering at surfaces eception at the camera esirable features Concise Efficient to compute ccurate 3
Overview irect llumination Emission at light sources cattering at surfaces Global illumination hadows efractions nter-object reflections irect llumination Modeling ight ources x,y,z,θ,φ,λ... describes the intensity of energy, leaving a light source, arriving at locationx,y,z,... from direction θ,φ,... with wavelength λ x,y,z ight 4
Empirical Models deally measure irradiant energy for all situations oo much storage ifficult in practice λ OpenG ight ource Models imple mathematical models: Point light irectional light pot light 5
Point ight ource Models omni-directional point source e.g., bulb intensity 0, position px, py, pz, factors k c, k l, k q for attenuation with distance d ight d px, py, pz 0 = k c k ld k q d 2 irectional ight ource Models point light source at infinity e.g., sun intensity 0, direction dx,dy,dz dx, dy, dz o attenuation with distance = 0 6
! " pot ight ource Models point light source with direction e.g., uxo intensity 0, position px, py, pz, direction dx, dy, dz attenuation d px, py, pz ight γ k d 0 = k c k ld q 2 Overview irect llumination Emission at light sources cattering at surfaces Global illumination hadows efractions nter-object reflections irect llumination 7
# $ % & ' Modeling urface eflectance s θ,φ,γ,ψ,λ... describes the amount of incident energy, arriving from direction θ,φ,... leaving in direction γ,ψ, with wavelength λ urface Empirical Models deally measure radiant energy for all combinations of incident angles oo much storage ifficult in practice λ ψ,λ urface θ,φ 8
*, -. / 0 OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient Based on model proposed by Phong urface OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient Based on Phong model proposed illumination by model Phong urface 9
1 2 iffuse eflection ssume surface reflects equally in all directions Examples: chalk, clay urface iffuse eflection How much light is reflected? epends on angle of incident light d = dcosθ θ d d urface 10
3 4 5 6 7 iffuse eflection ambertian model cosine law dot product θ urface = OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient urface 11
8 9 pecular eflection eflection is strongest near mirror angle Examples: mirrors, metals θ θ pecular eflection How much light is seen? epends on angle of incident light and angle to viewer iewer α θ θ 12
: ; < = > pecular eflection Phong Model cosα n iewer α θ θ = n OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient urface 13
? @ B Emission epresents light eminating directly from polygon Emission 0 OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient urface 14
C E F mbient erm epresents reflection of all indirect illumination his is a total hack avoids complexity of global illumination! OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient urface 15
G H J OpenG eflectance Model imple analytic model: diffuse reflection specular reflection emission ambient urface OpenG eflectance Model um diffuse, specular, emission, and ambient eonard McMillan, M 16
17 urface llumination Calculation ingle light source: n E = iewer α θ θ urface llumination Calculation Multiple light sources: = i i n i i i E 2 iewer 1
M O Overview irect llumination Emission at light sources cattering at surfaces Global illumination hadows ransmissions nter-object reflections Global llumination Global llumination Greg arson 18
19 hadows hadow terms tell which light sources are blocked P Cast ray towards each light source i Q i = 0 if ray is blocked, i = 1 otherwise ngel Figure 6.44 = n E hadow erm ay Casting race primary rays from camera irect illumination from unblocked lights only = n E
20 n E = ecursive ay racing lso trace secondary rays from hit surfaces Global illumination from mirror reflection and transparency Mirror reflections race secondary ray in direction of mirror reflection Evaluate radiance along secondary ray and include it into illumination model n E = adiance for mirror reflection ray
21 ransparency race secondary ray in direction of refraction U Evaluate radiance along secondary ray and include it into illumination model n E = adiance for refraction ray n E = ransparency ransparency coefficient is fraction transmitted = 1 if object is translucent, = 0 if object is opaque W 0 < < 1if object is semi-translucent ransparency Coefficient
X efractive ransparency For thin surfaces, can ignore change in direction ssume light travels straight through surface η i η r Θr Θ i Θ i efractive ranparency For solid objects, apply nell s law: η sin Θ = η sin Θ r r i i η i η r Θ i Θr ηi = cosθi cosθr η r ηi η r 22
23 ecursive ay racing ay tree represents illumination computation ay traced through scene ay tree n E = ecursive ay racing ay tree represents illumination computation ay traced through scene ay tree n E =
Y Z ecursive ay racing GetColor calls ayrace recursively mage ayracecamera camera, cene scene, int width, int height { mage image = new magewidth, height; for int i = 0; i < width; i { for int j = 0; j < height; j { ay ray = ConstructayhroughPixelcamera, i, j; ntersection hit = Findntersectionray, scene; image[i][j] = GetColorscene, ray, hit; } } return image; } ummary ay casting direct llumination Usually use simple analytic approximations for light source emission and surface reflectance ecursive ray tracing global illumination ncorporate shadows, mirror reflections, and pure refractions ll of this is an approximation so that it is practical to compute More on global illumination later! 24
[ \ ] ^ _ llumination erminology adiant power [flux] Φ ate at which light energy is transmitted in Watts. adiant ntensity Power radiated onto a unit solid angle in direction in Watts/sr» e.g.: energy distribution of a light source inverse square law adiance adiant intensity per unit projected surface area in Watts/m 2 sr» e.g.: light carried by a single ray no inverse square law rradiance E ncident flux density on a locally planar area in Watts/m 2» e.g.: light hitting a surface along a adiosity B Exitant flux density from a locally planar area in Watts/ m 2 25