Unit-3 CAD Completed
Unit-3 CAD Completed
UNIT III
VISUAL REALISM
9
Hidden Line-Surface-Solid removal algorithms shading colouring computer
animation.
1 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Hidden line and surface removal methods remove the uncertainty of the
displays of 3D models and is accepted the first step towards visual realism.
Shaded images can only be created for surface and solid models.
In multiple step shading process, the first step is removing the hidden
surfaces / solids and second step is shades the visible area only.
Shaded images provide the maximum level of visualization.
The processes of hidden removal need huge amounts of computing times
and also upper end hardware services.
The creation and maintenance of such a models are become complex.
Hence, creating real time images needs higher end computers with the
shading algorithms embedded into the hardware.
Visibility Techniques
In general these techniques attempt to establish relationships among
polygons and edges in the viewing plane. The techniques normally check for
overlapping of polygons in the viewing plane. If overlapping occurs, depth
comparisons are performed.
Minimax Test
Edge Intersections
Containment Test
Homogeneity Test
Computing Silhouettes
Object-space algorithms are more accurate than image-space algorithms.
The former perform geometric calculations using the floating-point
precision of the computer hardware, while the latter perform calculations
with accuracy equal to the resolution of the display screen used to render
the image.
The enlargement of an object-space image does not degrade its quality of
display as does the enlargement of an image-space image.
As the complexity of the scene increases (large number of objects in the
scene), the computation time grows more quickly for object-space
algorithms than for image-space algorithms.
M. Puviyarasan | CAD | Unit - III
2 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Sorting
Sorting is an operation that orders a given set of records according to a
selected criterion.
The time required to perform the sort depends on the number of records to
be processed, the algorithm that performs the sort and the properties of the
initial ordering of the records (whether it is random or semi ordered).
Many visibility algorithms (hidden-line, hidden-surface, and hidden-solid
algorithms) make extensive use of sorting operations.
Sorting and searching operate on the records of the scene data base. These
records typically contain geometrical, topological and viewing information
about the polygons and faces that make the scene.
Coherence
Naturally, the elements of a scene or its image have some interrelationships,
known as coherence.
Hidden-line algorithms that utilize coherence in their sorting techniques are
more effective than other algorithms that do not.
Coherence is a measure of how rapidly a scene or its image changes.
It describes the extent to which a scene or its image is locally constant.
The coherence of a set of data can improve the speed of its sorting
significantly.
The gradual changes in the appearance of a scene or its image from one
place to another can reduce the number of sorting operations greatly.
Several types of coherence can be identified in both the object space and the
image space.
3 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
The first three types of coherence are object space based, while the last
four are image space based.
If an image exhibits a particular predominant coherence, the coherence
would form the basis of the related hidden-line removal algorithm.
4 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
HIDDEN-LINE REMOVAL
For a given 3D scene, a given viewing
point, and a given direction, eliminate
from a 2D projection of the scene all
parts of edges and faces which the
observer cannot see.
For
orthographic
projections,
the
5 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Step 2: Utilize the surface test to remove back faces to improve the efficiency of
the priority algorithm.
To enable one to perform the depth test, the plane equation of any face
(polygon) in the image can be obtained using Eq.
Given three points that lie in one face, can be written as:
Any two edges of a given face can be used to calculate the face normal. Steps
1 and 2 result in a face list which will be sorted to assign priorities.
For this example, six faces F1 - F6 form such a list.
The order of the faces in the list is immaterial.
M. Puviyarasan | CAD | Unit - III
6 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
7 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
8 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
An edge list can be created which maintains a list of all line segments that
will have to be drawn as visible.
Visibility techniques such as the containment test and edge intersection are
useful in this case.
In Some scenes, ambiguities may result after applying priority test. The
figure shows a case in which the order of faces is cyclic.
Face F1 covers F2, F2 covers F3, and F3 covers F1. It is very difficult to find
the priority list that produces this cyclic ordering and coverage.
To rectify this ambiguity, additional criteria to determine coverage must be
added to the priority algorithm.
9 | Page
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
10 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Step 4. Intersect the visible silhouette segments with partially visible faces:
This step is used to determine if the silhouette segments hide or partially
hide nonsilhouette edges in partially visible faces.
Edges E1 to E6 of S2 are intersected with the internal edges (edges of the
square in the face) of F1 , and the visible segments of the internal edges are
determined,
By accessing only the silhouette edges of the covering silhouette polygon
only and the partially visible face only, the algorithm avoids any unnecessary
calculations.
Step 5: Display the interior of the visible or partially visible polygons:
This step can be achieved using a stack and simply enumerates all faces lying
inside a silhouette polygon.
The stack is initialized with a visible face which has a silhouette edge.
M. Puviyarasan | CAD | Unit - III
11 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
12 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Hidden-Surface Removal
Hidden-surface removal and hidden-line removal are one problem.
Most of the line algorithms are applicable here and vice versa.
The following are image-space algorithms only for hidden-surface removal.
A wide variety of these algorithms exist.
They include the z-buffer algorithm, Watkin's algorithm, Warnock's
algorithm, and Painter's algorithm.
The Watkin's algorithm is based on scanline coherence, while the Warnock's
algorithm is an area-coherence algorithm.
The Painter's algorithm is a priority algorithm for raster displays.
13 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Warnock's Algorithm
This is one of the first area-coherence algorithms.
Essentially, this algorithm solves the hidden-surface problem by recursively
subdividing the image into subimages.
It first attempts to solve the problem for a window that covers the entire
image.
Simple cases as one polygon in the window or none at all are easily solved.
If polygons overlap, the algorithm tries to analyze the relationship between
the polygons and generates the display for the window.
If the algorithm cannot decide easily, it subdivides the window into four
smaller windows and applies the same solution technique to every window.
If one of the four windows is still complex, it is further subdivided into four
smaller windows.
The recursion terminates if the hidden-surface problem can be solved for all
the windows or if the window becomes as small as a single pixel on the
screen.
M. Puviyarasan | CAD | Unit - III
14 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
In this case, the intensity of the pixel is chosen equal to the polygon visible in
the pixel.
The subdivision process results in a window tree.
One would devise a rule that any window is recursively subdivided unless it
contains two polygons.
In such a case, comparing the z depth of the polygons determines which one
hides the other.
While the subdivision of the original window is governed by the complexity
of the scene, the subdivision of any window into four equal windows makes
the algorithm inefficient.
A better way would be to subdivide a window according to the complexity of
the scene in the window.
This is equivalent to subdividing a window into four unequal sub windows.
M. Puviyarasan | CAD | Unit - III
15 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Hidden-Solid Removal
The hidden-solid removal problem involves the display of solid models with
hidden lines or surfaces removed.
Due to the completeness and unambiguity of solid models, the hidden-solid
removal is fully automatic.
CAD systems provide users with menu choices to display models including
shaded, hidden lines removed, or wireframe (no hidden lines removed).
For displaying CSG models, both the visibility problem and the problem of
combining the primitive solids into one composite model have to be solved.
There are three approaches to displaying CSG models.
The first approach converts the CSG model into a boundary model that can
be rendered with the standard hidden-surface algorithms.
The second approach utilizes a spatial subdivision strategy.
The thrid approach uses a CSG hidden-surface algorithm, which combines
the CSG evaluation with the hidden-surface removal on the basis of ray
classification.
Ray-Tracing Algorithm
The virtue of ray tracing is its simplicity and reliability.
The most complicated numerical problem of the algorithm is finding the,
points at which lines (rays) intersect surfaces.
Therefore a wide variety of surfaces and primitives can be covered.
Ray racing has been used to enhance the visual realism of solids by
generating line drawings with hidden solids removed, animating solids, and
shading pictures.
It has also been utilized in solid analysis, mainly calculating mass properties.
The idea of using ray tracing to generate shaded images of solids is to
emulate the photographic process in reverse.
16 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
For each pixel in the screen, a light ray is cast through it into the scene to
identify the visible surface.
The first surface intersected by the ray, found by "tracing" along it, is the
visible one.
At the ray/surface intersection point, the surface normal is computed and
knowing the position of the light source, the brightness of the pixel can be
calculated.
Ray tracing is considered a brute force method for solving problems. The
basic ray-tracing algorithm is simple, but slow.
The CPU usage of the algorithm increases with the complexity of the scene
under consideration.
Various alterations and refinements have been added to the algorithm to
improve its efficiency.
Moreover, the algorithm has been implemented into hardware (ray-tracing
firmware) to speed its execution.
The basics of tray tracing stems from light rays and camera models.
The geometry of a simple camera model is analogous to that of projection of
17 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
geometric models.
Referring to Figure, the center of projection, projectors, and the projection
plane represent the focal point, light rays, and the screen of the camera
model, respectively.
We assume that the camera model uses the VCS. For each pixel of the screen,
a straight light ray passes through it and connects the focal point with the
scene.
When the focal length, the distance between focal point and screen, is
infinite, parallel views result, and all light rays become parallel to the Zv axis
and perpendicular to the screen (the Xv Yv plane).
A ray is a straight line which is best defined in a parametric form as a point
(Xo, Yo, zo) and a direction vector (x, y, z).
Thus, a ray is defined as [(Xo, Yo, Zo) (x, y, z)].
For a parameter t, any point (x, y, z) on the ray is given by:
18 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
While the basics of ray tracing are simple, their implementation into a solid
modeler is more involved and depends largely on the representation scheme
of the modeler.
M. Puviyarasan | CAD | Unit - III
19 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
When boundary representation is used in the object definition, the raytracing algorithm is simple.
For a given pixel, the first face of the object intersected by the ray is the
visible face at that pixel.
When the object is defined as a CSG model, the algorithm is more
complicated because CSG models are compositions of primitive solids.
Intersecting the primitive solids with a ray yields a number of intersection
points, which requires additional calculations to determine which of these
points are intersection points of the ray with the composite solid.
A ray-tracing algorithm for CSG models consists of three main modules:
ray/primitive intersection, ray/primitive classification, and ray/solid
classification.
The ray tracing algorithm to generate line drawings of hidden solids has
advantages.
It eliminates finding, parameterizing, classifying, and storing the curved
edges formed by the intersection of surfaces.
The silhouettes of curved surfaces are by-products, and they can be found
whenever the view changes.
The main drawbacks of the algorithm are speed and aliasing.
Aliasing causes edges to be jagged and surface "slivers" may be overlooked.
Speed is particularly important to display hidden-solid line drawings in an
interactive environment.
If the user creates a balanced tree of the solid in the scene, the efficiency of
ray tracing improves.
The coherence of visible surfaces (surfaces visible at two neighboring pixels
are more likely to be the same than different) can also speed up the
algorithm.
20 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Shading
Line drawings, still the most common means of communicating the
geometry of parts, are limited in their ability to portray intricate shapes.
Shaded images can convey complex shape information.
The visible faces of an object are found by hidden surface algorithms, but
further information is required to display the colour of the object.
Shading refers to the process of altering the colour of an object surface
polygon in the 3D scene based or its angle on lights and its distance from
lights to create a photorealistic effect.
They also can convey features other than shape such as surface finish or
material type (plastic or metallic look).
Shaded-image rendering algorithms filter information by displaying only the
visible surface.
Many spatial relationships that are unresolved in simple wireframe displays
become clear with shaded displays.
Shaded Images are easier to interpret because they resemble the real
objects.
Shaded images have viewing problems not present in wireframe displays.
Solids of interest may be hidden or partially obstructed from view, in which
case various shaded images may be obtained from various viewing points.
Critical geometry such as lines, arcs, and vertices are not explicitly shown.
Well-known
techniques
such
as
shaded-Image/wireframe
overlay,
21 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
As the visible surfaces are found, they must be broken down into pixels and
shaded correctly.
This process must take into account the position and color of the light
sources and the position, orientation, and surface properties of the visible
objects.
Shading models simulates the way visible surfaces of objects reflect light.
They determine the shade of a point of an object in terms of light sources,
surface characteristics, and the: positions and orientations of the surfaces
and sources.
Two types of light sources can be identified: point light source and ambient
light.
Objects illuminated with only point light source look harsh because they are
illuminated from one direction only.
This produces a flashlight-like effect in a black room. Ambient light is a light
of uniform brightness and is caused by the multiple reflections of light from
the many surfaces present in real environments.
Shading models are simple. The inputs to a shading model include intensity
and color of light source (S), surface characteristics at the point to be
shaded, and the positions and orientations of surfaces and light sources.
The output from a shading model is an intensity value at the point.
Shading models are applicable to points only. To shade an object, a shading
model is applied many times to many points on the object.
These points are the pixels of the display. To compute a shade for each point
on a 1024 x 1024 raster display, the shading model must be calculated over
one million times.
These calculations can be reduced by taking advantage of shading
coherence, that is, the intensity of adjacent pixels is either identical or very
close.
M. Puviyarasan | CAD | Unit - III
22 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
23 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
24 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Flat Shading
Single intensity is calculated for
each polygon and hence looks less
realistic.
Uses the same colour for every pixel
in a face.
Edges appear more pronounced
than they would on a real object.
Individual faces are visualized.
Same colour for any point of the
face.
Not suitable for smooth objects.
Less computationally expensive.
Used for high speed rendering.
Smooth Shading
Intensity at each point of a surface can be
obtained using an interpolation scheme.
Smooth shading uses linear interpolation
of colours between vertices.
The edges disappear with this technique.
Underlying surface is visualized.
Each point of the face has its own colour.
Suitable for any objects.
More computationally expensive.
Used for more realistic rendering.
25 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
26 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Shading Enhancements
The visual realism of images can be enhanced by including shading effects such as:
COLOURING
The two main ingredients of shaded images are colours and textures. The
display of realistic scenes is mostly in colour.
Colours are used for realism, aesthetics and to distinguish the different areas
in the geometry of an object.
27 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Hue
Saturation or Purity
Brightness
The combination of frequencies present in the reflected light from an object
is perceived as the colour of the object.
The Hue or simply the colour is the dominant wavelength or dominant
frequency.
Saturation is the purity of a colour. It describes how washed out or how
pure the colour appears.
It defines a range from pure colour (100%) to gray(0%) at a constant
lightness level.
Brightness represents the perceived intensity of light. It refers to the
lightness or darkness of a colour.
M. Puviyarasan | CAD | Unit - III
28 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Dark value with black added are called 'shades' and light value with white
added are called 'tints' by adding both black and white pigments, 'tones' of
the colour are produced.
Colour Models
A colour model is an abstract mathematical model describing the way
colours can be presented as tuples of numbers, typically as three or four
colour components.
It is used to describe colour as accurately as possible.
The range of colours that can be described by a combination of other colurs
is called a colour gamut.
o Additive colour models
o Subtractive colour models
Additive Color models
Additive Color models are based on the principle of transmitted light.
It is created by mixing a number of different colours, the primary colours
red, blue and green being normally used.
This system includes monitors, liquid crystal displays, digital projectors and
televisions.
Each pixel on a monitor screen starts out as black but when red, green and
blue phosphors of the pixel are illuminated simultaneously, that pixel
becomes white.
29 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
The colour that a surface displays depends on which parts of the visible
spectrum are not absorbed and therefore remain visible.
If an object absorbs (subtracts) all the illuminating light, i.e., no light is
reflected back to the viewer it appears black.
Subractive colour models filter the red, green and blue components of the
image from white light.
Colour paintings, photography and printing processes use the subtractive
process to reproduce colour.
In printing, black is added to improve the contrast.
Printing processes use colour inks that act as filters.
transparent it is the paper that reflects the unabsorbed light back to the
viewer.
Colour
model;
Adopted
by
the
National
Television
System
Committee(NTSC)
M. Puviyarasan | CAD | Unit - III
30 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
COMPUTER ANIMATION
To 'animate' literally means 'to give life to'.
The process of moving something which can't move by itself is called
'animation'.
It is a technique for creating the illusion of motion with a series of static
images. Animation adds to graphics the dimension of time which vastly
increases the amount of information which can be transmitted.
Conventional animation is defined as a technique in which the illusion
movement is created by photographing a series of individual drawings on
successive frames of film.
Computer animation is the use of computer to create animation.
Virtual entities may contain and be controlled by attributes such as location,
orientation and scale.
Animation is the change of an attribute over time. It generally refers to any
time sequence of visual changes in a scene.
To create the illusion of movement, an image is displayed on the computer
screen and then quickly replaced by a new image that is similar to the
previous image but shifted slightly.
To trick the eye and brain into thinking they are seeing a smoothly moving
object, the images should be drawn at around 12 frames per second or
faster.
A typical animation sequence for animated cartoons is:
M. Puviyarasan | CAD | Unit - III
31 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
o Storyboard layout
o Object definitions
o Key-frame specifications
o Generation of in-between frames
o Recording animation sequence
Computer animation demands higher frame rates as it produces more
realistic images.
o Computer assisted and Computer generated
Computer assisted animation is mostly 2-dimensional that computerize the
traditional animation process.
Computer generated or modeled animation or 3D animation utilizes
available computer graphics and CAD techniques to create images, scenes
and movements.
Applications of Computer animation
o Engineering, Educational
o Entertainment, Advertising, Art
o Architecture, Forensics, Medicine
o Military and Space exploration.
o In CAD :
Kinematic Simulation
Analysis of Linkage mechanism
Planning of a robotic work cycle
Types of Animation
o Frame buffer Animation
It provides the illusion animation for a variety of applications.
Limited real-time animation
32 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
Colour
table
animation,
Zoom-pan-scroll
33 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
34 | P a g e
PEC / DoME / III Year- Mechanical Engineering / V Sem / ME 6501: COMPUTER AIDED DESIGN
35 | P a g e