1 / 18

Unit-7 Lighting and Shading

Course code: 10CS65 | Computer Graphics and Visualization. Unit-7 Lighting and Shading. Engineered for Tomorrow. Prepared by : Asst. Prof. Sandhya Kumari Department: Computer Science and Engineering. Date : dd.mm.yyyy. Our perception depends on:

kristyng
Download Presentation

Unit-7 Lighting and Shading

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Course code: 10CS65 | Computer Graphics and Visualization Unit-7 Lighting and Shading Engineered for Tomorrow Prepared by : Asst. Prof. Sandhya Kumari Department: Computer Science and Engineering Date : dd.mm.yyyy

  2. 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 Shading – Light and Matter

  3. 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 Shading – Light and Matter

  4. Interaction between light and materialscan 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, water optical properties – Snell’s law Shading – Light and Matter

  5. 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 Shading – Light sources

  6. 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 = [ Ir , Ig , Ib ]T is handled as a scalar value Basic light sources - sufficient for rendering the most simple scenes: ambient lighting point sources spotlights distance light Shading – Light sources

  7. Ambient light Ia- uniform light in the space (room etc.) Ideal point source – emits equally in all directions I(p0) Light received at a point p full shadow –umbrapartial shadow – penumbra for non-point sources (d is distance) Shading – Light sources

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

  9. we replace location of light sources with their directions p0 = [ x , y , z , 0 ]T ( 0 is correct !) Phong Reflection Model I = Ia + Id + Is disadvantages linear model superposition Shading – Distant light sources

  10. Ambient reflection 0  ka  1 Ia = ka La global ambient term or light Diffuse reflection characterized by rough surfaces perfectly diffuse surfaces – Lambertian surfaces Ambient, Diffuse, Specular Reflections

  11. Lambert’s law: diffuse reflection 0  kd  1 if the influence of the distance is considered Ambient, Diffuse, Specular Reflections

  12. Specular Reflection: 0  ks  1 as  ideal specular reflection   <100 , 500> metallic surfaces Ambient, Diffuse, Specular Reflections

  13. How to display surfaces with shading? Flat (constant) shading glShadeModel(GL_FLAT); Mach bands Polygonal Shading

  14. 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 Polygonal Shading

  15. 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 Polygonal Shading

  16. Light Source in OpenGL • OpenGL supports the four types of light sources -point, spotlight, ambient, and distant • OpenGL functions • glLightfv(GLenum source, GLenum parameter, GLfloat *pointer_to_array) • glLihjtf(GLenum source, GLenum parameter, GLfloat value) • Four vector parameters can set: the position (or direction) of light source and the amount of ambient, diffuse, and specular light associated with the source

  17. global versus local lightings models Global Rendering – Ray tracing

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

More Related