Lighting Rendering o Rendering o Concerned with determining the most appropriate colour (i.e. RGB tuple) to assign to o Light source a pixel associated with an object in a scene o Reflection models o Shading models o We need to know o how to describe light sources o how light interacts with materials - reflection models o how to calculate the intensity of light that we see at a given point on object surface - shading models A Model for Lighting Illumination Variables o Only light that reaches the viewers o Light source eye is ever seen o Positions o Properties o Direct light is seen as the colour of the light source o Object o Geometry of the object at that point (normal direction) o Indirect light depends on interaction properties o Material properties o opaque/ transparent, shiny/dull, texture surface o In computer graphics we replace patterns viewer with projection plane o Position and orientation of view plane o Rays which reach COP after passing through viewing plane are actually seen 1
Modelling the Light Source Light sources o Light sources characterized by the illumination function: o Ambient light – uniform lighting θ φ λ I ( x , y , z , , , ) θ o Point source – emits light equally in all ( x, y, z ) : point on light source surface φ directions ( θ , φ ) : direction of emission λ : wavelength o Spotlight – characterized by a narrow range of angles through which light is emitted o Contribution of a light source can be determined by integrating over the surface of the light source o Distance light sources – parallel rays of light o For real-time speeds it is easier if we can approximate with point source (or set of point sources) Reflection Model Reflection Model o A reflection model reflection model (also called lighting lighting or o Ambient - reflected from illumination model) describes the interaction illumination other surfaces between light and a surface o Diffuse - from a point source reflected equally o The nature of interaction is determined by the in all directions material property o Specular - from a point o Three general types of interaction: specular source reflected in a reflection, diffuse reflection, transmission mirror-like fashion specularity 2
The Phong Reflection Model The Phong Reflection Model o The Phong Illumination Model is a local illumination model and is largely an o A local illumination model including only contributions from diffuse and empirical model. However it is fast to compute and gives reasonably realistic specular components suffers from one large drawback, namely, a surface results. that does not have light incident on it will reflect no light and will therefore appear black. o Light incident upon a surface may be reflected from a surface in two ways: o This is not realistic, for example a sphere with a light source above it will have its lower half not illuminated. In practice in a real scene this lower half would o Diffuse reflection : Light incident on the surface is reflected equally in all be partially illuminated by light that had been reflected from other objects. directions and is attenuated by an amount dependent upon the physical This effect is approximated in a local illumination model by adding a term to properties of the surface. Since light is reflected equally in all directions the approximate this general light which is `bouncing' around the scene. This perceived illumination of the surface is not dependent on the position of the term is called the ambient reflection term and is modelled by a constant observer. Diffuse reflection models the light reflecting properties of matt term. Again the amount of ambient light reflected is dependent on the surfaces . properties of the surface. o Specular Reflection : Light is reflected mainly in the direction of the reflected o Hence the local illumination model that is generally used is ray and is attenuated by an amount dependent upon the physical properties of the surface. Since the light reflected from the surface is mainly in the direction of the reflected ray the position of the observer determines the illumination = Ambient + Diffuse + Specular perceived illumination of the surface. Specular reflection models the light reflecting properties of shiny or mirror-like surfaces. Ambient Reflection Ambient Reflection Diffuse Reflection In the Phong model ambient light is assumed to have a constant intensity throughout the scene. A perfectly diffuse reflecting surface scatters light equally in all directions. Each surface, depending on its physical properties, has a coefficient of ambient reflection Thus the intensity at a point on a surface as perceived by the viewer does not which measures what fraction of this light is reflected from the surface. Hence for an individual depend on the position of the viewer. surface the intensity of ambient light reflected is: I = K a L a The colour of the light reflected from the surface depends upon the colour of the light and the properties of the surface. Light incident on the surface will I = Reflected intensity have some components absorbed and others scattered thus giving the surface K a = Reflection coefficient its colour. Thus a surface that appears red under white light absorbs green and I a = Ambient light intensity (same at every point) blue and scatters red light. When only diffuse light is considered surfaces will appear dull or matt. surface P 3
Diffuse Reflection The Effect of Distance light With the lighting model proposed so far two surfaces with the same source light properties and orientation but different distances from the light source N R source would have the same intensity of illumination. This can be corrected by eye L including a factor dependent on the distance of the surface point to the V φ θ viewing point . Hence the lighting model (for a single light source) and modelling only ambient and diffuse reflection is now: surface P The intensity due to diffuse reflection is given by θ K I cos Lambert's cosine law: = + I K I d i a a + r k I d = K d I i cos θ I d = Reflected intensity where r is the distance and k is an arbitrary constant chosen to make the K d = Diffuse reflection coefficient image appear correct. I i = Intensity of the incident light If there is more than one light source then the diffuse intensity is summed over all light sources. Specular Reflection Specular Reflection o Specular reflection is caused by the mirror-like properties o In practice no surface is a perfect mirror and there will be a certain amount of light scattered around the reflected direction. of a surface. A perfect mirror will reflect light arriving at the surface at an angle of incidence theta to the normal light N R at a reflected angle of theta to the normal in the same eye source L plane as the normal and the incident light. This means V φ θ that only a viewer on the reflected ray will actually see the reflected light. surface light N o The reflected light is therefore seen over an area of the surface R source eye as a highlight . The colour of this specularly reflected highlight L is usually taken to be that of the light source. In diffuse θ reflection the reflected light is the colour of the surface. surface o In practice the distribution function for specularly reflected light is a complex function of Phi - the angle between the reflected ray and the viewing direction V . 4
Specular Reflection Specular Reflection N light o In perfect specular reflection, light R o Amount of light light source is reflected along the direction N R visible to viewer source eye symmetric to the incoming light L depends on the angle V φ θ φ between R and V: o In practice, light is reflected within surface a small angle of the perfect P V = Direction to the viewer (COP) reflection direction - the intensity o I s = K s I i (cos φ ) n N R = Direction of perfect reflected light of the reflection tails off at the outside of the cone. This gives a N = Surface normal light R narrow highlight for shiny L = Direction of light source source o n varies with material, surfaces, and a broad highlight I i = Intensity of the incident light large n: shiny, small for dull surfaces K s = Specular reflection coefficient n: dull I s = Reflected intensity P Specular Reflection Specular Highlights o Thus we want to model o The cosine function (defined on the sphere) intensity, I, as a function of gives us a lobe shape which approximates the I angle between viewing distribution of energy about a reflected direction and the reflection, n=1 direction controlled by the shinyness parameter say φ , with a sharper peak for a known as the Phong exponent. shinier surfaces, and broader peak for dull surfaces n=10 n = 5 n = 15 φ o This effect can be modelled by (cos φ ) n , with a sharper (cos φ ) n peak for larger n n = 1005 n = 45 o Empirical 5
Recommend
More recommend