410 likes | 607 Views
Reflection Model. 고려대학교 컴퓨터 그래픽스 연구실. Content. Shading Light sources Point, distant, and spot lights Phong reflection model Diffuse reflection Specular reflection Ambient reflection Computation of vectors Normal vectors, angle of reflection, and transmitted light. Shading.
E N D
Reflection Model 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr
Content • Shading • Light sources • Point, distant, and spot lights • Phong reflection model • Diffuse reflection • Specular reflection • Ambient reflection • Computation of vectors • Normal vectors, angle of reflection, and transmitted light kucg.korea.ac.kr
Shading • Determine a color for each filled pixel • How to choose a color • the color of the light source and of the surfaces determines the color of one or more pixels in the frame buffer kucg.korea.ac.kr
Light and Matter • Color is determined by multiple interactions among light sources and reflective surfaces • recursive reflection of light between surfaces accounts for subtle shading Rendering Equation kucg.korea.ac.kr
Light-Material Interactions • Specular surfaces – mirror • scatter reflected light in a narrow range of angle • Diffuse surfaces – chalk, clay • scatter reflected light all directions • Translucent surfaces – glass, water • refraction specular surface diffuse surface translucent surface kucg.korea.ac.kr
Light Sources • Illumination function I (x, y, z, θ, φ, λ) • each point (x, y, z) on the surface • direction of emission (θ, φ) • wavelength λ light source kucg.korea.ac.kr
Modeling Light Sources • Simple mathematical models: • ambient light • point light • distant light • spot light kucg.korea.ac.kr
Color Sources • Three-color theory • human perceive three primary colors – red, green, and blue • three-component intensity or luminance function • independent calculations kucg.korea.ac.kr
Ambient Light • Uniform lighting • identical at every point in the scene kucg.korea.ac.kr
Point Sources (1/2) • Emit light equally in all directions • p0: point source location • proportional to the inverse square distance point source illuminating a surface kucg.korea.ac.kr
Point Sources (2/2) • Large finite size of most light sources • umbra: full shadow • penumbra: partial shadow • Attenuation shadows created by finite-size light source kucg.korea.ac.kr
Spotlights • Characterized by a narrow range of angle through which light is emitted • ps: apex of a cone • ls: direction of pointing • θ: angle to determine width • Distribution of light • concentrate in the center • light intensity drop off spotlight attenuation exponent kucg.korea.ac.kr
Distant Light Sources • far from the surface vector does not change • location direction parallel light source kucg.korea.ac.kr
Phong Reflection Model (1/5) • Efficient and close enough approximation to physical reality to produce good renderings • Use 4 vectors • n: normal at p • v: direction from p to the viewer or COP • l: direction from light source • r: direction of reflectance • 3 types of material-light interactions • ambient, diffuse, and specular vectors used by the Phong model kucg.korea.ac.kr
Phong Reflection Model (2/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” Based on model proposed by Phong kucg.korea.ac.kr
Phong Reflection Model (2/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” Based on model proposed by Phong kucg.korea.ac.kr
Diffuse Reflection (1/3) • Assume surface reflects equally in all directions • Examples: chalk, clay kucg.korea.ac.kr
Diffuse Reflection (2/3) • How much light is reflected? • Depends on angle of incident light • dL = dAcos Q kucg.korea.ac.kr
Diffuse Reflection (3/3) • Lambertian model • Cosine law (dot product) kucg.korea.ac.kr
Phong Reflection Model (2/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” Based on model proposed by Phong kucg.korea.ac.kr
Specular Reflection (1/3) • Reflection is strongest near mirror angle • Examples: mirrors, metals kucg.korea.ac.kr
Specular Reflection (2/3) • How much light is seen? • Depends on angle of incident light and angle to viewer kucg.korea.ac.kr
Specular Reflection (3/3) • Phong model • {cos(a)}n kucg.korea.ac.kr
Phong Reflection Model (2/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” Based on model proposed by Phong kucg.korea.ac.kr
Emission • Represents light emitting directly from polygon Emission ≠ 0 kucg.korea.ac.kr
Phong Reflection Model (2/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” Based on model proposed by Phong kucg.korea.ac.kr
Ambient Term • Represents reflection of all indirect illumination This is a total hack (avoids complexity of global illumination)! kucg.korea.ac.kr
Phong Reflection Model (3/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” kucg.korea.ac.kr
Phong Reflection Model (4/5) • Simple analytic model: • Diffuse reflection + • Specular reflection + • Emission + • “Ambient” kucg.korea.ac.kr
Phong Reflection Model (5/5) • Sum diffuse, specular, emission, and ambient kucg.korea.ac.kr
Surface Illumination Calculation (1/2) • Single light source: kucg.korea.ac.kr
Surface Illumination Calculation (2/2) • Multiple light sources: kucg.korea.ac.kr
Computation of Reflection • Light source and reflection term • Ex. red intensity • Total Intensity kucg.korea.ac.kr
Ambient Reflection • Same at every point on the surface • Ambient reflection coefficient • amount reflected • some of light source is absorbed and some is reflected • three ambient coefficients – , , and • Ambient reflection term • can be any of the individual light sources • can be a global ambient term kucg.korea.ac.kr
Diffuse Reflection (1/2) • Characterized by rough surfaces • perfectly diffuse surface so rough that there is no preferred angle of reflection • Lambert’s law • only the vertical component of light source rough surface at noon in the afternoon Lambert’s law kucg.korea.ac.kr
Diffuse Reflection (2/2) • Lambert’s law (cont’) • Diffuse reflection term • incorporate a distance term Lambert’s law kucg.korea.ac.kr
Specular Reflection • Specular surface is smooth • highlight in the direction of the viewer • Specular reflection term • shininess coefficient • α infinite : mirror • 100 < α < 500 : metal • α < 100 : broad highlight specular surface specular highlights effect of shininess coefficient kucg.korea.ac.kr
Illumination Equation • Including the distance term kucg.korea.ac.kr
Utah Teapots with Different Material Properties kucg.korea.ac.kr
p1 p0 p2 Computation of Vectors (1/2) • Normal vectors • in OpenGL • Angle of reflection n glNormal3f(nx, ny, nz); glNormal3fv(pointer_to_normal); coplanar condition ① ② by ① and ② mirror kucg.korea.ac.kr
Computation of Vectors (2/2) • Halfway vector • half-angle: 2ψ=φ • Transmitted light • Snell’s law halfway vector perfect light transmission kucg.korea.ac.kr