Chapter 4
Variation in Characteristics of Computer Graphics:
3 categories-
1. User control over image
a. Passive
No control
b. Interactive
User may interact with graphics and programs generating them
2. The way of Image Generation
a. Vector Graphics
Image consists of a number of lines
b. Raster Graphics
Involves manipulation of color and picture element/pixels in a matrix
making up the image
3. Manipulation of image
a. Image-space Graphics
Image directly manipulated to create a picture
Example: Microsoft Paintbrush
b. Object-space Graphics
Image representation of a separate model
Separate model is manipulated
CAD :
Application of interactive object-space graphics
Involves both vector and raster graphics
Vector graphics used in-
o Line drawing and diagrams
o Used in production of wire-frame images for 3-d models
Raster hardware used in-
o Display of line images
o Extensively for surface and solid model display
o High realistic display with rendering
Computer Graphics Hardware:
1. Display Devices
Display image to the user
2. Plotting Device
Generates hard copy
Raster-Scan CRT:
Historically , display devices were calligraphic or vector displays
Now all display devices are visual display units of raster-scan type
Cheap semi-conductors made raster devices popular
Principle:
Intensity of each pixel in a rectangular matrix that covers the screen is controlled
Matrix is displayed on screen surface as a raster
o As a succession of equidistant linear arrays of pixels known as scan lines like
television
o CRT display is most popular kind of it
Display receives information about the status of pixels from some sort of display memory
o Common method is to store a matrix of pixel intensity values in digital frame
buffer
Monochrome Images:
Each pixel represented by a single bit (Black or white)
Greyscale Images:
Additional bits per pixel allocated
4 bits per pixel allow 2^4=16 colors or shades of grey
16 colors satisfactory to distinguish different elements on the screen
For smoothly shaded image, 256 colors are deployed or 8 bits per pixel
High performance graphics devices use 24 bits per pixel
o To represent intensity of separate red, green and blue guns of CRT
Modern displays have resolution grom 640 x 480 to 1800 x 1600 pixels or higher
o Typically 8 or 24 bit devices
Saturation:
Indicates the proportion of white in color
Royal blue-higly saturated
Sky blue- unsaturated
Hue:
Distinguishes between primary and mixed colors
Differentiates yellow, blue and green
Lightness/Intensity:
Describes the overall level of brightness of the color
Zero intensity corresponds to black
Brightness:
Refers to the intensity of a light emitting object
Saturation, hue and intensity can help specify the level of additive primary colors
Other Raster-type Displays:
LCD:
Structure:
Use crossed polarizers sandwiching a very thin liquid crystal layer between layers onto
which thin grid wires are aligned- one horizontally and another vertically
Liquid crystal rotates polarized light through 90 degrees
o So that it can pass through polarizers
When horizontal and vertical grids have electric potential applied, resultant field
energizes the crystal at the position of the crossed wires
o It no longer rotates the polarized lights
Light is absorbed
A dark spot is shown on the display
Complete display is formed in raster-scan fashion, row by row
Effect of energizing crystal gives display persistence
Advantage:
Good for portable personal computers
o Thin and flat
Low power consumption
Disadvantage:
Display persistence relatively long
o View of any dynamic change might be difficult
Contrast provision is limited
Ability to display color is limited
Active Matrix Display:
Offer substantial improvement
LCD panels with transistors at each grid point on the display
Allow crystals to change state quickly
Provide a memory of the state of grid point so that it may be held on continually to
increase its brightness
Crystals can be died to provide color
Plasma Panel:
Pixel is formed by a neon-tube type action on an inert gas sandwiched between two glass panels
High contrast
Poor color capability
Electroluminescent Display:
Matrix grid of wires used to address a layer of electroluminescent material with a high
electric field
Works as alternative to LCD
Projection CRT:
Allow large screen images
Project light from 3 very bright monochrome displays with red, green and blue filters
Disadvantage of Raster Devices:
Poor resolution
Discrete nature of display
o Slanting lines and curves are not enough smooth
o Show staircasing effect
o Can be solved by antialiasing
Antialiasing:
The technique that smooths sharp edges by modifying the intensity of pixels at steps, is known as
antialiasing.
Example: If a line is considered to be 1 pixel wide, then pixel intensity might be set to be
proportional to the area of the pixel covered by the line.
Hard Copy Devices:
1. Vector Plotters
2. Raster Plotters
Hard Copy:
For copy of image on permenant or semi-permanent media such as paper, photographic
emulsion or draughting film
Vector Plotter:
Similar to vector displays
o Produce image by plotting a sequence of straight lines by moving pen relative to
paper/drawing and vice versa
Pen plotters allow for multiple pen types
o To give different line thickness or colors
Advantage:
High quality output
Address as many as 40 points per mm
Disadvantage:
Slow
Does not easily allow for polygon areas to be filled with solid color or grey scale
Raster Plotter:
Several forms available
Main variation in the method of printing the points onto the media
Variations of Raster Plotter:
1. Dot Matrix Device:
Uses impact of needles on inked ribbons to achieve resolution of a few hundred
points per line
2. Electrostatic & Laser based Xerogprahic Device:
Capable of producing 16-60 points per millimtere
Capable of plotting upto A0 size and larger
Electrostatic plotters for full-color plot
Laser printers for large drawings
Ink-jet Printer:
Ink of different color is sprayed from tiny jets in a print head traversing across the paper
Thermal Devices:
Transfer wax,ink or dye
o Done by selective heating of fine printing pins
Resolution 75-150 points per mm
2-D Computer Graphics:
Model of design represented using real valued numbers in two or three dimensions
Representation is drawn on VDU screen
Display is defined by integer numerical coordinates
Aim of CAD is to perform the transformation from design model to display efficiently
Steps of Image Generation for 2-dimensional Model:
Converting the geometric representation of the model to a form that may be manipulated
easily by graphics routines
o Converting curves and text to a series of lines
Mapping or transforming the lines from the model coordinate system to the screen
coordinate system
Selecting the lines that would be visible in the screen display area and discarding the rest
o Known as clipping step
Instructing display device to draw the visible lines
Vector Generation:
Graphics image displayed as a large collection of lines on the screen regardless what the
image involves
Allows display of any geometric entity
o Involves spline, surface, text, graphical symbols
Graphical routines of the program only have to deal with one type of geometric element-
line
o Greatly simplifies image manipulation
Aim-
o Use sufficient display lines for the curve to appear smooth
o Number needed is controlled by display tolerance
Usually lines are drawn between points on the nominal curve shape
No of vectors used is trade-off between appearance of entities and display performance
Display tolerance:
The maximum deviation of the vector representation from the true curve shape is known as
display tolerance
Coarse display tolerance implies very polygonal curves
Fine display tolerance needs calculation of a large number of curve points
o Computationally expensive
Windowing Transformation:
Zoom and Pan is used to display only the part of the model
o Display Control Commands
Window:
An imaginary rectangular frame or boundary through which the user looks onto the model, is
known as window.
Viewport:
The area on the screen in which the contents of the window are to be displayed as an image is
known as viewport
Aspect ratio of window and viewport are same
Viewing Transformation:
The process of mapping from model coordinate system to screen coordinate system is known as
viewing transformation.
Allows application of any desired scaling, rotation and translation
Windowing Transformation:
No rotation applied
Less general case
𝒙𝒗 − 𝒗𝒙𝒍 𝒙𝒘 − 𝒘𝒙𝒍
=
𝒗𝒙𝒓 − 𝒗𝒙𝒍 𝒘𝒙𝒓 − 𝒘𝒙𝒍
𝒚𝒗 − 𝒗𝒚𝒃 𝒚𝒘 − 𝒘𝒚𝒃
=
𝒗𝒚𝒕 − 𝒗𝒚𝒃 𝒘𝒚𝒕 − 𝒘𝒚𝒃
Clipping:
The operation of efficiently identifying which part of vectors are within the window and
discarding the rest is known as clipping.
Otherwise vectors outside the window may lead to undesirable effect if mapped on screen
o Write over a text area of screen
o Have their coordinates set to screen boundary values
Line Drawing:
Drawing line on a raster display by setting appropriate bits in the frame buffer
o Cases where video controller is closely connected to the main CAD processor
Instructing a remote process to draw a vector
Drawing Lines on Raster Display:
Representation of continuous graphical element by a series of discrete points
Problem-
o Deciding which pixels are near the line segment
o Which should be illuminated
o Maintaining an apparently uniform line thickness
Different algorithms used-
o DDA
o Symmetrical DDA
o Bresenham
Most widely used
Uses integer arithmetic
May be performed incrementally
Transmitting Vector Information Across a network:
Before transmission of any graphical instruction between devices, it must be encoded
using a protocol
Positions usually expressed as integer coordinate pairs
At least 10bytes required to draw a line
o 8 byte for coordinate data
o Info about function and drawing style
Display manipulation for numerous vectors will involve significant network traffic
Network transmission will not match line drawing rate of modern workstation
Protocol:
A set of rules that control the exchange of data between communicating devices
Governs-
o Communication between computer and display terminals
o Two devices on a network
Client-Server Approach:
Client process encodes the graphic instruction in appropriate protocol
Send the instruction across the network to the server process
Server process decodes the message
Then sets appropriate bits in display memory
Stages of Pipeline in Two-Dimensional Computer Graphics:
Transform
Vectorize Clip to Draw
viewport
Clipping can occur after transformation
o Appropriate if hardware is available
3-Dimensional Computer Graphics:
Elements same as 2-d graphics
Process also simialr
Windowing transformation is replaced by viewing transformation
Clipping gets complex in case of pictorial perspective projection
Viewing Transformation:
Rotation:
1. About z axis-
𝒙′ 𝒄𝒐𝒔𝜽 𝒔𝒊𝒏𝜽 𝟎 𝒙′
𝒑′ = [𝒚′ ] = [−𝒔𝒊𝒏𝜽 𝒄𝒐𝒔𝜽 𝟎] [𝒚′ ]
𝒛′ 𝟎 𝟎 𝟏 𝒛′
2. About x axis-
𝒙′ 𝟏 𝟎 𝟎 𝒙
′ ′
𝒑 = [𝒚 ] = [𝟎 𝒄𝒐𝒔𝜽 𝒔𝒊𝒏𝜽] [𝒚]
𝒛′ 𝟎 −𝒔𝒊𝒏𝜽 𝒄𝒐𝒔𝜽 𝒛
3. About y axis-
𝒙′ 𝒄𝒐𝒔𝜽 𝟎 −𝒔𝒊𝒏𝜽 𝒙
′ ′
𝒑 = [𝒚 ] = [ 𝟎 𝟏 𝟎 ] [ 𝒚]
𝒛′ 𝒔𝒊𝒏𝜽 𝟎 𝒄𝒐𝒔𝜽 𝒛
Scaling:
X’=x/S
Y’=y/S
Z’= z/S
S=Scaling factor
Translation:
X’=x-dx
Y’= y-dy
Z’= z-dz
Homogeneous Coordiantes:
Involves representing 3-element position vecotrs by four element vectors of form
[ wx wy wz w]r
Here w is scale factor usually counted as 1
Visual Realism:
Internal detail and back faces obscured from view
Shadows cast
Surfaces with different intensities
Hues according to local lighting conditions
Techniques for Visual Realism:
1. Removal of Hidden Surfaces from Image
2. Shading/Coloring Visible Surfaces in a manner appropriate to the modelled
Lighting Condition
These two based on use of color raster display techniques
o Each pixel is given different color and intensity
o Gives impression of continuous areas of color and shade
3. Hidden Line Removal
More limited realism
Removes obscure edge and surface curves
Hidden Line/Edge Removal:
Edges or vectors of the model obscured by visible surfaces are omitted from display of
image
Sometimes displayed as dashed lines
Also known as visible line identification
Process similar to clipping
Involves segmentation and partial display of partly obscured edges
Difference with Clipping:
o Tests edges in the model against multiple boundaries
Lenghty process
Computationally expensive
Easy to test against flat face
Difficult with general surfaces
Boxing test and spatial subdivisions employed to improve performance
Involves object-space techniques
Tessellation :
Technique that subdivides surfaces into planar polygons for hidden-line removal is known as
tessellation.
Hidden-surface Removal:
Also known as visible surface determination
More generally an image-space process
Performance less sensitive to model complexity than hidden-line algorithms
o Limited resolution of raster display
o Large computing effort not needed for generation of fine scene details for
complex models
Relies heavily on polygonal,tessellated representation of surfaces and faces
Depth-buffer/Z-buffer Algorithm:
Simplest hidden surface removal algorithm
Uses frame buffer for display to store color values for the pixels
Z-buffer used to store current z-value for each pixel
Z value is the distance or depth from viewing point of the nearest object to the pixel
processed by the algorithm
Equivalent pixel in the frame buffer stores the shade of that object
Working Principle:
Sets the highest possible value for depth of each pixel
Sets the color to a background color
Each object in the model is then processed
For each pixel in projection of the object-
o If depth of object from viewpoint is less than current depth-
Depth and color values for pixel are replaced by those of new object
After all processing, frame buffer contains the hidden-surface image
Advantage:
Amenable to hardware implementation
Popular due to low cost of semiconductor memory
Disadvantage:
Brute-force approach
Larfe memory required for buffer
Coherence:
Describes-
Generally slow change in moving images with time
Often gradual change in color and shade within an image
Temporal Coherence:
Concerns change in time
Similarity between frames
Scanline Coherence:
Similarity between adjacent lines of the image
Spatial Coherence:
Similarity in color between adjacent parts of picture
Light & Shade:
Types of Illumination:
Diffuse Illumniation
o Light of equal intensity strikes the object from all directions
o Akin to ambient light reflected from walls and ceilings or transmitted through
cloud
o Represented by ambient intensity Ia
Point-source Illumination
o From sun,light bulbs,candles etc with intensity Ip
o Location represented by p, from the point of interest on the face to the point
source
Sometimes directed sources with intensity,location and direction may be modelled
Shading Method:
1. Flat Shading
2. Gouraud Shading
3. Phong Shading
Gouraud Shading:
Developed by Henry Gouraud
Computes surface normals at polygon vertex points through
o From underlying surface representation
o Averaging normals of the polygons that meet at the point
Uses these to determine vertex intensities
These intensiteies are linearly interpolated across the polygon
Phong Shading:
Interpolates the surface normal vectors across polygons
Uses these interpolated vectors in shading models at each pixel in the image
More computationally intensive
More faithful reproduction of highlights in reflection
Reduces Mach Banding
o Intensity varies at adjacent facets
Techniques for Highest Image Quality:
Ray Tracing/Ray Casting
Radiosity
Ray Tracing:
Consists of a series of algorithms
o Generate images by considering the path of a ray of light arriving at each pixel on
the screen
o Path is traced to the points where it meets surfaces in the scene
Can be used simply for identifying visible surfaces
It may allow shades,reflection and refraction to be considered by calculating the surface
intensity at the intersection points from three contributions-
o Local color due to surface illumanition by direct and ambient light
o Transmitted ray coming from refraction direction of translucent surface
o Reflection of a ray from reflection direction
Usually operates on a precise representation
Efficiency of line to surface intersection calculation is key
o Many numbers of intesection need to be calculated
Rays continue from intersection to intersection as infinitely thin beams
o Result in sharp shadows and reflection and refraction
Realistic effect may be achieved by using bundles of rays per pixel
Usually handles specular reflection and refraction
Can go some way towards modelling diffuse illumination
More appropriate for modelling-
o Motor vehicles
o Consumer durables with glossy surface
Radiosity:
Opposity characteristics to ray tracing
Developed to account for interaction of diffuse light between elements in a scene
Can not cope with sharp specular reflection
Object-space algorithm
o Solves intensity at discrete surface patches within an environment
o After computations, images are rendered at different viewpoints
Computationally intensive
Can achieve very high standards of realism
Suitable for
o Building design
o Interior and furnishing design