Computer Graphics & Animation BCA 4th Sem Notes Based On VBSPU Syllabus PDF
Computer Graphics & Animation BCA 4th Sem Notes Based On VBSPU Syllabus PDF
Semester-4
BCA 404
CGA
(Computer Graphics & Animation)
Created By :D.P.Mishra
Unit – 1
Graphics Primitives
Computer graphics is an art of drawing pictures on computer screens with
the help of programming. It involves computations, creation, and
manipulation of data. In other words, we can say that computer graphics is
a rendering tool for the generation and manipulation of images.
Display Devices :
Refresh cathode ray tube –
The primary output device in a graphical system is the video monitor. The main
element of a video monitor is the Cathode Ray Tube (CRT), shown in the
following illustration.
The operation of CRT is very simple −
The electron gun emits a beam of electrons (cathode rays).
The electron beam passes through focusing and deflection systems that
direct it towards specified positions on the phosphor-coated screen.
When the beam hits the screen, the phosphor emits a small spot of light at
each position contacted by the electron beam.
It redraws the picture by directing the electron beam back over the same
screen points quickly.
Plasma display –
A plasma display is a computer video display in which each pixel on the
screen is illuminated by a tiny bit of plasma or charged gas, somewhat like
a tiny neon light. Plasma displays are thinner than cathode ray tube ( CRT )
displays and brighter than liquid crystal displays ( LCD). Plasma displays are
sometimes marketed as "thin-panel" displays and can be used to display
either analog video signals or display modes digital computer input.
Plotters –
A plotter is a computer hardware device much like a printer that is used for
printing vector graphics. Instead of toner, plotters use a pen, pencil,
marker, or another writing tool to draw multiple, continuous lines onto
paper rather than a series of dots like a traditional printer.
Printers –
Printer is an output device, which is used to print information on paper.
There are two types of printers −
Impact Printers
Non-Impact Printers
Impact Printers
Impact printers print the characters by striking them on the ribbon, which is then
pressed on the paper.
Character printers
Line printers
Character Printers
Character printers are the printers which print one character at a time.
These are further divided into two types:
In the market, one of the most popular printers is Dot Matrix Printer. These
printers are popular because of their ease of printing and economical price. Each
character printed is in the form of pattern of dots and head consists of a Matrix
of Pins of size (5*7, 7*9, 9*7 or 9*9) which come out to form a character which is
why it is called Dot Matrix Printer.
Advantages
Inexpensive
Widely Used
Other language characters can be printed
Disadvantages
Slow Speed
Poor Quality
Daisy Wheel
Head is lying on a wheel and pins corresponding to characters are like petals of
Daisy (flower) which is why it is called Daisy Wheel Printer. These printers are
generally used for word-processing in offices that require a few letters to be sent
here and there with very nice quality.
Advantages
Line Printers
Line printers are the printers which print one line at a time.
Drum Printer
Chain Printer
Drum Printer
This printer is like a drum in shape hence it is called drum printer. The surface of
the drum is divided into a number of tracks. Total tracks are equal to the size of
the paper, i.e. for a paper width of 132 characters, drum will have 132 tracks. A
character set is embossed on the track. Different character sets available in the
market are 48 character set, 64 and 96 characters set. One rotation of drum
prints one line. Drum printers are fast in speed and can print 300 to 2000 lines
per minute.
Advantages
Very expensive
Characters fonts cannot be changed
Chain Printer
In this printer, a chain of character sets is used, hence it is called Chain Printer. A
standard character set may have 48, 64, or 96 characters.
Advantages
Noisy
Non-impact Printers
Non-impact printers print the characters without using the ribbon. These printers
print a complete page at a time, thus they are also called as Page Printers.
These printers are of two types −
Laser Printers
Inkjet Printers
Characteristics of Non-impact Printers
These are non-impact page printers. They use laser lights to produce the dots
needed to form the characters to be printed on a page.
Advantages
Expensive
Cannot be used to produce multiple copies of a document in a single
printing
Inkjet Printers
They make less noise because no hammering is done and these have many styles
of printing modes available. Color printing is also possible. Some models of Inkjet
printers can produce multiple copies of printing also.
Advantages
Input Devices :
Keyboard –
Keyboard is the most common and very popular input device which helps
to input data to the computer. The layout of the keyboard is like that of
traditional typewriter, although there are some additional keys provided
for performing additional functions.
Keyboards are of two sizes 84 keys or 101/102 keys, but now keyboards with 104
keys or 108 keys are also available for Windows and Internet.
Trackball –
Track ball is an input device that is mostly used in notebook or laptop
computer, instead of a mouse. This is a ball which is half inserted and by
moving fingers on the ball, the pointer can be moved.
Since the whole device is not moved, a track ball requires less space than a
mouse. A track ball comes in various shapes like a ball, a button, or a square.
Joystick –
Joystick is also a pointing device, which is used to move the cursor position
on a monitor screen. It is a stick having a spherical ball at its both lower
and upper ends. The lower spherical ball moves in a socket. The joystick
can be moved in all four directions.
Mouse –
Mouse is the most popular pointing device. It is a very famous cursor-control
device having a small palm size box with a round ball at its base, which senses
the movement of the mouse and sends corresponding signals to the CPU when
the mouse buttons are pressed.
Generally, it has two buttons called the left and the right button and a wheel is
present between the buttons. A mouse can be used to control the position of the
cursor on the screen, but it cannot be used to enter text into the computer.
Advantages
Easy to use
Not very expensive
Moves the cursor faster than the arrow keys of the keyboard.
Light pen –
Light pen is a pointing device similar to a pen. It is used to select a
displayed menu item or draw pictures on the monitor screen. It consists of
a photocell and an optical system placed in a small tube.
When the tip of a light pen is moved over the monitor screen and the pen button
is pressed, its photocell sensing element detects the screen location and sends
the corresponding signal to the CPU.
Tablet –
A graphics tablet (also known as a digitizer, drawing tablet, drawing
pad, digital drawing tablet, pen tablet, or digital art board) is a
computer input device that enables a user to hand-draw images,
animations and graphics, with a special pen-like stylus, similar to the way a
person draws images with a pencil and paper. These tablets may also be
used to capture data or handwritten signatures. It can also be used to trace
an image from a piece of paper which is taped or otherwise secured to the
tablet surface. Capturing data in this way, by tracing or entering the corners
of linear poly-lines or shapes, is called digitizing.
Digitizing camera –
A digital camera uses an electronic image sensor to create still photographs
and record video. The optical system of a digital camera works like a
film camera, in which a typical lens and diaphragm are used to adjust
electronic image sensor lighting.
Unit – 2
Mathematics for Computer Graphics
Point representation –
vector, on the other
Here, a point is a position in a three-dimensional space. A vector
hand, usually means a direction (and some corresponding magnitude, or size) in
dimensional space. Vectors can be thought of as arrows pointing various
three-dimensional
directions. Three-dimensional
dimensional points and vectors are of course similar in that they
are both represented by the aforementioned
aforement tuple notation.
V=(x,y,z),
where (x, y, z) are again real numbers.
Matrix
A matrix is an entity composed of components arranged in rows and columns.
Mathematically, a matrix is represented as:
The rows and columns of a matrix determines the dimension of a matrix. A matrix
containing 2 rows and 3 columns is of dimension 2x3. Here is an example of
matrices with different dimensions:
Matrices
The use of matrices in computer graphics is widespread. Many industries like
architecture, cartoon, automotive that were formerly done by hand drawing now
are done routinely with the aid of computer graphics. Video gaming industry,
maybe the earliest industry to rely heavily on computer graphics, is now
representing rendered polygon in 3-3 Dimensions.
ions. In video gaming industry,
matrices are major mathematic tools to construct and manipulate a realistic
animation of a polygonal figure.
Addition
added to the
In vector addition, each vector component are individually added
corresponding component in the second vector. Vector addition is represented
mathematically as:
Scalar multiplication/division
Geometrically, multiplying a vector with a scalar streches the length of a vector.
Dividing a vector by a scalar has the opposite effect. To multiply a vector by a
scalar, simply multiply each component by the scalar. Note that multiplying
mult a
vector by a positive scalar only affects its magnitude. However, multiplying it by a
negative scalar affects its magnitude and reverses its direction. Scalar
multiplication is represented mathematically as:
The scalar product is also called the "inner product" or the "dot product" in some
mathematics texts.
Vector product of two vec
vector –
Unlike real numbers, vectors do not have a single multiplication operation. They
have two distinct type of product operations; the dot product and cross product.
The _dot product_produces a scalar and is mainly use to determine the angle
between vectors.
ors. Thecross product produces a vector perpendicular to the
multiplicand and multiplier vectors.
Dot Product
The Dot Product is a vector operation that calculates the angle between two
vectors. The dot product is calculated in two different ways.
Version 1
In the above equation, information about the angle between the vectors is
missing. However, the result from this equation can tell us the direction of each
vector. For example, if the dot product is equal to 1, it means that both vectors
have the same direction. If the dot product is 0, it means that both vectors are
1, it means that both
perpendicular on each other. Finally, if the dot product is -1,
vectors are heading in opposite directions.
Cross Product
Two vectors produces a plane. A cross product operation produces a vector that is
perpendicular to both vectors. The cross product of two vectors is calculated as
follows:
In a Simple Way - for generating any line segment we need intermediate points
and for calculating them we have can use a basic algorithm called DDA(Digital
differential analyzer) line generating algorithm.
DDA Algorithm:
Consider one point of the line as (X0,Y0) and the second point of the line as
(X1,Y1).
// calculate dx , dy
dx = X1 - X0;
dy = Y1 - Y0;
Bresenharm’s Algorithms –
Given coordinate of two points A(x1, y1) and B(x2, y2). The task to find all the
intermediate points required for drawing line AB on the computer screen of
pixels. Note that every pixel has integer coordinates.
Examples:
Input : A(0,0), B(4,4)
Output : (0,0), (1,1), (2,2), (3,3), (4,4)
Polygons
Polygons Representation –
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. This is quicker to display than a shaded model;
thus the polygons are a stage in computer animation. The polygon count refers to
the number of polygons being rendered per frame.
Filling polygons –
Polygon is an ordered list of vertices as shown in the following figure. For filling
polygons with particular colors, you need to determine the pixels falling on the
border of the polygon and those which fall inside the polygon.
Unit-3
Transformations
Transformation means changing some graphics into something else by applying
rules. We can have various types of transformations such as translation, scaling
up or down, rotation, shearing, etc. When a transformation takes place on a 2D
plane, it is called 2D transformation.
Transformations play an important role in computer graphics to reposition the
graphics on the screen and change their size or orientation.
Translation –
A translation moves an object to a different position on the screen. You can
translate a point in 2D by adding translation coordinate (tx, ty) to the original
coordinate (X, Y) to get the new coordinate (X’, Y’).
Scaling –
To change the size of an object, scaling transformation is used. In the scaling
process, you either expand or compress the dimensions of the object. Scaling can
be achieved by multiplying the original coordinates of the object with the scaling
factor to get the desired result.
The scaling process is shown in the following figure.
Rotation –
In rotation, we rotate the object at particular angle θ (theta) from its origin. From
the following figure, we can see that the point P(X, Y) is located at angle φ from
the horizontal X coordinate with distance r from the origin.
Let us suppose you want to rotate it at the angle θ. After rotating it to a new
location, you will get a new point P’ (X’, Y’).
Reflection –
Reflection is the mirror image of original object. In other words, we can say that it
is a rotation operation with 180°. In reflection transformation, the size of the
object does not change.
The following figures show reflections with respect to X and Y axes, and about the
origin respectively.
Metrics transformation –
Transformation matrix is a basic tool for transformation. A matrix with n x m
dimensions is multiplied with the coordinate of objects. Usually 3 x 3 or 4 x 4
matrices are used for transformation. For example, consider the following matrix
for various operation.
Routines –
In computer programming, routine and subroutine are general and nearly
synonymous terms for any sequence of code that is intended to be called
and used repeatedly during the executable of a program.
This makes the program shorter and easier to write (and also to read when
necessary).
Translation
Scaling
Shearing
Rotation
Reflection
The basic purpose of composing transformations is to gain efficiency by applying
a single composed transformation to a point, rather than applying a series of
transformation, one after another.
For example, to rotate an object about an arbitrary point (Xp, Yp), we have to
carry out three steps −
Unit-4
Segments
Segmentation means to divide the marketplace into parts, or segments, which
are definable, accessible, actionable, and profitable and have a growth potential.
In other words, a company would find it impossible to target the entire market,
because of time, cost and effort restrictions.
Segments Table –
It maps two-dimensional Logical address into one-dimensional Physical address.
It’s each table entry has:
Base Address: It contains the starting physical address where the segments
reside in memory.
Limit: It specifies the length of the segment.
Algorithm :
1. Read the name of the segment to be deleted.
2. If segment name is not valid, give error message : “Segment name is not a
valid name” and go to step 8.
3. If the segment is open, give error message : “Can’t delete an open
segment”and and go to step 8.
4. If size of segment is less than 0, no processing is required and go to step 8.
5. The segments which follow the deleted segment are shifted by its size.
6. Recover deleted space by resetting index of next free instruction.
7. The starting position of shifted segments is adjusted by subtracting the size
of deleted segment from it.
8. Stop.
Renaming a Segment : This is done to achieve Double Buffering i.e. the idea of
storing two images, one to show and other to create, alter and for animation.
Algorithm :
1. If both old and new segment names are not valid, give error message
: “Segment names are not valid names” and go to step 6.
2. If any of two segments is open, give error message : “Segments are still
open”andand go to step 6.
3. If new segment name givegivenn already exists in the display list, give error
message : “Segment name already exists” and go to step 6.
4. The old segment table entry are copied into new position.
5. Delete the old segment.
6. Stop.
Unit-5
Animation
Introduction to Animation –
Animation means giving life to any object in computer graphics. It has the
power of injecting energy and emotions into the most seemingly inanimate
objects. Computer-assisted animation and computer-generated animation
are two categories of computer animation. It can be presented via film or
video.
The basic idea behind animation is to play back the recorded images at the
rates fast enough to fool the human eye into interpreting them as
continuous motion.
Principles of Animation –
1. SQUASH AND STRETCH
This action gives the illusion of weight and volume to a character as it moves. Also
squash and stretch is useful in animating dialogue and doing facial expressions.
How extreme the use of squash and stretch is, depends on what is required in
animating the scene. Usually it's broader in a short style of picture and subtler in a
feature. It is used in all forms of character animation from a bouncing ball to the
body weight of a person walking. This is the most important element you will be
required to master and will be used often.
2. ANTICIPATION
This movement prepares the audience for a major action the character is about to
perform, such as, starting to run, jump or change expression. A dancer does not
just leap off the floor. A backwards motion occurs before the forward action is
executed. The backward motion is the anticipation. A comic effect can be done by
not using anticipation after a series of gags that used anticipation. Almost all real
action has major or minor anticipation such as a pitcher's wind-up or a golfers'
back swing. Feature animation is often less broad than short animation unless a
3. STAGING
A pose or action should clearly communicate to the audience the attitude, mood,
reaction or idea of the character as it relates to the story and continuity of the
story line. The effective use of long, medium, or close up shots, as well as camera
angles also helps in telling the story. There is a limited amount of time in a film, so
each sequence, scene and frame of film must relate to the overall story. Do not
confuse the audience with too many actions at once. Use one action clearly stated
to get the idea across, unless you are animating a scene that is to depict clutter
and confusion. Staging directs the audience's attention to the story or idea being
told. Care must be taken in background design so it isn't obscuring the animation
or competing with it due to excess detail behind the animation. Background and
animation should work together as a pictorial unit in a scene.
starts to dance, her dress does not begin to move with her immediately but
catches up a few frames later. Long hair and animal tail will also be handled in the
same manner. Timing becomes critical to the effectiveness of drag and the
overlapping action.
8. SECONDARY ACTION
This action adds to and enriches the main action and adds more dimension to the
character animation, supplementing and/or re-enforcing the main action.
Example: A character is angrily walking toward another character. The walk is
forceful, aggressive, and forward leaning. The leg action is just short of a stomping
walk. The secondary action is a few strong gestures of the arms working with the
walk. Also, the possibility of dialogue being delivered at the same time with tilts
and turns of the head to accentuate the walk and dialogue, but not so much as to
distract from the walk action. All of these actions should work together in support
of one another. Think of the walk as the primary action and arm swings, head
bounce and all other actions of the body as secondary or supporting action.
9. TIMING
Expertise in timing comes best with experience and personal experimentation,
using the trial and error method in refining technique. The basics are: more
drawings between poses slow and smooth the action. Fewer drawings make the
action faster and crisper. A variety of slow and fast timing within a scene adds
texture and interest to the movement. Most animation is done on twos (one
10. EXAGGERATION
Exaggeration is not extreme distortion of a drawing or extremely broad, violent
action all the time. Its like a caricature of facial features, expressions, poses,
attitudes and actions. Action traced from live action film can be accurate, but stiff
and mechanical. In feature animation, a character must move more broadly to
look natural. The same is true of facial expressions, but the action should not be
as broad as in a short cartoon style. Exaggeration in a walk or an eye movement
or even a head turn will give your film more appeal. Use good taste and common
sense to keep from becoming too theatrical and excessively animated.
12. APPEAL
A live performer has charisma. An animated character has appeal. Appealing
animation does not mean just being cute and cuddly. All characters have to have
appeal whether they are heroic, villainous, comic or cute. Appeal, as you will use
it, includes an easy to read design, clear drawing, and personality development
that will capture and involve the audience's interest. Early cartoons were basically
a series of gags strung together on a main theme. Over the years, the artists have
learned that to produce a feature there was a need for story continuity, character
Types of Animation –
1. Traditional animation
2. 2D Vector-based animation
3. 3D computer animation
4. Motion graphics
5. Stop motion
Traditional animation
2D Vector-based animation
3D computer animation
Motion graphics
The skills for motion graphics don’t necessarily translate to the other types of
animation, since they don’t require knowledge of body mechanics or acting, but
they do have some attributes in common such as understanding good
composition and the all important camera motion.
The process of creating Motion Graphics depends on the programs used, since
video editing softwares often have different UI or settings, but the idea is the
same. Motion Graphics usually involves animating images, texts or video clips
using key framing that are tweened to make a smooth motion between frames.
Stop motion
Stop motion is done by taking a photo of an object, and then moving it just a little
bit and taking another photo. The process is repeated and when the photos are
played back one after another they give the illusion of movement. This is similar
to traditional animation but it uses real life materials instead of drawings.
example, in animating a bicycle, the wheels will rotate in their own coordinate
system and the animator doesn't have to worry about this detail. Actors can
communicate with other actors be sending messages and so can synchronize their
movements. This is similar to the behavior of objects in object-oriented
languages.
Procedural –
Procedures are used that define movement over time. These might be procedures
that use the laws of physics (Physically - based modeling) or animator generated
methods. An example is a motion that is the result of some other action (this is
called a "secondary action"), for example throwing a ball which hits another
object and causes the second object to move.
Representational –
This technique allows an object to change its shape during the animation. There
are three subcategories to this. The first is the animation of articulated objects,
i.e., complex objects composed of connected rigid segments. The second is soft
object animation used for deforming and animating the deformation of objects,
e.g. skin over a body or facial muscles. The third is morphing which is the changing
of one shape into another quite different shape. This can be done in two or three
dimensions.
Stochastic –
This uses stochastic processes to control groups of objects, such as in particle
systems. Examples are fireworks, fire, water falls, etc.