0% found this document useful (0 votes)
4 views18 pages

lec21-RENDERING

The lecture discusses rendering techniques in computer graphics, focusing on enhancing realism through light interaction with objects. It covers various types of light reflection, including ambient, diffuse, and specular reflections, and introduces the Phong illumination model for calculating light intensity. The importance of material properties and viewer perspective in rendering realistic images is emphasized, along with computational considerations for multiple light sources.

Uploaded by

Xavier Ilango
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

lec21-RENDERING

The lecture discusses rendering techniques in computer graphics, focusing on enhancing realism through light interaction with objects. It covers various types of light reflection, including ambient, diffuse, and specular reflections, and introduces the Phong illumination model for calculating light intensity. The importance of material properties and viewer perspective in rendering realistic images is emphasized, along with computational considerations for multiple light sources.

Uploaded by

Xavier Ilango
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Computer Graphics

Dr. Prem Kalra


Department of Computer Science and Engineering
Indian Institute of Technology, Delhi
Lecture - 21
Rendering

(Refer Slide Time: 00:00:57)

Today we are going to talk about some rendering issues. So far we have looked at the
possibility of the rendering objects more like a line drawing or piecewise line drawing.
So, in order to be able to have realism in the rendering or the display of the objects of the
scene we construct it is important that we try to incorporate the issues which will enhance
the realism or the realistic display. So if you look at the kind of possible rendering one
may have or what we seen earlier is a sort of a wireframe rendering where we see the
display of a cube as a collection of drawing lines.

This is a very simple way of displaying or drawing the objects and we have noticed that it
may lead to an ambiguity in understanding what that object is about. If we just try to fill
the various primitives or polygons which constitute the object, if you have a cuboid kind
of a structure here and if try to just try to fill these polygons are the faces of the cube with
just a color so as a consequence I may get just a flat color rendering of the object which
does not give me any information about the three dimensionality of the object. But I am
not able to appreciate the 3D aspects of the object it is just a blob of color. So in order to
enhance that what we need to do is we need to look at the issues which relate to the
interaction of the light source.
(Refer Slide Time: 00:03:27)

Let us say if I assume some light which is illuminating the object as what happens in
reality. So how does an object or the surface which I want to render interacts with that
light source or if more than one light source is there then that is what it results into having
different shades or color in different point in the object which gives you the 3D notion or
the display of the object. So we are going to look at some possible models which are
helpful for deciding the illumination of an object. The ideas are borrowed from physics
and they are simple so that you can compute them quite fast.

When we are talking about the interaction of the light or light sources with respect to the
objects or the scene then from the physics what we have studied we observe that the light
when reaches on a surface it gets absorbed, it gets reflected or it may get transmitted. So
there are various phenomena but these are the major things which happen to the light.
(Refer Slide Time: 00:05:58)

For the time being let us ignore the transmitted part. So what we see is that the amount
which is reflected actually determines the color or the brightness of the intensity on the
object. So anyway what we are dealing here with is the light material so now there is also
a notion of the material properties of the object. So there is geometrical representation of
the object and you also need to incorporate some material properties. And the interaction
of that we would in turn give you the information about the total amount of reflection on
the surface which will give you the color or the intensity you want to determine.

(Refer Slide Time: 00:07:06)


So while looking at various components for deciding illumination on a point of surface
what we observe looking at the reflection of the light on a surface is that there are various
components in which we can look at the reflection of light. There is an ambient light
which comes from all directions and it is scattered in all directions so there is a sort of a
glow in the environment which is basically contributed from various distributed sources
of light. Even in the day time you switch of the light or whatever sources of light you
have in the room you still have some illumination or glow in the environment. That is
what we refer to as the ambient.

There is also a diffused light which comes from one direction and is scattered in all
directions. And there is also a specular light which come from one direction and is
scattered in some preferred direction. We are going to look at these components and look
at the computational aspects of these components and then define an illumination model.

Diffused reflection is something like the light coming from one direction. This l is the
light vector, n is the normal vector at a point on the surface and the angle between the
light vector and normal vector is theta.

(Refer Slide Time: 00:10:23)

