Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CG Unit 4 Q & A

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Unit 4

Light, Color ,shading & Hidden Surfaces


--------------------------------------------------------------------------
1) Explain and compare point source and diffuse illumination. (April 22-
6Marks)
Illumination is a technique to intensify (brightness will be added) an object or point by applying
certain model in order to get a realistic image.

Diffuse Illumination model:-


An objects illumination is as important as its surface properties in computing its intensity. The
object may be illuminated by light which does not come from any particular source but which
comes from all directions. When such illumination is uniform from all directions, the
illumination is called diffuse illumination. Basically the diffuse illumination is a background
light which is reflected from walls, floor, and ceiling.
when we assume that going up, down, right and left is of same amount then we can say that the
reflections are constant over each surface of the object and they are independent of the viewing
direction. Such a reflection is called diffuse reflection. In practice, when object is illuminated,
some part of light energy is absorbed by the surface of the object, while the rest is reflected. The
ratio of the light reflected from the surface to the total incoming light to the surface is
called coefficient of reflection or the reflectivity. It is denoted by R. The value of R varies from
0 to 1. it is closer to 1 for white surface and closer to 0 for black surface.
The diffuse reflections from the surface are scattered with equal intensity in all directions,
independent of the viewing direction. Such surfaces are sometimes referred to as ideal diffuse
reflectors or Lambertian reflector, since radiated light energy from any point on the surface is
governed by Lambert’s cosine law. This law states that the reflection of light from a perfectly
diffusing surface varies as the co

sine of the angle between the normal to the


surface and the direction of the reflected ray. This is illustrated in figure (a) below
Thus if the incident light from the source is Perpendicular to the surface at a perpendicular point,
that Point is fully illuminated.On the otherhand, as the angle of illumination moves away from
the surface normal,the brightness of the point drops off; but the Points appear to be squeezed
closer together, and the net effect is that the brightness of the surface is unchanged. This is
illustrated in figure (b). In other words we can say that the reduction in brightness due to cosine
of angle gets cancelled by increase in the number of light-emitting points within the area of view.

light or dark scenes or gray shade objects.


Point-source Illumination model:-
Point sources emits rays from a single point and they can approximate real world sources such as
a small incandescent bulbs or candles. A point source is a direction source, whose all the rays
come from the same direction, therefore, it can be used to represent the distant sun by
approximating it as an infinitely distant Point source. The modelling of point sources requires
additional work because their effect depends on the surface's orientation. If the surface is normal
(perpendicular) to the incident light rays, it is brightly illuminated. The surfaces turned away
from the light source (oblique surfaces) are less brightly illuminated. This is illustrated in figure
(c) below

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 :

