Illumination Michael Kazhdan (601.457/657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2
Ray Casting Image RayCast(Camera camera, Scene scene, int width, int height) { Image image = new Image(width, height); for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j); Intersection hit = FindIntersection(ray, scene); image[i][j] = GetColor(scene, ray, hit); } return image; } Without Illumination
Ray Casting Image RayCast(Camera camera, Scene scene, int width, int height) { Image image = new Image(width, height); for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j); Intersection hit = FindIntersection(ray, scene); image[i][j] = GetColor(scene, ray, hit); } return image; } With Illumination
Illumination How do we compute radiance for a sample ray? image[i][j] = GetColor( scene, ray, hit ); Angel Figure 6.2
Goal Must derive models for... Emission at light sources Direct light on surface points Scattering at surfaces Reception at the camera Desirable features Concise Efficient to compute Accurate
Overview Direct Illumination Emission at a light source Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Intersection Testing
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Lambertian Shading
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Phong Shading
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Shadow Computation
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Reflective Bouncing
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions Refractive Bouncing
Overview Direct Illumination Emission at light sources Reflection off the surface Global illumination Shadows Inter-object reflections Transmissions
Modeling Light Sources I L (x, y, z, θ, φ, λ) describes the intensity of energy (I), leaving a light source (L), at a particular angle (θ, φ) arriving at a location (x, y, z), with a particular wavelength (λ) λ (θ, φ) (x, y, z) Light
Empirical Models Ideally measure irradiant energy for all situations Too much storage Difficult in practice λ (θ, φ) (x, y, z) Light
Simplified Light Source Models Simple mathematical models: Point light Directional light Spot light
Point Light Source Models omni-directional point source intensity I, (typically a three-channel value) position p = (p x, p y, p z ), factors (k c, k l, k q ) for attenuation with distance (δ) I δ (p x, p y, p z ) I L = I k c + k l δ + k q δ 2 Light The light hitting a surface point q comes in from direction q p.
Directional Light Source Models point light source at infinity intensity I, (typically a three-channel value) direction Ԧd = (d x, d y, d z ) I (d x, d y, d z ) No attenuation with distance k c = 1, k l = k q = 0 I L = I
Directional Light Source Models point light source at infinity intensity I, (typically a three-channel value) direction Ԧd = (d x, d y, d z ) I (d x, d y, d z ) No attenuation with distance k c = 1, k l = k q = 0 I L = I The light hitting a surface point q comes in from direction Ԧd.
Spot Light Source Models point light source with direction intensity I, (typically a three-channel value) position p = (p x, p y, p z ), attenuation (k c, k l, k q ) direction Ԧd = (d x, d y, d z ) cut-off and drop-off (γ, α) (p x, p y, p z ) Ԧd Ԧv γ δ How can we modify the intensity of a point light to decrease as g increases? Light I L = I k c + k l δ + k q δ 2
Spot Light Source Models point light source with direction intensity I, position p = (p x, p y, p z ), attenuation (k c, k l, k q ) direction Ԧd = (d x, d y, d z ) cut-off and drop-off (γ, α) (p x, p y, p z ) Ԧd Ԧv γ δ The light hitting a surface point q comes in from direction q p. Light I Ԧd, Ԧv α I L = k c + k l δ + k q δ 2 if Ԧd, Ԧv > cos γ 0 otherwise
Overview Direct Illumination Emission at light sources Direct light at surface points Global illumination Shadows Transmissions Inter-object reflections
Modeling Surface Reflectance R S (θ, φ, λ, γ, ψ) describes the fraction of incident energy (R), at the surface (S), arriving from direction (θ, φ), with wavelength (λ), leaving in direction γ, ψ, (γ, ψ) Surface λ (θ, φ)
Empirical Models Ideally measure radiant energy for all combinations of incident angles Too much storage Difficult in practice λ (θ, φ) (γ, ψ) Surface
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Based on model proposed by Phong Surface
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Based on Phong model proposed illumination by model Phong Surface
Diffuse Reflection Assume surface reflects equally in all directions Examples: chalk, clay Surface
Diffuse Reflection How much light is reflected? Depends on angle of incident light aka Lambertian θ Surface
Diffuse Reflection How much light is reflected? Depends on angle of incident light dl = da cos θ θ dl da Surface
Diffuse Reflection Lambertian model cosine law: cos θ = N, L K D is surface property I L is incoming light N θ L Surface I D = K D N, L I L
Diffuse Reflection Note that lights and surface properties have R,G, and B components! So amount of red light reflected is not necessarily equal to amount of green light, etc. You will need to run calculation below on EACH color channel This holds true for all lighting calculations I D Red = K D Red N, L I L Red
Diffuse Reflection Assume surface reflects equally in all directions Examples: chalk, clay
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Surface
Specular Reflection Reflection is strongest near mirror angle Examples: metals, shiny apples Specular
Specular Reflection How much light is seen? Depends on how well the: reflected direction, and direction to the viewer line up. Viewer V R α θ N θ L
Specular Reflection Phong Model cos n α This is a physically-motivated hack! Viewer R α θ N θ L V I S = K S V, R n I L
Specular Reflection Reflection is strongest near mirror angle Examples: metals, shiny apples
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Surface
Emission Represents light emanating directly from a surface that cannot be described by the three light sources Emission 0
Emission I E = I E Emission 0
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Surface
Ambient Term Represents reflection of all indirect illumination This is a total hack (avoids complexity of global illumination)!
Ambient Term Represents reflection of all indirect illumination I A = K A I L A
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Light position dependent Light + viewer position dependent Surface
Simple Reflectance Model Simple analytic model: diffuse reflection + specular reflection + emission + ambient Light position dependent Light + viewer position dependent Surface
Surface Illumination Calculation Single light source: Viewer R α θ N θ L V I = I E + K A I L A + K D N, L I L + K S V, R n I L
Surface Illumination Calculation Multiple light source: L 2 Viewer N L 1 V I = I E + L K A I L A + K D N, L I L + K S V, R n I L