0% found this document useful (0 votes)
50 views15 pages

CG Model QXN Soln

The document discusses various computer graphics concepts including: 1) Explaining Bresenham's line drawing algorithm and using it to digitize a line between two points. 2) Describing Phong shading and how it interpolates surface normals across polygons. 3) Explaining how flood fill works to fill polygons by replacing a specified interior color. 4) Discussing the significance of vanishing points in perspective projection for creating a 3D look.

Uploaded by

Bishal Shahi
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)
50 views15 pages

CG Model QXN Soln

The document discusses various computer graphics concepts including: 1) Explaining Bresenham's line drawing algorithm and using it to digitize a line between two points. 2) Describing Phong shading and how it interpolates surface normals across polygons. 3) Explaining how flood fill works to fill polygons by replacing a specified interior color. 4) Discussing the significance of vanishing points in perspective projection for creating a 3D look.

Uploaded by

Bishal Shahi
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
You are on page 1/ 15

1. Explain the working details of DDA algorithm? Explain.

Digitize a line with end


points A(6,12) and B(10,5) using Bresenham’s line drawing algorithm.

Answer.
Digitizing a line with end points A(6,12) and B(10,5) using Bresenham’s line
drawing algorithm.
2. How can polygons be clipped? Why is Phong shading also called Normal Vector
Interpolation scheme? Explain.
Phong shading,It is also called Phong interpolation or normal-vector
interpolation shading. Specifically, it interpolates surface normals across
rasterized polygons and computes pixel colors based on
the interpolated normals and a reflection model.
4. How to animate a two dimensional figure using transformations? Explain with
example.
5.What are the key issues prevalent in producing a Virtual reality scene? Describe
the Binary Space Partition tree

Answer.
There is a number of challenges that are hampering the growth of VR. First, hardware for
capturing 3D images is rudimentary at best, unless users seek out the uppermost level of
hardware at extremely high price points.

Additionally, access to, and quality of, images that are currently available is limited at best.
Developers are forced to either use low-quality images or develop the images themselves
at a substantial cost, often pricing the bulk of the VR market out of their product.

Where high quality images exist, image depositories are able to charge substantial
surcharges to users, profiting from the work of the creators, but not compensating them
accordingly.
6. How can a polygon surface be filled using the Flood fill approach? Explain.

Answer.
Flood-fill Algorithm is applicable when we want to fill an area that is not defined
within a single color boundary. If fill area is bounded with different color, we can
paint that area by replacing a specified interior color instead of searching of
boundary color value. This approach is called flood fill algorithm. We start from a
specified interior pixel (x,y) and reassign all pixel values that are currently set to a
given interior color with desired fill_color. Using either 4-connected or 8-
connected region recursively starting from input position, the algorithm fills the
area by desired color.
Algorithm for 4-connected:
void flood_fill4(int x,int y,int fill_color,int old_color)
{
int current;
current = getpixel (x,y);
if (current == old_color)
{
putpixel (x,y,fill_color);
flood_fill4(x-1,y, fill_color, old_color);
flood_fill4(x,y-1, fill_color, old_color);
flood_fill4(x,y+1, fill_color, old_color);
flood_fill4(x+1,y, fill_color, old_color);
}
}

7. What is the significance of vanishing points in Perspective Projection? Explain.

Answer
A vanishing point is a point on the image plane of a perspective drawing
where the two-dimensional perspective projections (or drawings) of
mutually parallel lines in three-dimensional space appear to converge. It is
what allows us to create drawings, paintings, and photographs that have a
three-dimensional look.
Vanishing Point Perspective is used in Graphic editing and 3D video
games. It can be used to render 3D shapes (3D Buildings and objects), add
perspective to a background scene (road, train track) or add shadow
effects. Hence the significance of vanishing point is to make the projection
more realistic in 3-D look.

8. Explain ambient light, diffuse reflection and specular reflection with examples
Answer

Ambient light means the light that is already present in a scene, before
any additional lighting is added. It usually refers to natural light, either
outdoors or coming through windows etc. It can also mean
artificial lights such as normal room lights

Diffuse reflection is the reflection of light or other waves or particles from


a surface such that a ray incident on the surface is scattered at many
angles rather than at just one angle as in the case of specular reflection

Specular reflection is a type of surface reflectanceoften described as a


mirror-like reflection of light from the surface. In specular reflection, the
incident light is reflected into a single outgoing direction.
9. Compute the midpoint of the Bezier Curve with control points p0 = (0,0,1), p1 =
(1,0,1) and p2 = (1,2,0).
10. How does a polygon can be created in OpenGL? Illustrate with an example.

Answer.
Polygons are typically drawn by filling in all the pixels enclosed within the
boundary, but you can also draw them as outlined polygons or simply as
points at the vertices. A filled polygon might be solidly filled or stippled with
a certain pattern.

A program to draw simple polygon.


#include <stdio.h>
#include <GL/glut.h>

void display(void)
{
glClear( GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 1.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(2.0, 4.0, 0.0);
glVertex3f(8.0, 4.0, 0.0);
glVertex3f(8.0, 6.0, 0.0);
glVertex3f(2.0, 6.0, 0.0);
glEnd();
glFlush();
}

int main(int argc, char **argv)


{
printf("hello world\n");
glutInit(&argc, argv);
glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB |
GLUT_DEPTH);

glutInitWindowPosition(100,100);
glutInitWindowSize(300,300);
glutCreateWindow ("square");

glClearColor(0.0, 0.0, 0.0, 0.0); // black


background
glMatrixMode(GL_PROJECTION); // setup
viewing projection
glLoadIdentity(); // start
with identity matrix
glOrtho(0.0, 10.0, 0.0, 10.0, -1.0, 1.0); // setup a
10x10x2 viewing world

glutDisplayFunc(display);
glutMainLoop();

return 0;
}

11. How does a video controller and a frame buffer jointly collaborate to produce
graphical display on the screen, in case of a Raster Display?

A fixed area of memory is reserved for frame buffer, and the video controller
is given direct access to the frame buffer
When a particular command is called by the application program, the graphics
subroutine package sets the appropriate pixels in the frame buffer.
The video controller then cycles through the frame buffer, one scan line at a
time, typically 50 times per second.
It will bring a value of each pixel contained in the frame buffer and uses it to
control the intensity of the CRT electron beam.
So there exists a one to one relationship between the pixel in frame buffer and
that on the CRT screen.
Frame buffer locations, and the corresponding screen position are referenced
in Cartesian co-ordinates.
For most of the system, the coordinate origin is referenced at the lower left
corner of the screen, with positive X value increasing to the right and positive y
value increasing from bottom to top. However, in some PC, the coordinate origin is
referenced at the upper left corner of the screen, so the y values are inverted.

12. Write short notes on (Any TWO)

a. Polygon Tables
Polygon (computer graphics) Polygons are used in computer
graphics to compose images that are three-dimensional in appearance.
Usually (but not always) triangular, polygons arise when an object's
surface is modeled, vertices are selected, and the object is rendered in a
wire frame model
b. Augmented Reality
Augmented reality (AR) is an interactive experience of a real-world
environment where the objects that reside in the real-world are
"augmented" by computer-generated perceptual information, sometimes
across multiple sensory modalities, including visual, auditory, haptic,
somatosensory, and olfactory.

c. Painter’s algorithm
The painter's algorithm, also known as a priority fill, is one of the
simplest solutions to the visibility problem in 3D computer graphics. When
projecting a 3D scene onto a 2D plane, it is necessary at some point to
decide which polygons are visible, and which are hidden.

You might also like