0% found this document useful (0 votes)
54 views13 pages

CG Unit 4 Q& Answers New

Uploaded by

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

CG Unit 4 Q& Answers New

Uploaded by

yogirain216
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CG Unit 4 Question & Answers

Q1)Write short note on Warnock's Algorithm.

The Warnock algorithm is a hidden surface algorithm invented by John Warnock that is typically used in
the field of computer graphics.[1] It solves the problem of rendering a complicated image by recursive
subdivision of a scene until areas are obtained that are trivial to compute. In other words, if the scene is
simple enough to compute efficiently then it is rendered; otherwise it is divided into smaller parts which
are likewise tested for simplicity

When we subdivide the window panel against the polygon we may come through the following cases
which are as follows:

1. Surrounding surface: It’s the case in which the viewing polygon surface completely surrounds the
whole window panel.

2. Overlapping(Intersecting) surface: It’s the case in which the window panel(viewport) and viewing
polygon surface both intersect each other.
3. Inside(contained) surface: In this case, in which the whole polygon surface is inscribed inside the
window panel. This case is just opposite to the first(surrounding surface) case.

4. Outside(disjoint) surface: In this case, the whole polygon surface is completely outside the window
panel.
Algorithm:

1. Initialize the viewing area or window panel dimension.


2. Enlist all the polygon(s) and sort them according to Z min (depth value) with respect to the window
panel(view port).
3. Categorize all the polygon(s) according to their corresponding cases in which they are falling.
4. Now, perform the visible surface(hidden surface removal) detection test:
o If we have a polygon, which has completely surrounded the window panel then set the
viewing area color to the corresponding polygon color that is stored in the frame buffer.
o If the enlisted polygon(s) are disjoint or completely outside the window panel then, in
this case, the background color of the window plane will be done and the polygon(s) will
be ignored.
o If the polygon(s) is contained(inscribed) inside the window panel completely then color
the polygon from its corresponding color and color the rest of the surface with the
background color.
o If polygon(s) and the window panel surfaces are intersecting(overlapping) each other
then the following cases need to be considered:
 Fill the overlapped region with the corresponding polygon color that is set in the
frame buffer.
 If we are given more than one polygon, with overlapped surfaces with respect to
the window plane then, in this case, we first find out the depth buffer(Z min) in
order to find the surface of the polygon which is closer to the window panel and
will fill the overlapped region with the color of that polygon that has
minimum(Zmin).
5. Repeat all the above steps for all given polygons, then exit.

Q)Explain Halftone shading.

Halftone is a 20th-century printing technique in which patterns of dots create images. At a time when
printing processes were limited, halftone was a way to create the appearance of colours and shades.
Halftone is the reprographic technique that simulates continuous-tone imagery through the use of dots,
varying either in size or in spacing, thus generating a gradient-like effect. "Halftone" can also be used to
refer specifically to the image that is produced by this process.

Types

 Simple Round Halftone Dot.


 Round Euclidean Dot.
 Simple Ellipse.
 Line.
 Extended Ellipse.
 Stochastic/FM.

Halftones and tone transfer curves are used with both color and grayscale print jobs. There are several
different kinds of halftones, including clustered-dot, stochastic, and error diffusion.

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

Q)Rgb & HSV color model

The RGB color model is one of the most widely used color representation method in computer
graphics. It use a color coordinate system with three primary colors:
R(red), G(green), B(blue)

Each primary color can take an intensity value ranging from 0(lowest) to 1(highest). Mixing these
three primary colors at different intensity levels produces a variety of colors. The collection of all the
colors obtained by such a linear combination of red, green and blue forms the cube shaped RGB color
space.

The corner of RGB color cube that is at the origin of the coordinate system corresponds to black,
whereas the corner of the cube that is diagonally opposite to the origin represents white. The diagonal
line connecting black and white corresponds to all the gray colors between black and white, which is
also known as gray axis.
In the RGB color model, an arbitrary color within the cubic color space can be specified by its color
coordinates: (r, g.b).

Example:
(0, 0, 0) for black, (1, 1, 1) for white,

(1, 1, 0) for yellow, (0.7, 0.7, 0.7) for gray

Color specification using the RGB model is an additive process. We begin with black and add on the
appropriate primary components to yield a desired color. The concept RGB color model is used
in Display monitor.
HSV:

A color model is a multidimensional representation of the color spectrum. The most relevant color
spectrums are RGB, HSV, HSL and CMYK. A color model can be represented as a 3D surface (e.g.
for RGB) or go into much higher dimensions (such as CMYK). By adjusting the parameters of these
surfaces, we can obtain different colors that we see in the color spectrum around us.

An HSV color model is the most accurate color model as long as the way humans perceive colors.
How humans perceive colors is not like how RGB or CMYK make colors. They are just primary
colors fused to create the spectrum. The H stands for Hue, S stands for Saturation, and the V stand for
value. Imagine a cone with a spectrum of red to blue from left to right, and from the centre to the
edge, the color intensity increases. From bottom to up, the brightness increases. Hence resulting white
at the center up layer. A pictographic representation is also shown below.

 Hue: Hue tells the angle to look at the cylindrical disk. The hue represents the color. The hue
value ranges from o to 360 degrees.

Angle
(in
degree
) Color

0-60 Red

60- Yellow
Angle
(in
degree
) Color

120

120-
Green
180

180-
Cyan
240

240-
Blue
300

300-
Magenta
360

 Saturation: The saturation value tells us how much quantity of respective color must be added. A
