Computer Graphics Imp Ques
Computer Graphics Imp Ques
Computer Graphics Imp Ques
Every personal computer has 3D graphics components. They are increasingly being used by
other applications.
The distance from the center of projection to the project plane is infinite in parallel
projection. The projected vertices are connected by line segments that correspond to the
connections on original object.
For exact measurements, parallel projections are mostly used. Parallel lines remain parallel
and angles are not preserved. Some of the types of parallel projections are as follows:
What is Orthographic Projection?
The direction of the projection is normal to the projection of the plane in Orthographic
projection. Different types of orthographic projections are:
Front Projection
Top Projection
Side Projection
Oblique projections are of two types − Cavalier and Cabinet. The Cavalier projection makes
45° angle with the projection plane. The length of the projection is same as that of the
cavalier projection. The foreshortening factors of all the three principle directions are equal.
63.4° angle with the projection plane is made with the Cabinet projection. In Cabinet
projection, lines perpendicular to the viewing surface are projected at ½ their actual length.
Both the projections are shown in the following figure −
The parallel lines do not remain parallel and the distance and angles are not preserved.
Instead, at a single point, center of projection or projection reference point, all the parallel
lines converge. Three types of perspective projections appear such as:
One point perspective projection is simple to draw.
Two point perspective projection gives better impression of depth.
Three point perspective projection is most difficult to draw.
All the three types of perspective projection is depicted below:
What is Translation?
The Z coordinate is translated along X and Y coordinates. The 3D translation is similar to
that of 2D translation. An object is moved into different position on the screen and the effect
of transition is depicted below:
What is 3D Rotation?
The angle of the rotation along the axis of the location need to be specified in 3D rotation. 3D
rotation is performed about X, Y, and Z axes. The matrix representation of 3D rotation is as
follows:)
=[X.SxY.SyZ.Sz1]
Shear in 3D transformation
The shape of the object is slanted by the shear transformation. An object can be sheared along
X-axis, Y-axis, or Z-axis in 3D.
The set of points on curve are defined by employing a procedure that can be tested to see if a
point is on the curve. An implicit function is used to define the implicit curve
f(x, y) = 0
The multivalued curves can be represented such as for an single x value, many y values. The
very common example is circle, and is implicitly represented as:
Explicit Curves
The function y = f(x) can be plotted as a curve, which is known as explicit representation of
the curve. For each of the value of x, a single value y is normally computed by the function.
Parametric Curves
Parametric curves are the curves which have parametric values. Practically parametric curves
are mostly used. The form of a two-dimensional parametric curve is:
ni(t)=(ni)(1−t)n−iti
Bni(t)=(ni)(1−t)n−iti
Where n is the polynomial degree, i is the index, and t is the variable.
The simplest Bézier curve is the straight line from the point P0 to P1. Three control points
determine a quadratic Bezier curve and four control points determine cubic Bezier curve.
Where,
{pi: i=0, 1, 2….n} are the control points
k is the order of the polynomial segments of the B-spline curve. Order k means that
the curve is made up of piecewise polynomial segments of degree k - 1,
theNi,k(t) are the “normalized B-spline blending functions”. They are described by
the order k and by a non-decreasing sequence of real numbers normally called the “knot
sequence”.
What are the properties of B-spline Curve?
The following are the properties of B-spline curves:
The sum of the B-spline basis functions for any parameter value is 1.
Each basis function is positive or zero for all parameter values.
Each basis function has precisely one maximum value, except for k=1.
The maximum order of the curve is equal to the vertices that define the polygon.
The number of vertices defining the polygon and the degree of B-spline polynomial
are independent.
The local control over the curve surface is allowed by B-spline, since each of the
vertex affects the shape of the curve and where the associated basis function is nonzero.
The variation diminishing property is exhibited by the curve.
The shape of the defining polygon is followed.
By applying to the vertices of defining polygon, an affine transformation is applied
to the curve.
The curve line within the convex hull of its defining polygon.
What are polygon surfaces?
The collection of surfaces together represents a object. The 3D objects are divided into two
categories:
Boundary Representations (B-reps) – The 3D object is described as a set of
surfaces which separate the object from the environment.
Space–partitioning representations – The interior properties are described by
portioning the spatial region containing an object into a set of small, non-overlapping,
contiguous solids.
The set of surface polygons which enclose the object interior is 3D graphics object formed by
using boundary representation. This method is used by many graphics system. The surface
rendering and display of objects is simplified and speedier up as all the surfaces are described
with linear equations.
All the polygon surfaces stay common in the aspects of design and solid-modeling
applications as general indication of the surface structure is done quickly by wireframe
display. The shading patterns are interpolated across polygon surface by producing realistic
scenes.
Ax + By + Cz + D = 0
Where (x, y, z) is any point on the plane, and the coefficients A, B, C, and D are constants
describing the spatial properties of the plane. The values of A, B, C, and D can be obtained
by solving the set of three equations using the coordinate values of the non collinear points of
the plane. It is assumed that the three vertices of the plane are (x1, y1, z1), (x2, y2, z2) and
(x3, y3, z3).
The equation for the ratios A/D, B/D, and C/D is solved for obtaining the values of A, B, C,
and D.
(A/D) x1 + (B/D) y1 + (C/D) z1 = -1
To obtain the above equations in determinant form, apply Cramer’s rule to the above
equations.
A broad class of solids/ surfaces are represented by this method. Hidden surface removal
algorithms are used for rendering the polygonal mesh. The mesh is represented in three
different ways:
Explicit representation
Pointers to a vertex list
Pointers to an edge list
Advantages
Any object can be modelled by this mesh.
Represented as a collection of vertices.
Transformation of the mesh is easy.
Easily can be drawn on the computer screen.
Disadvantages
Curved surfaces can be describes approximately.
Some types of objects like hair or liquid is difficult to simulate.
UNIT-5
The hidden surface problems can be solved by two methods − Object-Space method and
Image-space method. In physical coordinate system, object-space method is
implemented and in case of screen coordinate system, image-space method is
implemented.
When a 3D object need to be displayed on the 2D screen, the parts of the screen that are
visible from the chosen viewing position is identified.
Across the surface, one pixel position is processed at a time. The colour that is to be
displayed on the frame buffer is determined by the closest (smallest z) surface, by
comparing the depth values for a pixel.
The closer polygons are override by using two buffers namely frame buffer and depth
buffer.
Depth buffer is used to store depth values for (x, y) position, as surfaces are processed
(0 ≤ depth ≤ 1).
The frame buffer is used to store the intensity value of color value at each position (x, y).
The z-coordinates are usually normalized to the range [0, 1]. The 0 value for z-coordinate
indicates back clipping pane and 1 value for z-coordinates indicates front clipping pane.
Algorithm
The Edge Table − It contains coordinate endpoints of each line in the scene, the inverse
slope of each line, and pointers into the polygon table to connect edges to surfaces.
The Polygon Table − It contains the plane coefficients, surface material properties, other
surface data, and may be pointers to the edge table.
The search for the surfaces that cross a given scan line can be facilitated by an active
list of edges. Only the edges that cross the scan line is stored by the active list. For
indicating whether the position along a scan line is inside or outside the surface, a flag is
set.
Each of the scan line is processes from left to right. The surface flag is turned on at left
intersection and at right intersection it is turned off.
This process is continues till all the subdivisions are analyzed to a single surface. This is
done by dividing the area into four equal parts. With a specified area boundary there are
four relationships:
Surrounding surface − One that completely encloses the area.
Overlapping surface − One that is partly inside and partly outside the area.
Inside surface − One that is completely inside the area.
Outside surface − One that is completely outside the area.
The surface visibility within an area is determined can be tested by stating in terms of
the above four classification. If any one of the following conditions is true, the
subdivisions of the area are not required.
All surfaces are outside surfaces with respect to the area.
Only one inside, overlapping or surrounding surface is in the area.
A surrounding surface obscures all other surfaces within the area boundaries.
What is Back-Face Detection?
The back faces of the polyhedron are identified on the basis of “inside-outside” tests. A
point (x, y, z) is "inside" a polygon surface with plane parameters A, B, C, and D if When
an inside point is along the line of sight to the surface, the polygon must be a back face.
This test is simplified by the normal vector N to the polygon surface having Cartesian
components (A, B, C). The polygon is back face if,
V.N > 0
If object descriptions are converted to projection coordinates and your viewing direction
is parallel to the viewing z-axis, then −
The polygon is back face if C < 0, for a right-handed viewing system with viewing
direction along the negative ZV axis. Hence, in general any polygon is named as back
face if the normal vector has the z component value.
C <= 0
The packages can use similar methods for employing a left-handed viewing system. The
polygon vertex coordinates are used for calculating A, B, C and D.
Normal vectors are available for back faces that are used for pointing away from the
viewing position and identified by C >= 0, along the Zv axis. All the back faces are easily
identified.
Transparency is provided by A-buffer method. The accumulated buffer is the key data
structure for the A-buffer method.
Diffuse reflection is the scattering of light that occurs when it reflects off a surface.
Unlike specular reflection, which is calculated based on the surface angle, diffuse
reflection is calculated based on the structure of the surface itself. For instance, a rough
surface will reflect light at many angles, depending on its bumps, divots, and grain. Even a
very smooth surface will produce diffuse reflection at many angles, due to the molecular
structure of the material.