Illumination Models & Shading

7,386 views 37 slides May 01, 2020
Slide 1
Slide 1 of 37
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37

About This Presentation

An illumination model, also called a lighting model and sometimes referred to as a shading model, is used to calculate the intensity of light that we should see at a given point on the surface of an object.


Slide Content

ILLUMINATION MODELS & SHADING Prof. Bailappa Bhovi Department of Computer Engineering International Institute of Information Technology, I²IT www.isquareit.edu.in

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

Ligh t Sourc e 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 b a c

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 I amb of any point on the surface is: I a - ambient light intensity K a  [0,1] - surface ambient reflectivity In principle I a and K a are functions of color, so we have I R amb , I G amb and I B amb I amb = K a I a

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 point is proportional to cos(  )  N L

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  N L

Diffuse Reflection The reflected intensity I diff of a point on the surface is: I diff = K d I p cos(  ) = K d I p (N  L) I p - the point light intensity. May appear as attenuated source f att (r)I P K d  [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 = I diff + I amb = K d I p N  L + K a I a Note this is the model for one color and it should be replicated for each channel: I R , I G and I B

Diffuse Reflection Example: 0.3 0.6 0.3 0.5 0.7 K a K d

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   L N   R L  R V Ideal specular surface Non-ideal specular surface

Specular Reflection The Phong Model : reflected specular intensity falls off as some power of cos (  ): I spec = K s I p cos n (  ) = K s I p (R  V) n   K s - the surface specular reflectivity n – specular reflection parameter, determining the deviation from ideal specular surface (for a perfect mirror n=  ) N L  R V Specular surface

Specular Reflection The Phong Model: plots of cos n (  ) for three values of the specular parameter n -2 - 1 . 5 -1 - . 5 . 5 1 1 . 5 2 . 2 . 4 . 6 . 8 1 n=1 n=8 n=64   N L  R V Specular surface

Specular Reflection The illumination equation combined with diffuse reflection is: I = I amb +I diff +I spec = K a I a + I p (K d N  L + K s (R  V) n ) If k light sources are present in the scene: diff spec I= I amb +  k (I k + I k )

Specular Reflection Example: 0.2 .5 0.8 0.3 0.7 K d K s

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 : Determine the normal at each polygon vertex Apply an illumination model to each vertex to calculate the vertex intensity Linearly interpolate the vertex intensities over the surface polygon

Gouraud Shading The normal N v of a vertex is an average of all neighboring normals:  k k k  k V N N N 

Gouraud Shading 2 2 1 4 1 1 2 1 2 4 4 I y  y I  y  y I  2 2 3 5 3 3 2 3 2 5 5 I y  y y  y I  y  y y  y I  5 4 5 4 p 4 4 5 p 5 p I x  x y  y x  x I  x  x y  y x  x I  I 1 I I 4 5 scan line I 2 x Interpolation of the vertex intensities y I 3 I P

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 : Determine the normal at each polygon vertex Linearly interpolate the vertex normals over the surface polygon 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

Thank-You International Institute of Information Technology (I²IT) P-14, Rajiv Gandhi Infotech Park, MIDC Phase – 1, Hinjawadi , Pune – 411057, India http://www.isquareit.edu.in/ [email protected]