CG Unit 4 Q & A
CG Unit 4 Q & A
CG Unit 4 Q & A
For oblique surfaces, the illumination decreases by a factor of cos I, where I is the angle between
the direction of the light and the direction normal to the surface plane. The angle I is known as
angle of incidence as shown in figure (d).
The factor cos I is given as
cos I= N. L
Where L is the vector of length 1 units pointing towards the light source and N is the vector of
length 1 in the direction normal to the surface Plane.
Considering both diffuse illumination and point source illumination, the shade of the visible
surface of an object is given as
Where ka Ia, is the intensity of light coming from visible surface due to diffuse illumination,
I1 is the intensity of light comes from the point source, kd is the diffuse reflectivity coefficient
and vector dot product (L.N) gives the cosine of the angle of incidence.
---------------------------------------------------------------------------------------------------------------------
2) Explain Z-buffer (Depth Buffer) algorithm with example.
( April 22-6Marks)
When viewing a picture containing non transparent objects and surfaces, it is not
possible to see those objects from view which are behind from the objects closer to eye.
To get the realistic screen image, removal of these hidden surfaces is must. The
identification and removal of these surfaces is called as the Hidden-surface problem.
Z-buffer, which is also known as the Depth-buffer method is one of the commonly used
method for hidden surface detection. It is an Image space method. Image space
methods are based on the pixel to be drawn on 2D. For these methods, the running time
complexity is the number of pixels times number of objects. And the space complexity
is two times the number of pixels because two arrays of pixels are required, one for
frame buffer and the other for the depth buffer.
The Z-buffer method compares surface depths at each pixel position on the projection
plane. Normally z-axis is represented as the depth. The algorithm for the Z-buffer
method is given below :
Algorithm :
First of all, initialize the depth of each pixel.
i.e, d(i, j) = infinite (max length)
Initialize the color value for each pixel
as c(i, j) = background color
for each polygon, do the following steps :
Let’s consider an example to understand the algorithm in a better way. Assume the
polygon given is as below :
Now, let’s change the z values. In the figure given below, the z values goes from 0 to 3.
Therefore, in the Z buffer method, each surface is processed separately one position at a
time across the surface. After that the depth values i.e, the z values for a pixel are
compared and the closest i.e, (smallest z) surface determines the color to be displayed
in frame buffer. The z values, i.e, the depth values are usually normalized to the range
[0, 1]. When the z = 0, it is known as Back Clipping Pane and when z = 1, it is called
as the Front Clipping Pane.
----------------------------------------------------------------------------------------------------
3) List properties of light (April 22 5 Mraks.)
Light: It is a form of energy which helps in the sense of vision.
We are able to see objects when light falls on the object and some of light falls
reflected back to our eyes.
Properties of Light:
• Rectilinear propagation of light is the property of light due to which it
travels in a straight line.
• Shadows are formed because light rays travel in a straight line, and they
cannot bend around the corners of the objects. The shape of the shadow is
also the same as the shape of the object because light travels in a straight-
line path.
• Reflection of light: Every light follows the law of reflection which states
that the angle of incidence is equal to the angle of reflection.
• Refraction of light: Refraction of light takes places when the light ray
changes its velocity it passes from one medium to another. Index of
refraction is used as a means to measure how much light refracts.
• Dispersion: Dispersion of light is defined as the process in which the white
light separates into different colours based on their wavelength when passed
through a glass prism.
4) Explain and compare diffuse and specular reflection (April 22 ,6
Mraks.)
• Diffuse Reflection:
• Surface Interaction: Diffuse reflection occurs when light interacts with a
rough or irregular surface. The surface consists of many microscopic
irregularities, causing light to be scattered in various directions.
• Angle of Incidence: The angle of incidence is not preserved in diffuse
reflection. Light reflects in a scattered manner, with no specific relationship
between the incoming and outgoing angles.
• Appearance: Diffuse reflection leads to a matte or non-glossy appearance.
Common examples include paper, fabrics, and untreated wood surfaces.
• Scattering: Light is scattered uniformly in all directions, making the object
visible from many viewpoints. This property contributes to the visibility of
non-shiny surfaces from various angles.
• Diffusion of Shadows: Shadows on surfaces with diffuse reflection have soft
edges because light is coming from multiple directions due to scattering.
• Specular Reflection:
• Surface Interaction: Specular reflection occurs when light interacts with a
smooth and even surface. The surface is typically reflective and acts like a
mirror.
• Angle of Incidence: The angle of incidence is preserved in specular
reflection. The angle at which light hits the surface is equal to the angle at
which it reflects.
• Appearance: Specular reflection results in a shiny or glossy appearance.
Common examples include mirrors, glass surfaces, and polished metal.
• Directionality: Light is reflected in a specific direction, following the law of
reflection. This directional reflection is why you can see distinct reflections
of objects in mirrors.
• Sharpness of Shadows: Shadows cast on surfaces with specular reflection
have sharp edges because light reflects in a well-defined direction.
• Comparison:
• Surface Smoothness: The primary difference lies in the smoothness of the
surface. Diffuse reflection occurs on rough surfaces, while specular
reflection occurs on smooth, reflective surfaces.
• Angle of Reflection: In diffuse reflection, the angle of reflection is random,
and there is no correlation between the incident and reflected angles. In
specular reflection, the angle of reflection is equal to the angle of incidence.
• Appearance: Diffuse reflection leads to a matte appearance, while specular
reflection results in a shiny or glossy appearance.
• Scattering: Diffuse reflection scatters light uniformly in all directions,
making the object visible from various viewpoints. Specular reflection
reflects light in a specific direction, creating well-defined reflections.
• Examples: Diffuse reflection is seen in materials like paper, wood, and
fabrics. Specular reflection is observed in mirrors, glass, and polished
metals.
-----------------------------------------------------------------------------------------------------------------
5) Explain Painters (Depth Sort) algorithm with example.
( April 22 ,6 Marks)
• Painter’s algorithm is the algorithm which is introduced
by Hewells in 1972.
• The techniques used by these algorithms are image space and object space.
• The name of this algorithm is Painter’s because it’s working is like a painter
who creating an oil painting. Just like an artist paints, he start his painting
with an empty canvas, the first thing the artist will do is to create
a background layer for the painting, after this layer he start creating another
layers of objects one-by-one. In this way he completes his painting, by
covering the previous layer partially or fully according to the requirement of
the painting.
• This algorithm is basically used to paint the polygons in the view plane by
considering their distance from the viewer. The polygons which are at more
distance from the viewer are painted first. After that the nearer polygons are
started painted on or over more distant polygons according to the
requirement.
• In this algorithm the polygons or surfaces in the scene are firstly scanned or
then painted in the frame buffer in the decreasing distance from view point
of the viewer starting with the polygons of maximum depth or we can say
minimum z-value.
• Firstly the depth sort is performed in which the polygons are listed according
to their visibility order or depth priority.
• As this algorithm uses the concept of depth priority so it is also called
as depth priority algorithm or priority algorithm.
• The frame buffer is painted with the background color. After that the
polygon which is farthest enter to the frame buffer. For this, the pixel
information will get changed i.e. information of the background which has
the farthest polygon get replaced with that of the background. This is going
to be repeatedly changed as we move from one polygon to the other and end
up with the nearest polygon.
• Usually comparisons are performed whenever the polygons are going to
overlap each other. The most common method used for the comparison is
called as mini-max method. For this purpose, the rectangles are drawn
around the polygons such that the rectangles exactly fit the polygons.
• Then the rectangles are going to check to see whether they overlap each
other or not. If the rectangles are observed as they do not overlap then we
consider that the surfaces are also not overlap. If the rectangles are
overlapped then the surfaces are also overlapped which is as shown in the
following figure:
•
• To find out which rectangle is to be overlap, we need to find the minimum
and maximum x and y values to the rectangles which are going to test for
overlapping. If the minimum value of y of one of the rectangles is larger
than the maximum y value of the other rectangle then they are not going to
be overlapped and as the rectangles are not overlapped then the surfaces are
also not overlapped.
• The same test is to be performed for the x-coordinates.
• If the surfaces are overlapping, we do not know which surface should be
present on the top of the other. To find out which surface is to be present on
the top the principle of mini-max is used on the depth values of both the
overlapping surfaces.
• Example:
•
• Algorithm for Painter’s method
• The following are the steps of this algorithm:
• Sorting of the various surfaces which is on the basis of their decreasing
depth or we can say the largest value of z.
• Now scanning to convert the various surfaces which is in the order starting
with the surface which has greatest depth.
• Comparing is to be done on the basis of various overlapping surfaces so that
the user will determine which surface is to be kept visible.
• In the refresh buffer enter the intensity value for the determined surface i.e.
the surface which is determined to be visible.
• The above process is going to be repeat for all the available surfaces.
• However, if the overlapping is observed, then there is the need of the further
tests. The following tests are required:
--------------------------------------------------------------------------------------------
6) What is the need of hidden surface algorithm (April 22 , 5 Marks).
The hidden surface algorithm is essential in computer graphics and computer-
aided design to determine which surfaces or parts of surfaces are visible and should
be displayed in a rendered image. The primary need for hidden surface algorithms
arises from the challenges of presenting three-dimensional scenes on a two-
dimensional display, where certain surfaces may obstruct others. Here are some
reasons why hidden surface algorithms are necessary:
------------------------------------------------------------------------------------------------
In computer graphics, a backface is the back side of a mesh face. It's usually not
facing the camera, so it can be discarded from the list of items to be rendered.
It is used to plot only surfaces which will face the camera. The objects on the back
side are not visible. This method will remove 50% of polygons from the scene if the
parallel projection is used. If the perspective projection is used then more than 50%
of the invisible area will be removed. The object is nearer to the center of projection,
number of polygons from the back will be removed.
It applies to individual objects. It does not consider the interaction between various
objects. Many polygons are obscured by front faces, although they are closer to the
viewer, so for removing such faces back face removal algorithm is used.
When the projection is taken, any projector ray from the center of projection through
viewing screen to object pieces object at two points, one is visible front surfaces,
and another is not visible back surface.
This algorithm acts a preprocessing step for another algorithm. The back face
algorithm can be represented geometrically. Each polygon has several vertices. All
vertices are numbered in clockwise. The normal M1 is generated a cross product of
any two successive edge vectors. M1represent vector perpendicular to face and point
outward from polyhedron surface.
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
The RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) color models are
two different ways of representing colors, each with its own advantages and
applications. Here's a comparison between the RGB and HSV color models:
---------------------------------------------------------------------------------------------------------