
Illumination Models and Shading Foley & Van Dam, Chapter 16 Illumination Models and Shading • Light Source Models • Ambient Illumination • Diffuse Reflection • Specular Reflection • Polygon Rendering Methods • Flat Shading • Gouraud Shading • Phong Shading Illumination Models • Motivation: In order to produce realistic images, we must simulate the appearance of surfaces under various lighting conditions • Illumination Model: Given the illumination incident at a point on a surface, quantifies the reflected light Illumination Model Parameters • Lighting effects are described with models that consider the interaction of light sources with object surfaces • The factors determining the lighting effects are: – The light source parameters: • Positions • Electromagnetic Spectrum • Shape – The surface parameters •Position • Reflectance properties • Position of nearby surfaces – The eye (camera) parameters •Position • Sensor spectrum sensitivities Illumination Models and Rendering •An illumination model is used to calculate the intensity of the light that is reflected at a given point on a surface •A rendering method uses intensity calculations from the illumination model to determine the light intensity at all pixels in the image Light Source Models • Point Source (a): All light rays originate at a point and radially diverge. A reasonable approximation for sources whose dimensions are small compared to the object size • Parallel source (b): Light rays are all parallel. May be modeled as a point source at infinite distance (the sun) • Distributed source (c): All light rays originate at a finite area in space. It models a nearby source, such as a fluorescent light c b a Illumination Models • Simplified and fast methods for calculating surfaces intensities, mostly empirical • Calculations are based on optical properties of surfaces and the lighting conditions (no reflected sources nor shadows) • Light sources are considered to be point sources • Reasonably good approximation for most scenes Ambient Illumination • Assume there is some non-directional light in the environment (background light) • The amount of ambient light incident on each object is constant for all surfaces and over all directions • Very simple model, not very realistic • OpenGL default Ambient Illumination • The reflected intensity Iamb of any point on the surface is: Iamb = Ka Ia Ia - ambient light intensity Ka ∈ [0,1] - surface ambient reflectivity • In principle Ia and Ka are functions of color, so we R G B have I amb, I amb and I amb Ambient Illumination • Example: Diffuse Reflection • Diffuse (Lambertian) surfaces are rough or grainy, like clay, soil, fabric • The surface appears equally bright from all viewing directions • The brightness at each L N point is proportional to θ cos(θ) Diffuse Reflection • Brightness is proportional to cos(θ) because a surface (a) perpendicular to the light direction is more illuminated than a surface (b) at an oblique angle a b L N θ Diffuse Reflection • The reflected intensity Idiff of a point on the surface is: Idiff = Kd Ipcos(θ) = Kd Ip(N⋅L) Ip - the point light intensity. May appear as attenuated source fatt(r)IP Kd ∈ [0,1] - the surface diffuse reflectivity N - the surface normal L - the light direction NOTE: If N and L have unitary length: cos(θ) = N ⋅ L Diffuse Reflection • Example: Diffuse Reflection • Example: diffuse reflection from different light directions Diffuse Reflection • Commonly, there are two types of light sources: – A background ambient light – A point light source • The equation that combines the two models is: I = Idiff + Iamb = Kd Ip N⋅L+ Ka Ia • Note this is the model for one color and it should be replicated for each channel: IR, IG and IB Diffuse Reflection • Example: 0 0.3 0.6 Kd 0.3 0.5 0.7 Ka Specular Reflection • Models shiny and glossy surfaces (like metal, plastic, etc..) with highlights • Reflectance intensity changes with reflected angle • An ideal specular surface (mirror) reflects light exclusively in one direction: R • Glossy objects are not ideal mirrors and reflect in the immediate vicinity of R N N LR LRφ θθ θθ V Ideal specular surface Non-ideal specular surface Specular Reflection • The Phong Model: reflected specular intensity falls off as some power of cos (φ): n n Ispec = Ks Ipcos (φ) = Ks Ip(R⋅V) Ks - the surface specular reflectivity n – specular reflection parameter, determining the deviation from ideal specular surface (for a perfect mirror n=∞) N LRφ θθ V Specular surface Specular Reflection • The Phong Model: plots of cosn(φ) for three values of the specular parameter n 1 n=1 0.8 n=8 N n=64 0.6 LR θθ φ V 0.4 0.2 Specular surface 0 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 Specular Reflection • The illumination equation combined with diffuse reflection is: I = Iamb+Idiff+Ispec= n Ka Ia + Ip (Kd N⋅L + Ks (R⋅V) ) •If k light sources are present in the scene: k k I= Iamb+Σk (I diff+I spec) Specular Reflection • Example: 0.2 0.5 0.8 Ks 0 0.3 0.7 Kd Specular Reflection • Example: effects of the specular parameter n n=50 n=10 n=3 Specular Reflection • Example: Ambient Illumination Ambient + Diffuse Ambient + Diffuse + Specular Composing Light Sources • Example: Polygon Rendering Methods • A freeform surface can be approximated by polyhedra • Rendering: calculate the illumination at each surface point • Applying the illumination model at each surface point is computationally expensive Flat Shading • A single intensity is calculated for each surface polygon • Fast and simple method • Gives reasonable result only if all of the following assumptions are valid: – The object is a polyhedron – Light source is far away from the surface so that N•L is constant over each polygon – Viewing position is far away from the surface so that V•R is constant over each polygon Gouraud Shading • Renders the polygon surface by linearly interpolating intensity values across the surface Gouraud Shading Algorithm: 1. Determine the normal at each polygon vertex 2. Apply an illumination model to each vertex to calculate the vertex intensity 3. Linearly interpolate the vertex intensities over the surface polygon Gouraud Shading • The normal Nv of a vertex is an average of all neighboring normals: ∑ N k k N V = ∑ N k k Gouraud Shading • Interpolation of the vertex intensities y I3 I I1 P scan line I4 I5 I2 x y 4 − y 2 y 1 − y 4 I 4 = I 1 + I 2 y 1 − y 2 y 1 − y 2 y 5 − y 2 y 3 − y 5 I 5 = I 3 + I 2 y 3 − y 2 y 3 − y 2 x 5 − x p x p − x 4 I p = I 4 + I 5 x 5 − x 4 x 5 − x 4 Gouraud Shading • Example: Gouraud shading of a sphere Phong Shading • A more accurate method for rendering a polygon surface is to interpolate normal vectors, and then apply the illumination model to each surface point Phong Shading Algorithm: 1. Determine the normal at each polygon vertex 2. Linearly interpolate the vertex normals over the surface polygon 3. Apply the illumination model along each scan line to calculate intensity of each surface point Phong Shading • Example: Phong shading of a sphere Polygon Rendering Methods • Example: Flat Gouraud Phong Polygon Rendering Methods • Example: Flat Gouraud Phong Polygon Rendering Methods • Example: Flat Gouraud Phong CCOOMMPPUUTTEERR AANNIIMMAATTIIOONN http://www.tutorialspoint.com/computer_graphics/computer_animation.htm Copyright © tutorialspoint.com Animation means giving life to any object in computer graphics. It has the power of injecting energy and emotions into the most seemingly inanimate objects. Computer-assisted animation and computer-generated animation are two categories of computer animation. It can be presented via film or video. The basic idea behind animation is to play back the recorded images at the rates fast enough to fool the human eye into interpreting them as continuous motion. Animation can make a series of dead images come alive. Animation can be used in many areas like entertainment, computer aided-design, scientific visualization, training, education, e-commerce, and computer art. Animation Techniques Animators have invented and used a variety of different animation techniques. Basically there are six animation technique which we would discuss one by one in this section. Traditional Animation framebyframe Traditionally most of the animation was done by hand. All the frames in an animation had to be drawn by hand. Since each second of animation requires 24 frames film, the amount of efforts required to create even the shortest of movies can be tremendous. Keyframing In this technique, a storyboard is laid out and then the artists draw the major frames of the animation. Major frames are the ones in which prominent changes take place. They are the key points of animation. Keyframing requires that the animator specifies critical or key positions for the objects. The computer then automatically fills in the missing frames by smoothly interpolating between those positions. Procedural In a procedural animation, the objects are animated by a procedure − a set of rules − not by keyframing. The animator specifies rules and initial conditions and runs simulation. Rules are often based on physical rules of the real world expressed by mathematical equations. Behavioral In behavioral animation, an autonomous character determines its own actions, at least to a certain extent. This gives the character some ability to improvise, and frees the animator from the need to specify each detail of every character's motion. Performance Based MotionCapture Another technique is Motion Capture, in which magnetic or vision-based sensors record the actions of a human or animal object in three dimensions. A computer then uses these data to animate the object. This technology has enabled a number of famous athletes to supply the actions for characters in sports video games. Motion capture is pretty popular with the animators mainly because some of the commonplace human actions can be captured with relative ease.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages39 Page
-
File Size-