Computer Graphics Imp Ques

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

UNIT - 3

What are 3D Computer Graphics?


In addition to two coordinates X and Y, an extra coordinate Z is added. 3D graphics
techniques and applications are very fundamental for entertainment, games, and computer-
aided design industries.

Every personal computer has 3D graphics components. They are increasingly being used by
other applications.

What is Parallel Projection?


The z-coordinate is discarded by the Parallel projection and the parallel lines from each
vertex on to the object and till it intersect the view plane, the objects are extended. A
direction of projection is specified instead of center projection.

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

What is Oblique Projection?


The object is better viewed than orthographic projection in oblique 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 −

What are Isometric Projections?


The projections that show more than one side of the object are called as axonometric
orthographic projections. Isometric projection is the most common projection where the
projection plane intersects each coordinate axis in the model coordinate system at an equal
distance. The isometric projection is depicted below:
What is Perspective Projection?
There is finite distance between center of projection to project plane and the object size varies
inversely with the distance that seems to be more realistic.

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:)

Rotation about various axes is depicted below:


What is Scaling?
Scaling transformation helps in changing the size of the object. The dimensions of the object
are either expanded or compressed in scaling process. The original coordinates of the object
are multiplied with a scaling factor for obtaining the desired result. The effect of 3D scaling
is depicted below:
Three coordinates are used in 3D scaling operation. It is assumed that the original coordinates
are (X, Y, Z), scaling factors are  espectively, and the produced coordinates are
(X’, Y’, Z’).

This is represented mathematically as:

=[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.

For getting a new coordinate P, it is sheared and represented in 3D matrix as follows:


What is Transformation Matrices?
The basic tool for transformation is transformation matrix. The n and m dimensions of the
matrix are multiplied with the coordinate of the objects. 3 x 3 or 4 x 4 matrices are used for
transformation. For various operations, the following matrix is used.
UNIT - 4
What are curves in computer graphics?
Different types of objects are drawn on the screen. An object can be drawn by using curves
many times.
What are the different types of Curves?
Curves are classified into three categories – explicit, implicit and parametric curves.
Implicit Curves

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:

P(t) = f(t), g(t) or P(t) = x(t), y(t)


The functions f and g become the (x, y) coordinates of any point on the curve, and the points
are obtained when the parameter t is varied over a certain interval [a, b], normally [0, 1].
What are Bezier Curves?
French engineer Pierre Bézier has discovered Bezier curve. The curves are generated under
the control of other points. Curve is generated by using approximate tangents.
Mathematically the curve is represented as:

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.

What are the properties of Bezier Curves?


The following are some of the properties of Bezier curve:
 It takes the shape of the control polygon consisting of segments that join the control
points.
 They pass through the first and last control points.
 The convex hull of the control points contains these curves.
 The degree of the polynomial defining the curve segment is one less that the number
of defining polygon point. Therefore, for 4 control points, the degree of the polynomial is
3, i.e. cubic polynomial.
 The shape of the defining polygon is usually followed by the Bezier curve.
 The vector that determines the first and last segments is the same as that of the
direction of the tangent vector.
 The convex hull property for a Bezier curve ensures that the polynomial smoothly
follows the control points.
 No straight line intersects a Bezier curve more times than it intersects its control
polygon.
 Under an affine transformation, they are very invariant.
 Global control is exhibited by Bezier curves. In the sense that the shape of the whole
curve is altered by the movement of a control point.
 A Bezier curve can be subdivided at a point t=t0 into two Bezier segments which
join together at the point corresponding to the parameter value t=t0.
What are B-Spline Curves?
Limited flexibility is the basic function of the Bernstein of the Bezier curve.
 The order of the resulting polynomial defines the curve and the order is fixed by the
number of specified polygon vertices.
 The second limiting characteristic is that the value of the blending function is
nonzero for all parameter values over the entire curve.
The B-spline basis contains the Bernstein basis as the special case. The B-spline basis is non-
global.

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.

What are Polygon Tables?


The set of vertex coordinates and the associated attributes specify the surface. There are five
vertices from v1 to v5.
 Each vertex stores x, y, and z coordinate information which is represented in the
table as v1: x1, y1, z1.
 The edge information of the polygon is stored using the Edge table. edge E1 lies
between vertex v1 and v2 which is represented in the table as E1: v1, v2.
 Number of surfaces present in the polygon is stored in the polygon surface table.
The edges E1, E2 and E3 are covered by surface S1 which is represented in the polygon
surface table as S1: E1, E2, and E3.
What are Plane Equations?
The plane surface equation is expressed as:

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

(A/D) x2 + (B/D) y2 + (C/D) z2 = -1

(A/D) x3 + (B/D) y3 + (C/D) z3 = -1

To obtain the above equations in determinant form, apply Cramer’s rule to the above
equations.

It is said that, for any point (x, y, z) with parameters A, B, C, and D,

•Ax + By + Cz + D ≠ 0 implies that the point is not on the plane.

•Ax + By + Cz + D < 0 implies that the point is inside the surface.

•Ax + By + Cz + D > 0 implies that the point is outside the surface.


What are Polygon Meshes?
A set of polygonal and line segments approximate 3D surfaces and solids. Such surfaces are
known as polygonal meshes. In such meshes each of the edge is shared by at most two
polygons. The skin of the project is a combination of set of polygons or faces.

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

What is visible Surface detection?


When a picture that contains the non-transparent objects and surfaces are viewed, the
objects that are behind the objects that are closer cannot be viewed. To obtain a realistic
screen image, these hidden surfaces need to be removed. This process of identification
and removal of these surfaces is known as Hidden-surface problem.

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.

What is Depth Buffer (Z-Buffer) Method?


It is an image-space approach developed by Cutmull. The Z-depth of each surface is
tested for determining the closest surface.

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

Step-1 – Buffer values are set as −


Depthbuffer (x, y) = 0

Framebuffer (x, y) = background color

Step-2 – Each polygon is processed one at a time.


For each projected (x, y) pixel position of a polygon, calculate depth z.

If Z > depthbuffer (x, y)

Compute surface color,

set depthbuffer (x, y) = z,

framebuffer (x, y) = surfacecolor (x, y)


Advantages
 Implementation is easy.
 The problems related to speed is reduced once it is implemented in the hardware.
 It processes one object at a time.
Disadvantages
 Large memory is required.
 It is a time consuming process.
What is Scan-Line Method?
The visible surface is identified by the image-space method. All the polygons
intersecting need to be grouped and processed for a particular scan-line before
processing the next scan-line. This is done by maintaining two tables’ edge table and
polygon table.

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.

What is Area-Subdivision Method?


The view areas are located by representing a part or single surface. The total viewing
area is divided into smaller and smaller rectangles until each of the small area is
projected as a part of single surface.

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 −

V = (0, 0, Vz) and V.N = VZC

Hence only C of the component of the normal vector N is considered.

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.

What is A-Buffer Method?


The extension of depth-buffer method is A-Buffer method. For rendering the Renders
Everything You Ever Saw (REYES), the visibility detection method developed is A-buffer
method.

Transparency is provided by A-buffer method. The accumulated buffer is the key data
structure for the A-buffer method.

Each position in the A-buffer has two fields −


 Depth field − It stores a positive or negative real number
 Intensity field − It stores surface-intensity information or a pointer value
If depth >= 0, the depth of the single surface corresponding to the pixel area stores the
number. The A-buffer includes:
 RGB intensity components
 Opacity Parameter
 Depth
 Percent of area coverage
 Surface identifier

What is Diffuse reflection ?

 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.

You might also like