Computer Graphics Syllabus Overview
Computer Graphics Syllabus Overview
COMPUTER GRAPHICS
SYLLABUS
Line Clipping
Cohen-Sutherland line clipping
Algorithm:-
Step 1: Read two end points of the line say p1(x1,y1) and p2(x2,y2).
P1(x1,y1) P2(x2,y2)
Step 2: Read two corner (left-bottom and right-top) of the window, say
(Xwmin,YWmin) and (Xwmax,YWmax). (Xwmax,Ywmax)
(Xwmin,Ywmin)
Step 3: Assign the region code for two end points p1 and p2 are follows:
b) If any one of the point p1 or p2 is 0000(region code) and other root 0000. Then
find the intersection point p1’ or p2’ with the boundary edge of the clipping
window.
p1 P2’ p2
Step 6: Reject the line outside of the clipping window and draw the remaining line
segment.
Step 7: Stop.
COLOURING
Objective:
Facilitate creating geometry.
Display images.
Basics:
Assign different colors for wireframe, surface or solid entities.
Main ingredient of Shading – Color & Texture.
Achromatic colors – Black (0), white (1) & various levels of gray
– Only attribute is intensity
Chromatic colors – Multicolor
COLOR MODELS
Color Model
A mathematical system for representing color
The human eye combines 3 primary colors (using the 3
different types of cones) to discern all possible colors.
Colors are just different light frequencies
red – 700nm wavelength
green – 546.1 nm wavelength
blue – 435.8 nm wavelength
Higher frequencies are cooler colors
8
Color Models
Primary Colors
Primary colors of light are additive
Primary colors are red, green, and blue
Combining red + green + blue yields white
10
INTRODUCTION TO COLOR MODELLING
CMY YIQ HSL HSV
RGB
Gamma
correction
Color lookup
table values
RGB Color model
Source: www.mitsubishi.com
Active displays, such as computer monitors and television sets, emit combinations of red, green and
blue light. This is an additive color model
12
CMY Color model
Source: www.hp.com
Passive displays, such as color inkjet printers, absorb light instead of emitting it. Combinations of
cyan, magenta and yellow inks are used. This is a subtractive color model.
13
RGB Vs CMY
RGB color cube
16
RGB and CMY Color Cubes
17
RGB AND CMY COLOR CUBES
Light Intensity
• RGB is an additive color model that is used for light-emitting devices, e.g., CRT
displays.
• CMY is a subtractive model that is used often for printers.
• Two common color models in imaging are RGB and CMY, two common color
models in video are YUV and YIQ.
• YUV uses properties of the human eye to prioritize information. Y is the black
and white (luminance) image, U and V are the color difference (chrominance)
images.
• YIQ uses similar idea.
• Besides the hardware-oriented color models (i.e., RGB, CMY, YUV, YIQ), HSB
(Hue, Saturation, and Brightness) and HLS (Hue, Lightness, and Saturation)
are also commonly used.
Yiq colour descripton.
Example for yiq photo which is used in
televisions
HSV MODEL
• HSV is another way to describe color with 3 parameters. RGB is the way computer screens
work, but not very intuitive. HSV is more intuitive, but you need to convert it to RGB before
you can draw a pixel with it. The nicest application of this color model is that you can easily
create rainbow gradients or change the color, lightness or saturation of an image with this
color model.
•
HSV color obviously has the parameters H, S and V, or Hue, Saturation and Lightness Value.
Hue indicates the color sensation of the light, in other words if the color is red, yellow, green,
cyan, blue, magenta, ... This representation looks almost the same as the visible spectrum of
light, except on the right is now the color magenta (the combination of red and blue), instead
of violet (light with a frequency higher than blue):
• Hue works circular, so it can be represented on a circle instead. A hue of 360° looks the same
again as a hue of 0°.
Saturation indicates the degree to which the hue differs from a neutral gray.
The values run from 0%, which is no color, to 100%, which is the fullest
saturation of a given hue at a given percentage of illumination. The more the
spectrum of the light is concentrated around one wavelength, the more
saturated the color will be.
Lightness indicates the illumination of the color, at 0% the color is completely
black, at 50% the color is pure, and at 100% it becomes white. In HSL color, a
color with maximum lightness (L=255) is always white, no matter what the hue
or saturation components are. Lightness is defined as (maxColor+minColor)/2
where maxColoris the R, G or B component with the maximum value, and
minColor the one with the minimum value
HSL MODEL
HSL is another way to describe color with 3 parameters. RGB is the way computer screens work,
but not very intuitive. HSL is more intuitive, but you need to convert it to RGB before you can draw
a pixel with it. The nicest application of this color model is that you can easily create rainbow
gradients or change the color, lightness or saturation of an image with this color model.
HSL color obviously has the parameters H, S and L, or Hue, Saturation and Lightness.
Hue indicates the color sensation of the light, in other words if the color is red, yellow, green, cyan,
blue, magenta, ... This representation looks almost the same as the visible spectrum of light, except
on the right is now the color magenta (the combination of red and blue), instead of violet (light with
a frequency higher than blue):
Hue works circular, so it can be represented on a circle instead. A hue of 360° looks the same again
as a hue of 0°.
Hue colour patterns
Graph showing relation between
(saturation,lightness,hue)
SHADING
INTRODUCTION:
Shading is referred to as the implementation of the illumination
model at the pixel points or polygon surfaces of the graphics objects.
Shading model is used to compute the intensities and colors to
display the surface.
The shading model has two primary ingredients:
i) Properties of the surface
ii) Properties of the illumination falling on it.
Shaded color images convey shape information that cannot be
represented in line drawings.
SHADING………. contd
Shaded images can also convey features other than shape such as
surface finish or material type.
Defects – Noise, the spot size of deflection beam and fidelity of the
display.
Noise occurs in delivery of intensity information from bit map of the
display to its screen or in the deflection system that steers the beam
over the pixel array.
Smaller spot size clear array of dots, Larger spot size affects the
sharpness of image.
Fidelity of display is a measure of how the light energy calculated by a
shading model is reproduced on the screen.
SHADING………. contd
The principal surface property is its reflectance, which determines
how much of the incident light is reflected.
If a surface has different reflectance for the light of different
wavelengths, it will appear to be colored.
An object illumination is also significant in computing intensity.
The scene may have to save illumination that is uniform from all
direction, called diffuse illumination.
Shading models determine the shade of a point on the surface of an
object in terms of a number of attributes.
The shading Mode can be decomposed into three parts, a contribution
from diffuse illumination, the contribution for one or more specific
light sources and a transparency effect.
SHADING………. contd
Each of these effects contributes to shading term E which is summed
to find the total energy coming from a point on an object.
This is the energy a display should generate to present a realistic
image of the object.
The energy comes not from a point on the surface but a small area
around the point.
SHADING………. contd
The simplest form of shading considers only diffuse illumination:
Epd=Rp Id
Similarly, the intensity at the right intersection of this scan line (point
5) is interpolated from the intensity values at vertices 2 and 3.
Once these bounding intensities are established for a scan line, an
interior point (such as point P in the previous fig) is interpolated from
the bounding intensities at point 4 and 5 as
SHADING………. contd
GOURAUD SHADING
Incremental calculations are used to obtain successive edge intensity
values between scan lines and to obtain successive intensities along a
scan line as shown in fig:
SHADING………. contd
GOURAUD SHADING
If the intensity at edge position (x, y) is interpolated as
Then we can obtain the intensity along this edge for the next scan
line, Y-1 as
Major company
uses CATIA
Small supplier
Small supplier uses Solid Edge
uses AutoCAD
The Problem
CATIA Pro/Engineer
Data Exchange Standards
IGES
PDES ANSI (USA) Product Data Structure
PDDI
• Chrysler
• all suppliers must use CATIA
• General Motors
• all suppliers must use Unigraphics
A Better Solution
Neutral Interface
▪
– Contains a single record which specifies the number of
records in each of the four preceding section for
checking purpose.
Problems with IGES
ISO standard.
Logical Application –
Generic
Layer specific
entities
entities
Physical
File format and data
Layer
structure
STEP.......contd
IMPLEMENTATION:
STEP is built on data exchange language called EXPRESS (describes a model
and the file format that stores it)
EXPRESS stores both the model data and semantics.
Basic unit is the Entity – collection of data, constraints and operations.
The operations work on data. A set of entities make up a model.
The relationship between model entities are carried over and maintained by
STEP, from the native CAD database of the model.
EXPRESS follows Object Oriented paradigm.
It first defines an object schema and then defines instances of such object.
Example: Circle schema as its centre and radius. The centre is a point and
the radius is real number. Point schema defined as x, y and z coordinates.
STEP.......contd
IMPLEMENTATION:
Application Protocols built into a common data model.
APs contains not only the definitions of typical geometry and drafting
elements, but also of data types and processes for specific industries such as
aerospace, shipbuilding, electronics and maintenance.
Ex: AP203 – solid models, AP210 – electronics
The flexibility and growing availability of commercial Web/XML tools with
STEP greatly increases the sharing of information across discipline, with
universal access.
XML (eXtensible Markup Language) is a standard format for data
representation. It complements XHTML which is a standard for data
presentation.
XML defines data schema in a DTD (document type definition) file.
DXF
Data eXchange Format is a de facto standard and is an AutoCAD format,
which enables data interoperability.
AutoCAD publishes, supports and maintains it.
Translates drawing files and cannot translate part files.
Two formats: ASCII and Binary.
FILE STRUCTURE
Header section – System settings (dimensions style and layers), General
information about the drawing. Each parameter has a variable name and an
associated value.
Classes section – Holds the information for application-defined classes whose
instances appear in the BLOCKS, ENTITIES, and OBJECTS sections of the
database. Generally does not provide sufficient information to allow
interoperability with other programs.
DXF……… contd
Tables section – Line styles and user-defined coordinate systems; Application
ID (APPID) table, Block Record (BLOCK_RECORD) table, Dimension Style
(DIMSTYLE) table, Layer (LAYER) table, Linetype (LTYPE) table, Text style
(STYLE) table, User Coordinate System (UCS) table, View (VIEW) table,
Viewport configuration (VPORT) table
Blocks section – Drawing blocks (instances); This section contains Block
Definition entities describing the entities comprising each Block in the
drawing.
Entities section – Entity definition and data; This section contains the drawing
entities, including any Block References.
Objects section - Contains the data that apply to nongraphical objects, used
by AutoLISP, and ObjectARX applications.
Thumbnailimage section - Contains the preview image for the DXF file.
Other Standards
• Standards
• Joint Photographic Expert Group (JPEG)
• Proprietary
• Graphics Interchange Format (GIF)
• Windows bitmap format (BMP)
• Zsoft file format (PCX)
• Tagged Image File Format (TIFF/TIF)
• Targa file format (TGA)
Web and Internet Standards
• DXF
• de facto standard published by AutoDesk (AutoCAD)
• STL
• 3D file format used as input for Stereolithography
• SAT
• solid model file format used by ACIS-based CAD systems
ANIMATION
• ANIMATION TECHNIQUES
• ANIMATION TYPES
• SIMULATION TECHNIQUES
ANIMATION
▪ Animation is the rapid display of a sequence of images of artwork or model
positions or frames to create an illusion of movement.
▪ Animation starts with independent pictures and puts them together to form the
illusion of continuous motion.
(or)
▪ It is the process of making the illusion of motion and change utilizing the rapid
display of a sequence of static images that minimally differ from each other.
▪ A simulation of movement created by displaying a series of pictures, or frames.
▪ These pictures can be hand drawn, computer generated, or pictures of 3D
objects.
Types of Animation
Bitmap animation
• In bitmap animation, the frame bitmaps (every pixel of each
frame) are first loaded into the system memory and are then
rapidly displayed on the screen from the memory.
• Bitmap animation takes huge amount of memory since all pixel
information are to be first loaded into memory.
Vector animation
• In vector animation, the images for each frame are calculated and
generated by the computer.
• Vector animation takes up lesser memory space, but more time is
generally needed to create the images than to load them from
memory or disk.
• However, when delivering on the net where file size is a major
concern, vector animation is a better choice for simple animation.
ANIMATION SOFTWARES
TECHNIQUES OF ANIMATION
HAND DRAWN ANIMATION
▪ Traditional Animation:
▪ This is one of the oldest forms of animation in film.
▪ It’s sometimes called cel animation.
▪ Traditional animation is an animation technique where each frame is drawn
by hand.
▪ As mentioned above, in traditional animation, objects are drawn on celluloid
transparent paper.
▪ In order to create the animated sequence, the animator must draw every
frame.
▪ It’s the same mechanism as a flipbook, just on a grander scale.
▪ The technique was the dominant form of animation in cinema until the rise of
computer animation.
3-D ANIMATION
▪ Involves 3 steps:
– Modeling
– Animation
– Rendering
▪ Modeling:
▪ 3D modeling describes the shape of an object
▪ process of creating 3-D objects and scenes.
▪ Can involve drawing various views of an object (top, side, cross-section)
by setting points on a grid.
▪ The two most common sources of 3D models are those created by
engineer using 3D modeling tool, and those scanned into a computer
from real-world objects.
• Animation:
• Defining the object's motion and how the lighting and views change during the
animation.
• Shadow, shading, ray tracing
• Rendering:
• Process of converting models and image using special computer programs.
• Give the final appearance to the models
• Example:
• colors
• surface textures
• degrees of transparency
MOTION GRAPHICS
▪ Motion Graphics are pieces are digital graphics that create the
illusion of motion usually for ads, title sequences in films, but
ultimately exist to communicate something to the viewer.
▪ They’re often combined with sound for multimedia projects.
▪ They’re a type of animation used mostly in business, usually with
text as a main player.
(or)
▪ Motion graphics are simply flat-based images or 3D objects that are
given the illusion of motion, accompanied with music or sound
effects.
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.
▪ But the basic mechanics are similar to the traditional style like a flipbook.
▪ However, instead of drawings, stop motion adjusts physical objects in each frame. If
moved in small increments, captured one frame at a time, the illusion of motion is
produced.
▪ Stop Motion encompasses
– Claymation
– Pixelation
– object-motion
– cutout animation, and more.
Animation -12 Principals
• Squash and Stretch
• Timing and Motion
• Anticipation
• Staging
• Follow Through and Overlapping Action
• Straight Ahead Action and Pose-To-Pose Action
• Slow In and Out
• Arcs
• Exaggeration
• Secondary Action
• Appeal
• Strong Drawing or Solid Drawing
ANIMATION SPECIAL EFFECTS
▪ Morphing:
▪ Transforms one image into another through a seamless
transition .
▪ Selects sets of corresponding points on each of the
images e.g. the eyes, lips, ears and outline of the head.
▪ Based on these points, pixels are rearranged to
transition the original image into the second via a series
of intervening images.
Warping:
allows manipulation of a single image
e.g. can stretch facial feature to change a
frown into a smile
Kinematics – Simulation on Human Motion
Study of movement & motion of structures that have joints. (example: a walking man,
dinosaur)
Complex process; calculate the position, rotation, velocity of joints.
Inverse Kinematics:
• Process that links object (eg: hands to arm) to define relationship and limit
• Kinematic constraints-
• example: elbow cannot bend backwards.
• Kinematic chain
• example: if upper arm moves, lower arm and hand must move with it
• Useful for animating jointed structures, especially limbs of human or animal figures
SIMULATION