for (each pixel in polygon's projection)


{
find depth i.e, z of polygon
at (x, y) corresponding to pixel (i, j)

if (z < d(i, j))


{
d(i, j) = z;
c(i, j) = color;
}
}

Let’s consider an example to understand the algorithm in a better way. Assume the
polygon given is as below :

In starting, assume that the depth of each pixel is infinite.


As the z value i.e, the depth value at every place in the given polygon is 3, on applying
the algorithm, the result is:

Now, let’s change the z values. In the figure given below, the z values goes from 0 to 3.

In starting, the depth of each pixel will be infinite as :


Now, the z values generated on the pixel will be different which are as shown below :

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:

Visibility Determination: In a 3D scene, multiple objects or surfaces may


overlap or intersect. A hidden surface algorithm is needed to determine which
surfaces are visible from a particular viewpoint, ensuring that only the visible
surfaces are rendered. This process is crucial for generating realistic and
accurate images.
Realism in Rendering: To create realistic and visually accurate images, it is
essential to account for occlusion. Objects in the foreground should block
objects in the background, and hidden surface algorithms help achieve this by
prioritizing the display of visible surfaces.
Depth Ordering: Hidden surface algorithms help establish the correct depth
order of surfaces. They ensure that surfaces closer to the viewer are displayed in
front of surfaces that are farther away. This is crucial for maintaining the
correct spatial relationships and perspectives in a scene.
Elimination of Overdraw: Overdraw occurs when the same pixel is drawn
multiple times, which can be computationally expensive and inefficient. Hidden
surface algorithms minimize overdraw by determining the visibility of each
pixel and avoiding unnecessary rendering of obscured surfaces.
Optimizing Rendering Performance: By efficiently culling invisible surfaces,
hidden surface algorithms contribute to optimizing rendering performance.
They reduce the computational workload by eliminating the need to render
surfaces that will not contribute to the final image.
Interactive Graphics: In applications where real-time or interactive graphics
are required, such as video games or simulations, hidden surface algorithms are
crucial. They enable rapid rendering of only the visible portions of a scene,
allowing for smoother user interactions.
Transparency and Blending: When dealing with transparent or translucent
surfaces, hidden surface algorithms become even more complex. They need to
account for the correct blending of transparent surfaces with the background
and ensure that the visible surfaces are correctly composited.
Accuracy in Computer-Aided Design (CAD): In CAD applications, where
precise modeling and visualization of 3D objects are crucial, hidden surface
algorithms help maintain accuracy by displaying only the visible components of
complex geometric models.

------------------------------------------------------------------------------------------------

7) Whta is Backface? Explain Backface Detection and removal.


(2023 ,6 Marks)

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.

Back Face Removed Algorithm

Repeat for all polygons in the scene.

1. Do numbering of all polygons in clockwise direction i.e.


v1 v2 v3.....vz
2. Calculate normal vector i.e. N1
N1=(v2-v1 )*(v3-v2)
3. Consider projector P, it is projection from any vertex
Calculate dot product
Dot=N.P
4. Test and plot whether the surface is visible or not.
If Dot ≥ 0 then
surface is visible
else
Not visible

--------------------------------------------------------------------------------------

8) Explain and compare point source and diffuse illumination.


Repeated(ans-q 1)

-------------------------------------------------------------------------------------

9) Compare RGB and HSV color model (2023 6 Marks).

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:

RGB Color Model:

• Representation: Colors in the RGB model are represented as combinations


of red, green, and blue components. Each component is usually an 8-bit
value, ranging from 0 to 255.
• Additive Color: RGB is an additive color model, meaning colors are created
by combining different intensities of red, green, and blue light. Mixing all
three colors at full intensity produces white light.
• Color Space: RGB is well-suited for electronic displays such as monitors,
televisions, and cameras. It is the primary color model used in digital
imaging and electronic displays.
• Image Processing: RGB is widely used in image processing applications, as
it directly corresponds to the way colors are displayed on electronic screens.
However, it is not always intuitive for color manipulation tasks.
• Complexity in Color Manipulation: Directly manipulating certain aspects of
color, such as adjusting brightness or changing the color tone, can be
complex in the RGB model.
HSV Color Model:

• Representation: Colors in the HSV model are represented using three


components: Hue, Saturation, and Value. Hue represents the dominant
wavelength of color, Saturation represents the intensity or vividness, and
Value represents the brightness.
• Cylindrical Model: HSV is often visualized as a cylindrical color space,
where the hue is represented around the circumference, saturation along the
vertical axis, and value along the height of the cylinder.
• Intuitive Color Manipulation: The HSV model is often preferred for color
manipulation tasks, as changes in hue, saturation, and value correspond more
intuitively to the way humans perceive and describe colors.
• Color Picking: HSV is commonly used in graphic design software and color
pickers because it provides an intuitive way for users to select and modify
colors.
• Less Sensitive to Luminance: The HSV model is less sensitive to changes in
luminance compared to the RGB model. This can be advantageous in certain
applications where maintaining consistent color appearance is critical.
• Representation of Grayscale: The value component in HSV can be used to
represent grayscale, making it easy to convert between color and grayscale
representations.

---------------------------------------------------------------------------------------------------------

You might also like