100% saturation means that complete pure color is added, while a 0% saturation means no color is
added, resulting in grayscale.
 Value: The value represents the brightness concerning the saturation of the color. the value 0
represents total black darkness, while the value 100 will mean a full brightness and depend on the
saturation.
Advantages:
The advantage of HSV is that it generalizes how humans perceive color. Hence it is the most accurate
depiction of how we feel colors on the computer screen. Also, the HSV color space separates the luma
from the color information. this allows us to perform the operations mentioned above in the
applications section, as the histogram equalization will only be required for intensity values.
Applications:

 HSV model is used in histogram equalization.


 Converting grayscale images to RGB color images.
 Visualization of images is easy as by plotting the H and S components we can vary the V
component or vice-versa and see the different visualizations.
----------------------------------------------------------------------------------------------------------------

Q) Explain light sources, ambient light, diffuse reflection and specular reflection.

Illumination model, also known as Shading model or Lightning model, is used to calculate the
intensity of light that is reflected at a given point on surface. There are three factors on which
lightning effect depends on:
1. LightSource:
Light source is the light emitting source. There are three types of light sources:
1. Point Sources – The source that emit rays in all directions (A bulb in a room).
2. Parallel Sources – Can be considered as a point source which is far from the surface (The
sun).
3. Distributed Sources – Rays originate from a finite area (A tubelight).
Their position, electromagnetic spectrum and shape determine the lightning effect.

2. Surface:
When light falls on a surface part of it is reflected and part of it is absorbed. Now the surface
structure decides the amount of reflection and absorption of light. The position of the surface and
positions of all the nearby surfaces also determine the lightning effect.
3. Observer:
The observer’s position and sensor spectrum sensitivities also affect the lightning effect.

1.AmbientIllumination :
Assume you are standing on a road, facing a building with glass exterior and sun rays are falling on
that building reflecting back from it and the falling on the object under observation. This would
be Ambient Illumination. In simple words, Ambient Illumination is the one where source of light is
indirect.
The reflected intensity I amb of any point on the surface is:

2.DiffuseReflection :
Diffuse reflection occurs on the surfaces which are rough or grainy. In this reflection the brightness of
a point depends upon the angle made by the light source and the surface.
The reflected intensity I diff of a point on the surface is:

3.SpecularReflection :
When light falls on any shiny or glossy surface most of it is reflected back, such reflection is known as
Specular Reflection.
Phong Model is an empirical model for Specular Reflection which provides us with the formula for
calculation the reflected intensity I spec:
Q) Explain BSP tree for hidden surface removal and explain its advantages

Binary Space Partitioning is implemented for recursively subdividing a space into two convex sets by
using hyperplanes as partitions. This process of subdividing gives rise to the representation of objects
within the space in the form of tree data structure known as BSP Tree.
Binary space partitioning arose in the context of 3D computer graphics in 1969, where the structure of
a BSP tree allows for spatial information about the objects in a scene that is useful in rendering, such
as objects being ordered from front-to-back with respect to a viewer at a given location, to be accessed
apidly.

Needs of Binary Space Partitioning

Binary space partitioning arose from the computer graphics need to rapidly draw three-dimensional
scenes composed of polygons. A simple way to draw such scenes is the painter’s algorithm, which
produces polygons in order of distance from the viewer, back to front, painting over the background,
and previous polygons with each closer object. This approach has two disadvantages: the time
required to sort polygons in back to front order, and the possibility of errors in overlapping polygons.
Fuchs and co-authors showed that constructing a BSP tree solved both of these problems by providing
a rapid method of sorting polygons with respect to a given viewpoint (linear in the number of
polygons in the scene) and by subdividing overlapping polygons to avoid errors that can occur with
the painter’s algorithm.

Binary space partitioning is treated as a generic process of recursively dividing a scene into two until
the partitioning satisfies one or more requirements. It can be viewed as a generalization of other
spatial tree structures such as k-d trees and quadtrees, one where hyperplanes that partition space may
have any orientation instead of being aligned with the coordinate axes as they are in k-d
trees or quadtree.
When implemented in computer graphics to render scenes composed of planar polygons, the
partitioning planes are frequently selected to coincide with the planes defined by polygons in the
scene. The specific choice of partitioning plane and criterion for completing the partitioning process
varies depending on the purpose of the BSP tree.
For example: In computer graphics rendering, the scene is divided until and unless each node of the
BSP tree consists of only polygons that can render in arbitrary order. When back-face culling is
implemented, each node, therefore, consists of a convex set of polygons, whereas when rendering
double-sided polygons, each node of the BSP tree consists of only polygons in a single plane.

Algorithm of generating a BSP Tree from a list of polygons

 Select a polygon P from the list.


 Make a node N in the BSP tree, and add P to the list of polygons at that node.
 For each other polygon in the list:
 If that polygon is wholly in front of the plane containing P, move that polygon to the
list of nodes in front of P.
 If that polygon is wholly behind the plane containing P, move that polygon to the list of
nodes behind P.
 If that polygon is intersected by the plane containing P, split it into two polygons and
move them to the respective lists of polygons behind and in front of P.
 If that polygon lies in the plane containing P, add it to the list of polygons at node N.
 Apply this algorithm to the list of polygons in front of P.
 Apply this algorithm to the list of polygons behind P.

Disadvantage of BSP

 Generating a BSP tree can be time-consuming.


 BSP does not solve the problem of visible surface determination.

Uses of BSP

 It is used in collision detection in 3D video games and robotics.


 It is used in ray tracing
 It is involved in the handling of complex spatial scenes.

You might also like