This chapter presents the following content: Calculating the color of objects, Illumination, ambient lighting, diffuse lighting, specular lighting, specular light, combined lighting models, types of shading, surface normals,. | Lighting 1 An Interactive Introduction to OpenGL Programming 1 Calculating the color of objects The incident light Position of light source Direction Color The object Reflectance Viewer Position 2 An Interactive Introduction to OpenGL Programming 2 Overview Illumination: how to calculate the colour? Shading: how to colour the whole surface? 3 An Interactive Introduction to OpenGL Programming 3 Illumination Simple 3 parameter model The sum of 3 illumination terms: Ambient : 'background' illumination Specular : bright, shiny reflections Diffuse : non-shiny illumination and shadows 4 + + = Ambient (colour) Diffuse (directional) Specular (highlights) Rc An Interactive Introduction to OpenGL Programming 4 Ambient Lighting Light from the environment Light reflected or scattered from other objects Coming uniformly from all directions and then reflected equally to all directions Ex: Backlighting in a room has a large ambient component, since most of the light that bounced off many . | Lighting 1 An Interactive Introduction to OpenGL Programming 1 Calculating the color of objects The incident light Position of light source Direction Color The object Reflectance Viewer Position 2 An Interactive Introduction to OpenGL Programming 2 Overview Illumination: how to calculate the colour? Shading: how to colour the whole surface? 3 An Interactive Introduction to OpenGL Programming 3 Illumination Simple 3 parameter model The sum of 3 illumination terms: Ambient : 'background' illumination Specular : bright, shiny reflections Diffuse : non-shiny illumination and shadows 4 + + = Ambient (colour) Diffuse (directional) Specular (highlights) Rc An Interactive Introduction to OpenGL Programming 4 Ambient Lighting Light from the environment Light reflected or scattered from other objects Coming uniformly from all directions and then reflected equally to all directions Ex: Backlighting in a room has a large ambient component, since most of the light that bounced off many surfaces Result: globally uniform colour for object 5 I = kaIa I = resulting intensity Ia = light intensity ka = reflectance Example: sphere Object An Interactive Introduction to OpenGL Programming 5 Diffuse Lighting Light reflected to all directions the light that comes from one direction considers the angle of incidence of light on surface scattered equally in all directions, no matter where the eye is located Result: lighting varies over surface with orientation to light 6 Object Infinite point light source N Ln V No dependence on camera angle! Example: sphere (lit from left) I = Ip kd cos Ip : Light Intensity : the angle between the normal vector and direction toward the light kd : diffuse reflectivity An Interactive Introduction to OpenGL Programming 6 Specular Lighting Direct reflections of light source off shiny object specular intensity n = shiny reflectance of object Result: specular highlight on object 7 I = Ip ks cosn Ip: light intensity I : output color R : reflection .