illumination and shading light source models
play

Illumination and Shading Light Source Models In order to produce - PDF document

Illumination and Shading Light Source Models In order to produce realistic images, we must General (real life) light sources often have simulate the appearance of surfaces under various complex geometry and emission characteristics.


  1. Illumination and Shading Light Source Models � In order to produce realistic images, we must � General (real life) light sources often have simulate the appearance of surfaces under various complex geometry and emission characteristics. lighting conditions. � In computer graphics, the following simplified models are commonly used: � Illumination models : given the illumination incident � Directional light source: all light rays are parallel to a particular direction. at a point on a surface, what is reflected? � Point light source: all light rays originate at a particular � Shading algorithms : determine when and how to point in the scene, in all directions. apply the illumination model, in order to provide a color for every visible surface point. � Spotlight: like a point like source, but ray directions are limited to a cone. 1 2 The BRDF Diffuse Reflection � Bidirectional Reflection Distribution Function - describes � Diffuse (Lambertian) surfaces appear equally the ratio of light intensity leaving a point in some outgoing bright from all directions. direction to the differential irradiance from some incoming direction: N L θ � The intensity of light reflected by a point x on a diffuse reflector is ( ) = θ = ⋅ I I k cos I k N L r p d p d 3 4 The Ambient Term Examples: Lambertian model � In the real world, objects receive light both from � Diffuse term only: light sources and from other surfaces in the scene. � This indirect illumination is very coarsely modeled by adding an ambient term into the shading model: ( ) � Diffuse + Ambient: = + ⋅ I I k I k N L r a a p d 5 6

  2. Light-source attenuation Specular Reflection � The irradiance due to physical light source falls � Phong Bui-Tuong introduced a term for simulating off proportionally to the square of the distance. specular highlights on non-ideal (glossy) reflectors: � This is accounted for by introducing a light-source N attenuation factor into the shading equation: R L θ θ ( ) = + ⋅ I I k f I k N L V r a a att p d � Typically,   1 [ ]   f = min , 1 ( ) ( )   = + ⋅ + ⋅ n I I k f I k N L k R V att + + 2  a bd cd  r a a att p d s L L 7 8 The Specular Exponent Example: Phong model � The Phong exponent n determines how concentrated the specular peak is: 9 10 The Reflected Vector Multiple light sources � The Phong model makes use of the reflected � The shading model easily extends to the case of vector R, which is computed as follows: multiple light sources: ( ) = 2 ⋅ − R N N L L [ ] � ∑ ( ) ( ) = + ⋅ + ⋅ n I I k f I k N L k R V r a a att p d i s i i i N = i 1 = = + + R R L L 2 2 S S S S ( ( ) ) + = ⋅ L L + S S = N N ⋅ L L N N ( ( ) ) = ⋅ − S S = N N ⋅ L L N N − L L L R ( ( ) ) = + = ⋅ − R = L + 2 S = 2 N ⋅ L N − L R L 2 S 2 N L N L 11 12

  3. Gouraud shading Polygon Shading � Flat (constant) shading � Smooth surfaces are commonly represented as a collection of polygonal facets for the purposes of interactive display. � Evaluate the shading model once per polygon, use � If each facet is shaded individually, it is easy to see the resulting color for all of its pixels. shading discontinuities, which result in faceted appearance � Gouraud shading � Evaluate the shading model at each vertex, and linearly interpolate resulting values inside the polygon � Phong shading � Evaluate the normal at each vertex, and linearly interpolate it inside the polygon. Having the interpolated normal at each point inside the polygon, we can use it to calculate the shading model in each point. 13 14 Gouraud shading Gouraud shading Calculate normals on each vertex of the polygon � To eliminate faceted appearance we can use Gouraud shading (linearly interpolated shading). For the resulting shading to be continuous we need each vertex in the polygon mesh to have the same normal for all faces incident on it. 15 16 Gouraud shading Gouraud shading Caculate shading model on each vertex and Interpolate shading model along the scanlines interpolate it along the edges. 17 18

  4. Gouraud shading Phong Shading Result, smooth shading with slow (linear) specular effect � Better results can be obtained by linearly interpolating the normals between the vertices, and recomputing the shading at every pixel: Gouraud shading Phong shading 19 20 Phong Shading Phong Shading Evaluate the normals at each vertex Interpolate normals on the polygon’s edges 21 22 Phong Shading Phong Shading Interpolate normals on each pixel on the scanline Calculate shading model on each pixel of the scanline 23 24

  5. Phong Shading Result, shows specular highlight clearly. 25 26 Comparisons Comparisons Specular highlight completely missing since it Specular highlights are different, linear and exponential didn’t occur close enough to any of the vertices 27 28 Comparisons Normals estimation, should not be based only on the polygon’s plane. Neighboring polygons should be taken in to account. 29

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend