Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:

Similar presentations


Presentation on theme: "Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:"— Presentation transcript:

1 Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.: Interactive Computer Graphics – A Top Down Approach with OpenGL, Addison Wesley, 2001

2 Fundamentals of Computer Graphics2 Shading – Light and Matter Our perception depends on: –light directly – intensity, spectrum (color), position –material of objects that “reflects” or “transmit” light, roughness, color of the surface Speed of computation – significant factor

3 Fundamentals of Computer Graphics3 Shading – Light and Matter Generally we do not need to compute all, but just those rays that contribute to the final image Methods: Global – ray tracing, radiosity – very slow Local – constant, Gouraud, Phong etc. – relatively fast

4 Fundamentals of Computer Graphics4 Shading – Light and Matter Interaction between light and materials can be classified as specular surfaces – ideal mirror diffuse surfaces – reflected light is ideally reflected to all directions uniformly translucent surfaces – allow some lights to penetrate the surface – refraction – glass, watter optical properties – Snell’s law

5 Fundamentals of Computer Graphics5 Shading – Light sources Light source – an object with a surface Each point (x,y,z) on the surface can emit light with characterization: direction of emission ( ,  ) intensity of energy emitted at each wavelength illumination function I(x,y,z, , , ) Basic light sources (sufficient for rendering the most simple scenes): ambient lighting point sources spotlights distance light

6 Fundamentals of Computer Graphics6 Shading – Light sources Light - an object with a surface Each point (x,y,z) on the surface can emit light with characterization: direction of emission ( ,  ) intensity of energy emitted at each wavelength illumination function I(x,y,z, , , ) Usually I = [ I r, I g, I b ] T is handled as a scalar value Basic light sources - sufficient for rendering the most simple scenes: ambient lighting point sources spotlights distance light

7 Fundamentals of Computer Graphics7 Shading – Light sources Ambient light I a - uniform light in the space (room etc.) Ideal point source – emits equally in all directions I(p 0 ) Light received at a point p full shadow – umbra partial shadow – penumbra for non-point sources (d is distance)

8 Fundamentals of Computer Graphics8 Shading – Light sources Spotlights – very narrow angles of emission, if  = 180° -> point source distribution of light within the cone – usually cos e (  ) ; e determines how rapidly intensity drops off cos(  ) = s T l s – vector that points from p s to a point s on a surface l – vector of the light direction

9 Fundamentals of Computer Graphics9 Shading – Distant light sources we replace location of light sources with their directions p 0 = [ x, y, z, 0 ] T ( 0 is correct !) Phong Reflection Model I = I a + I d + I s disadvantages linear model superposition

10 Fundamentals of Computer Graphics10 Ambient, Diffuse, Specular Reflections Ambient reflection 0  k a  1 I a = k a L a global ambient term or light Diffuse reflection characterized by rough surfaces perfectly diffuse surfaces – Lambertian surfaces

11 Fundamentals of Computer Graphics11 Ambient, Diffuse, Specular Reflections Lambert’s law: diffuse reflection 0  k d  1 if the influence of the distance is considered

12 Fundamentals of Computer Graphics12 Ambient, Diffuse, Specular Reflections Specular Reflection: 0  k s  1 as  ideal specular reflection   metallic surfaces

13 Fundamentals of Computer Graphics13 Polygonal Shading How to display surfaces with shading? Flat (constant) shading glShadeModel(GL_FLAT); Mach bands

14 Fundamentals of Computer Graphics14 Polygonal Shading Interpolative and Gouraud shading Gouraud shading glShadeModel(GL_SMOOTH); normal in a vertex average normal vector intensity computation for a vertex intensity & color interpolation for a scan-line

15 Fundamentals of Computer Graphics15 Polygonal Shading Phong shading normal in a vertex interpolation of a normal normal interpolation along the scan-line intensity computation Phong shading is almost always done off-line

16 Fundamentals of Computer Graphics16 Light Sources in OpenGL Study 6.6 – 6.9 on your own

17 Fundamentals of Computer Graphics17 Global Rendering – Ray tracing global versus local lightings models

18 Fundamentals of Computer Graphics18 Global Rendering – Ray tracing Algorithm complexity: O(M 2 N 2 k ) M – resolution of a screen N – number of objects k – number of levels of the tree Typical program: POV Ray – available free


Download ppt "Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:"

Similar presentations


Ads by Google