So, observing Lambert’s law which says that the reflected light is proportional to the
cosine on the angle between the light vector and normal vector basically means that I can
define the diffuse reflection the component given the incident light i l and I define the
coefficient called diffuse reflection coefficient which is actually based on the properties
of the material of the surface I am going to render. So typically if I am looking at
rendering in a single color mode that means in gray levels one in density value then this
Kd would vary between 0 and 1. So 0 means very low in intensity so the color of the
inherent object is towards black and as I go to 1 then I have the color as more towards
white.
Similarly, if I am talking in terms of a color object this could define the color of the
object of which I am interested in displaying. So this could have components like rgb. So
if I say 1 0 0 that is a vector rgb which would mean that the object which I am interested
in is red. So this Kd captures the material property or the color properties of the surface.
Now this cos theta is nothing but l dot n. Considering the unit vectors cos theta is just the
dot product.

So using Lambert’s law I can basically model the diffuse reflection which says that there
is a light incident on the surface and there is a uniform sort of a distributed scattering of
the light determined by this. Here is an example, these are the light rays I am getting the
incident light rays then the outgoing light rays are going to be this blue. They are all
uniform at this point. Here we observe that basically the interaction of the light source
with the surface or the object gets determined by the angle between the light vector and
normal vector. That is the governing parameter which decides everything plus the color
properties of the object defined by Kd.

(Refer Slide Time: 00:14:53)

So here is an example. If you have the light incident on the point of a surface coincident
with the normal vector then you will have something like this. On a sphere you will
observe the distribution of the intensity of the sphere as something like this. So at this
point this is uniformly distributed. The moment I change the angle, that is if I make the
light vector slightly away from the normal vector it will change the diffuse reflection for
the sphere at various points. Here I observe that the total illumination is reduced. So what
happens at this point is the total diffuse reflection is reduced which is just a direct
function of the angle. And this is what will happen for the points which are towards the
boundary or farther from the center of the sphere.

So you will see a variation of a shade on to the sphere. Just by using diffuse reflection
you can actually look at the shading of the sphere which already increases the realism of
the object. Therefore, this diffused reflection actually only depends on the light vector
and is independent of the viewer. It does not matter where the viewer is but all that it is
concerned about is the light vector. So it is viewer independent.

(Refer Slide Time: 00:15:37)

At times what happens is when we are talking about illumination of a point on the surface
we observe that the points which are farther from the light source should have less
reflection or light glow on to the object.

For example, if there are two spheres one sphere here and another sphere here this sphere
which is farther from the light source gets less light incident on it. Therefore the total
reflection is reduced. So you may want to incorporate some notion of the proximity of the
objects with respect to the light source. This can be done or modeled using an inverse
function to the distance. So here if I consider queue to be the distance of the point of the
object from the light source then I use this inverse function is a plus bq plus cq power 2
which in some sense attenuates this light intensity as a function of distance. So some
people use such a function and some people do not use, it is debatable.
(Refer Slide Time: 00:20:26)

The direction of the light source is already captured through this, the direction of the light
source with respect to the normal is not capturing the distance of the light source. In case
you are interested incorporating that accept and clearly we observe that there is inverse
relationship to the light incident with respect to the distance so we may want to model
something like this but many people do not incorporate this preference because there is
implicit role of the viewer also which we are discarding.

Now the question is that this diffused reflection does not incorporate many other aspects
which we may be still interested in. For instance, often we observe that there are
highlights or shininess on an object. Perhaps you may be noticing some glare or shininess
on my glasses because of the kind of material they are made of. Here is an example. For
instance there is this concentration of light at some points, the portion of the object. This
is what is meant by shininess or highlights which are completely ignored by diffuse
reflection. And these highlights or shininess in some sense a consequence of
incorporation the viewing direction. So whenever you see some shininess as a viewer if
you change then you see that the shininess is also changing. Therefore specular reflection
which is a sort of information about high lights and shininess considers viewing direction
so this something which is viewing dependent. Now the question is how we would like to
model this.

There is a phong model which is used for modeling specular reflection. If we consider a
light incident of some point here this is the normal vector and this v is the viewing vector
that is the reduction of the viewer. So now what happens is that there is a reflection of the
light at this point. This R is the nothing but reflected vector. There is also a mirror effect
which is what we are trying to capture.
(Refer Slide Time: 00:23:22)

