Hello and welcome to lecture number 13 in the course Computer Graphics. So, by now we have covered more than one-third of the course. Before we go into the next topic, let us pause for a moment here and reflect on what we have learned so far. As we may recollect, we were discussing about the process, the process of displaying an image on a computer screen. Now this is a generic concept of course the screen may vary in size.
And it need not be always image. It can be characters also, but broadly what we are concerned about in this course is basically how a screen or a display unit or some output unit generates an image that process is captured in the form of a set of stages which we call 3D graphics pipeline, currently we are discussing the pipeline. Let us have a relook at the stages of the pipeline.
As you can see here there are 5 stages. First stage is object representation. In this stage, we define objects in their own or local coordinate system, then we have second stage that is modeling or geometric transformation. So, in this case the objects that are defined in the local coordinates of that particular object is transformed to a world coordinate scene. So, here a transformation takes place from local coordinate to world coordinate.
Third stage is lighting. In this stage, we assign color to the points on the surface of the objects. We may consider this to take place in the world coordinate system itself. Fourth stage is actually a collection of sub stages. Fourth stage is viewing pipeline which consists of 5 sub stages viewing transformation. So, in this stage there is a transformation that takes place from world coordinate to a new coordinate system called view coordinate.
Then there is one process called clipping which takes place in the view coordinate system, then another process hidden surface removal which takes place in view coordinate system again. After that there is another transformation called projection transformation. In this stage, another coordinate transformation takes place from a 3D view coordinate system to a 2D view coordinate system.
And then we have another transformation window to viewport transformation. Here we transform the 2D view coordinate object to a device coordinate system. Together this 5 sub stages constitute the fourth stage that is viewing pipeline. And finally we have scan conversation which is the fifth stage. Here also some transformation takes place from the device coordinate to a screen coordinate system. So, these are the stages of a 3D graphics pipeline.
Now we have already discussed some of those stages and some of those stages are there which remains to be discussed. What we have discussed?
We have discussed first stage that is object representation and also we have finished our discussion on the second stage that is modeling transformation. Now we are going to start our discussion on the third stage that is lighting or assigning color to the objects rather the surface points of the objects. So, we will start with the basic idea of coloring process when we talk of coloring what we mean and how we can actually implement the idea of coloring in the context of computer graphics.
Now, as I have already mentioned, third stage deals with assigning colors. So, why that is important? Let us again look at the example figures shown on the right hand side of the screen. Here, as you can see on the top figure we have one object which we have assigned color too and there is another object at the bottom where again we have assigned color. Now what is the difference between this top figure and the bottom figure?
See in the top figure we have assigned color, but in this figure we are unable to perceive the depth information. Now this depth information is very important to create an impression of 3D. This problem is not there in the lower figure here. In this case, as you can clearly see, by assigning color in a particular way we manage to create an impression of a 3D object which was not the case in the first image.
Now, how we manage to do that? Here, as you can see in this lower figure, same color has not been applied everywhere. We have applied different colors with different intensity values to give us the perception of depth. Now, when we talk of assigning color, we are actually referring to this particular way of assigning colors so that we get the impression of depth.
Now, this appropriate color assignment can be considered to be the same as illuminating the scene with a light. Why we get to see color? Because, there is light. If there is no light, then everything will be dark and we will not be able to see the color. So, essentially when we talk of assigning color we are actually referring to the fact that the scene is illuminated with a light and based on that light we are getting to see the color.
So, in order to mimic this process of illuminating a scene with a light what we do in computing graphics we typically take help of a model particular type of model called lighting models. Now, in this third stage, we will learn about lighting models in details.
What this lighting models do? A lighting model actually computes the color and output a number, a real number which represents intensity values, intensity of the light.
Now, the way these models are designed so they can only compute colors in terms of some continuous real numbers, but as we all know computers are digital machine so they can only process digital values, discrete values. They cannot deal with continuous numbers. So, we need some method, some way to map this continuous values to streams of 0s and 1s or digitalize those continuous values otherwise the computers will not be able to deal with those values.
Now, this mapping process is also very important in our process of assigning colors to objects in computer graphics and that constitute a crucial part in the third stage where we assign colors. So, we will also discuss this mapping process. So, two things broadly we will discuss, one is computing intensity values based on lighting models and the second thing is mapping the continuous intensity values to a set of discrete steams of 0s and 1s.
Now let us try to understand the basic idea behind the process of illumination.
How we get to see color? Actually it is the outcome of a process, the process of illumination.
The process assumes that there is a source a light source which emits light. Now there maybe one source, there may be more than one sources, but there has to be some source of light which emits light. Now this emitted light falls upon the point, like in this figure as you can see we have one source that is the light bulb and it emits light. The light intensity falls on these two object surfaces.
Now, sometimes this light that comes from the source need not fall directly to the surface point, instead it can get reflected from another point and then fall upon the surface point. Like we have shown here it first falls on this objects and then gets reflected from there and then
finally falls on this point. So, at this point we have two light incident upon this point. One comes from the direct light source that is the direct light other comes not directly from the light source, but after getting reflected from another surface. So, that can be considered as an indirect source of light.
So, at this point we have light coming from a direct source as well as indirect source. Now this transportation of light energy from the source to the point this is our source here direct source and indirect source. Now from the source to the point this transportation of light energy is called illumination. So, this is of course one process of transporting light energy from a source to the point either directly or indirectly.
Now, this incident light at this point gets reflected from the object surface and then falls upon our eyes or the eye of the viewer. Now once we receive that light after getting reflected from the object surface, we can perceive color. So, the intensity of this incident light to the eye is the perceived color or the simply the color of the point. So, to recollect a viewer is looking at this point on here.
Now, at this point there are two incident light. One coming from the direct source through this path, one coming from the indirect source through this path. Now this process of transporting light energy from the source to this point is illumination. So, after getting illuminated the light is actually reflected from this point and reaches to the eye of the viewer through this path. The intensity of this reflected light that reaches the eye actually is the perceived color or simply the color of the point.
So, essentially what we perceive as color is the intensity of the light that is reflected from the point to which we are looking at.
Now, this process of computing the luminous intensity or of the outgoing light at the point is known as lighting and in computer graphics we are interested in simulating this lighting process. So, there are two processes involved as we have just discussed; one is illumination that is from the source the light falls on the point either directly or indirectly that is called illumination.
And from that point the light gets reflected and reaches the eye of the viewer that is the lighting and this intensity of the reflected light actually determines the color at that point. So, we are interested in determining the color at that point. So, we are interested in mimicking the lighting process.
Sometimes another term is used that is called shading; also known as surface rendering. This term refers to the process of assigning colors to pixels minor difference earlier we are talking of assigning color to any surface point now we are talking of assigning colors to pixels.
So, technically both are same, both refer to the process of computing color at a point, but there is a difference particularly in the context of usage of this term in computer graphics. What is the difference?
They represent two different ways of computing colors at a point. So when we are talking of lighting and when we are talking of shading technically both refer to the same thing that is we are talking of computing color of a point. But, in practice, when we use these terms in graphic, we are referring to slightly different concepts and these concepts are related to the way the color value is computed at the points.
In case of lighting, we take into account properties of light source and the surface. So, essentially we are trying to simulate the optical phenomenon. So, when we are talking of color, color of a surface point, it has to take into account the property of the material of the
surface, the properties of the light source and when we are talking into account these properties, then we are talking of lighting.
When we are computing the color value taking into account these properties, we are talking of lighting. So, essentially it refers to computing color taking into account all optical properties that are relevant in color computation or in other words simulation of the optical phenomena.
In order to do that, we use lighting models. But these models, as we shall see later, are complex models involves lot of computations so essentially they are computation intensive.
Now in graphics, in practical applications, as maybe obvious to all of us by now, when we are trying to render a scene, then there are large number of points. So, we need to compute color at a large number of points. Now at every point if we have to apply this lighting model, then since the model itself is very complex and computation intensive, the total time required to compute and assign colors to those points may lead to some delay in appropriate rendering of the pixels.
So, in other words, if we are applying the lighting models to compute color on all the surface points, then we may not get a real time 3D image in a realistic way. So, it is in fact inappropriate to apply the lighting model to compute colors at all the surface points. So, we have a model, we know how the optics take place. We have taken into account the characteristics, the properties of both the surface as well as the source.
But if we want to compute color it is not advisable or appropriate to compute it using lighting model only that will lead to delay in rendering the image.
Now, in order to address these issue, typically an alternative approach is used. What is that approach?
So, instead of computing color at every point by using lighting model what we do is, we map the surface points to pixels and afterward we use the lighting model to compute colors for a selected small number of pixels so not for all pixels only for a selected small number of pixels which are on the surface we apply the lighting model. So, here we are not applying the model for all the pixels that are on the surfaces, instead we are applying it only for a very small subset of those surface pixels.
Subsequently we use those values to interpolate colors of the remaining surface pixels. So suppose we have a surface like this now it is map to say this pixel grid so these are the pixels. So, there are total 16 pixels that constitute the surface among these pixels we may apply the lighting model to compute color of only one pixel and then use it to interpolate color of the remaining pixels. Now this interpolation is not done by applying the lighting model instead interpolation is done by much less computation mostly some iterative process which requires less computation.
So essentially, interpolating colors rather than computing colors with the lighting models saves lot of time. So, for example, in this case earlier if we had to use lighting model we had to use for 16 points. Now, we are using lighting model say for one or two points. And then remaining 14 or 15 points we are coloring using interpolation which is simple iteration of simple computations steps. So, in this process we can save lot of time.
Now, this interpolation based process of pixel coloring is generally referred to as shading in computer graphics. So, we have lighting and we have shading. So, we will distinguish between these two, although technically they are same, but in the context of our discussion of the third stage we will distinguish between the two. Lighting refers to application of a lighting model to compute color and shading refers to application of interpolation to compute color and we will learn about shading models also in the subsequent lectures.
Now, let us try to learn, in brief, some of the background information which we will utilize for our subsequent discussions on lighting model, shading model as well as the mapping from continuous intensity values to discrete intensity values. First thing is the factors that affect color. What affects color? So, there are two broad things. One is properties of the light source and the other one is properties of the surface on which the point lies. So, the surface properties as well as the light source properties determine the color of a point.
Now, surface properties include two types of properties optical properties such as reflectance and refractance. I hope you may be aware of these terms. Reflectance refers to the fact that some portion of light gets reflected some gets absorbed. Refractance refers to the fact that light gets refracted while passing through a surface and the amount of reflection or refraction is determined by some properties reflectance properties and refraction properties.
Apart from these optical properties there are geometric properties or attributes as well, such as position of the object surface with respect to the light source orientation with respect to the light source and so on these also determine the amount of color or the particular color that we perceive. That is about surface properties. What about light source?
So, in graphics we typically consider 3 types of light source. Let us have a look at these 3 types.
First one is point light source. So, here what we are assuming is that such sources emit light equally in all direction from a single point which is dimensionless and how do I characterize this type of light sources? Since there is no dimension we do not need to characterize by their shape or size, instead we simply characterize them by their position and intensity values of the emitted light. So, what is the intensity value of the light that they are emitting as well as their position?
If we are trying to model some light source that are very very far with respect to the point. Typically infinitely distance sources. For example, the sunlight. We can use this concept of point light source to model such light sources. However, in such cases since it is very very very far position makes no sense. So, we characterize such sources only with respect to the intensity of the emitted light. So, only the intensity of the emitted light characterizes the light sources that are infinitely distant from the point.
Then we have directional source or spotlight. So, we used this type of light sources to simulate beam of light effect. In this case what we assume is that it consists of a point light source and that source emits light within an angular limit so within this limit characterized by this angle theta. Now, if a point is within this limit then that point is illuminated, if a point is outside this limit, then it will not be illuminated by this particular light source.
So essentially, spotlight sources can be characterized by three things: the position of the point source, the angular limit characterized by this angle and the emitted light intensity. So, the intensity with which it emits the light. Later on we will see that how this intensity varies from one point to another while we will be discussing the lighting model.
So, then the third type of light is ambient light or light that comes from indirect sources. So, sometimes there maybe objects which are not directly illuminated by a light source, but we are still able to see it. How? Because the light that is getting emitted from the light source gets reflected by other object that surround this particular object of interest and that reflected light from other objects fall upon the object of interest and then comes to our eyes and we get to see that particular object.
Like the example shown here in this figure even if assume that this direct light is not available still we will be able to see this object of this particular point because this light is falling on this object here and then getting reflected and falling on the point of interest and then from there getting reflected and comes to our eye. So, we get to see this point because it gets light from this source, indirect source. Now this is indirect illumination from surrounding surfaces.
And that also is one type of light source which we call ambient light, but if we want to model this ambient light effect that is how much light is getting reflected from surrounding surfaces and falling upon the point of interest, that as you can probably guess, it is going to be quite complex because there may be large number of objects at different positions, orientations with different surface properties.
And if we need to calculate the luminous intensity from each of this surface points that ultimately falls upon that point of interest and that is going to take quite a lot of computations and is likely to time consuming. So, typically in graphics to avoid such complex computations we assume some simplified model of ambient light that also we will see in our discussion on the lighting model.
And such simplified model is called ambient light source. So, we assume that there is an ambient light source which effects every surface point uniformly which of course in practice is not the case, but we assume that and we will see that assumption leads to realistic images in most of the cases without too much additional computations.
So, to summarize, when we are talking of computing color, we need to take into account two things, one is surface properties both optical properties as well as geometric properties and one is the light source and we just discussed 3 types of light sources. One is point light source characterized by position and intensity of the emitted light, but if we are considering a point light source at a very, very distant location, then position is not important only emitted light intensity characterizes such sources.
Then we have spotlight characterized by the point light source position the extent of angular spread of the light and the intensity of the emitted light and third type is ambient light source where we are assuming that there is a simplified model of ambient light effect and this model is encapsulated in the form of a single light source which affects all the object in a scene uniformly.
We will learn more about this sources during our discussion on the lighting model we will get to see how these sources and the surface properties are going to affect the computations in a lighting model.
One more thing about this ambient light is that the simplified model that we assume is that we are assuming that such light sources do not have any spatial or directional characteristics. As a result they are assumed to illuminate all surfaces equally and characterized by only one thing that is ambient light intensity. These are crucial considerations to be able to model the lighting process without imposing too much computational overhead on the system.
So, with this background knowledge, we would be discussing the idea of a lighting model in terms of a simple lighting model that we will do in the next lecture. You may like to note the term ‘simply’ although we will see in practice that it is still complex, but that is the simplest
of all possible lighting models that are there and used in graphics. And we will also discuss the computations involved and how to how to reduce the computations by making some simplifying assumptions. That lighting model we will discuss in the next lecture.
Whatever I have discussed today can be found in this book chapter 4 section 4.1. You may go through this section to learn in more details about the topics that I just discussed in today’s lecture. See you in the next lecture. Till then good bye and thank you.
Log in to save your progress and obtain a certificate in Alison’s free Advanced Diploma in Computer Graphics online course
Sign up to save your progress and obtain a certificate in Alison’s free Advanced Diploma in Computer Graphics online course
Please enter you email address and we will mail you a link to reset your password.