So, if I have the v coincident to R I will observe that the entire light is reflected. So
whatever is an image here of the light source I will see that here and that is what is
completely reflected. So without worrying about this mirror effect at this point we just
want to see that there is a light incident on it which is reflected through the vector R and
that is also contributing to the total reflection of the light at this point in addition to the
diffuse reflection. And this is actually proportional to the cosine of the angle between the
viewing vector and the reflected vector.

An exponent is used here. This cos is the specular reflection or models this specular
reflection. In other words what we are saying is that there is this light incident here and
there is this reflected vector. What happens is that there is some sort of a distribution of
the reflection about this reflected vector which is also determined by the direction of the
viewer.

There is some concentration of reflection here but it spreads over and the concentration of
that sprit is captured through the exponent which we have used for cos alpha. So, if I use
that exponent equals to 1 I have this cos alpha function plotted here and if I use higher
exponent 5, 10 or so then the curve changes in this way and I see more of a concentrated
intensity at that point hence it basically controls the spread.
(Refer Slide Time: 00:28:48)

This is actually some sort of a measure of the type of material I am having for the
surface. So, if I have large n then these are the more like metallic objects so the shininess
is very concentrated. And if the n is small then it is more of a mat like object something
like a paper or wood where you do not observe lots of shininess. Actually there are other
issues also. When we discuss about ray tracing then we will actually see how we model
things like mirror because right now I am looking at the influence of the intensity of the
light onto the intensity which I need to render this point. So, if I am just looking at single
point reflection then this will be a very large number like infinity, there is no spread
basically.

This is sort of a plot of the cos alfa so if I have a cos alfa versus alfa. So how do you plot
cos alfa? So this is a cos alfa. Here this is just controlling the spread and is normalized.
But what happens to this term here. So how much I get here is altogether a different
thing. This is just like, how would this vary with respect to this n in a normalized fashion.
Therefore I am just keeping this part here as unity. So when I increase the value of n I see
that there is a concentration around this and the spread is reducing.

Here is an example:

Here if I had some other direction I get this shininess and now for these three I have the
same direction to show you the variation of the value of n. Therefore here it is parted so it
is a high value of n and here you see more spread so it is a lower value of n.
(Refer Slide Time: 00:29:55)

This is the concentration of light which is due to the exponent value. Therefore you have
the rest of the diffuse reflection coming, this is an added value to it which gives you
concentration of intensity and thereby some shininess or highlight.

Ambient reflection: In fact what happens is that whenever we talk about rendering or
display and when we are looking at the light sources which we defined for illuminating
the environment in reality there are lot of light sources which may not be explicitly
defined as light sources because even objects themselves work as light sources, they have
the ability to emit light and so on. Therefore there is a lot of integration of various light
sources in the environment which in turn give you some glow of the environment even
without having an explicit light source. This is what we try to capture through ambient
reflection.
(Refer Slide Time: 00:32:28)

Now clearly if I try to model each object as a potential light source and therefore compute
the light distribution for all the other objects it is going to be computationally very
interesting. So what we do is we approximate this phenomena, we try to approximate this
phenomena just using a simple relation like this where you have an ambient reflection
coefficient similar to Kd and Ks and ambient incident light so here we can differentiate
from the incident light with respect to a light source.

(Refer Slide Time: 00:34:15)

This is the general ambient light which I could define differently from the other incident
light. So now we have looked at diffuse reflection, specular reflection and ambient
reflection. If I just combine them I get an illumination model which is due to phong
illumination model where I get the total intensity just as a summation of ambient
reflection, diffuse reflection and specular reflection. So I just substitute the various terms
here. Here this Ks is similar to Kd characteristic to the material but most of the time when
we look at the shininess they are of the color of the light. So typically when we are
talking about white light sources then the shininess we observe is white. Therefore this
Ks is generally taken in as white color or just a scalar value unless you are trying to do a
color light source which is also possible.

(Refer Slide Time: 00:37:19)

This is what we get if I had only one light source. There is an ambient light coming from
the environment and I have one light source from which I get the incident light as IL.
Now if I have more than one light sources then what should I do?

All I need to do is just to look at the interaction with all the light sources, compute the
respective terms for diffuse reflection and specular reflection with respect to each light
source. Taking a sum over the light sources I have like 1 to m I am computing the
individual terms for diffuse and specular reflection. Hence I can handle multiple light
sources. Ia is generally given to you or you assume that it is given. For example, if you
define some IL then what would be the incident light. Similarly, if you assume some
ambient light and in fact Ka is also often taken as some toned value of Kd as you do not
want to change the color of the object. So now what are the computational issues here?

I need to have this (L dot N) which is easy. I know where the light source is I would
define it for the environment of the same, I know the n or I can compute the normal
vector and I also require this reflected vector, v is easy to compute the viewer direction is
easy to compute I know where the viewer is located then the question comes as how do I
compute this R.
Here are some computational aspects. Now just to sum up the phong illumination model
it is a local illumination model because the computation which we are doing is local at
that point. And if we look at the basic inputs or the number of light sources I have the
material property is given through the various reflection coefficients, the viewing vector
and the surface. Now the question is I need to compute this r, now how do we get it?

(Refer Slide Time: 00:39:04)

So this is the configuration we are looking at. There is a light vector here, normal vector
and this is the reflected vector. So you can also solve it geometrically to find out what R
should be in terms of L and N. But geometrically it is straight forward. Geometrically
what is happening is, if I consider this where I have this minus l vector and this is nothing
but twice of this which is a vector (L dot N)N where L dot N is the amount in the
direction of N so it is the projection of this onto this. So this total vector is now 2(L dot
N)N. Therefore R is nothing but this 2(L dot N)N minus L dot l so I can compute the
reflected vector R in terms of L and N and those are given to me therefore I can compute
R dot V. There is an approximation also through what is called as half way vector. So,
half way vector is actually a half way vector between V and L.
(Refer Slide Time: 00:40:26)

In fact what is told here is that you compute R dot V by computing H dot N. So this angle
is somewhat similar to this angle and that is the idea there. So again computing H is easy,
you just need to have to V and L, you also know what N is. Therefore you can
approximate R dot V using H dot N. Now we also need to have normal vector. During
this course we have also looked at the computation of normal vector for various
primitives.

Therefore if I have plane given in this form ax plus by plus cz plus d is equal to 0 or I
could have a plane defined in terms of the normal vector n dot (p minus p0) is equal to 0
so p is an arbitrary point on the plane, p0 is a known point in the plane so just looking at
the solution of this gives me the normal vector as nothing but abc which I can normalize.
So I know how to compute the normal vector plane, it is very straight forward. In fact
there is an alternate way by taking a cross product. Hence typically you would have the
extents given through the vertices of the plane and you can take the cross product of the
sides to have the normal vector.
(Refer Slide Time: 00:41:55)

Similarly, if you are interested in getting normal vector for something like a sphere if you
use an implicit equation of this kind f(x, y, z) is equal to x power 2 plus y power 2 plus z
power 2 minus 1 is equal to 0 then all you need is, take a grade function of f and that
defines the normal.

(Refer Slide Time: 00:43:01)

In fact in this case you can also look at the vector form which will be p as a point on the
surface of the sphere so p dot p minus 1 is equal to 0 and the solution of that gives me the
normal as just p. And we have also seen normal vector for parametric surfaces. There if I
take the derivative at a point of the surface and take a cross product of that then I can get
the normal of that point. So we have all the necessary information which we require to
compute the illumination and the various components of the illumination.

(Refer Slide Time: 00:43:38)

(Refer Slide Time: 00:46:15)

We have looked at light sources but actually you can have various kinds of light sources.
You may have a light source defined as a point light source where the light source is
given by the position of a point and we consider that the light is emitted in all directions.
Or you may also have a light source which is a directional light source given by a vector
so the light is incident along a direction. Therefore, as far as the location of the source is
concerned it is said to be at infinity. You can also have spotlight.
Probably you notice that in cinematography or in many other situations or you want to
simulate something like in torch so you have a spotlight source also which is given by a
cone kind of a structure. All that the cone is saying is that there is some sort of a zone
within which you are going to emit the light source from the point. All these light sources
are supported on OpenGL. All you have to do is just give the type of the light source you
want to use and the rest of it will be done by OpenGL. Here is a small clip:

(Refer Slide Time: 00:47:36)

(Refer Slide Time: 00:49:24)


This is a short move made by Pixar. Pixar is an animated movie house that has won lots
of academic and Oscar awards. This was probably made in 1986. Therefore this basically
tells you that just a small feature of lights and shades can do nice things.

You might also like