0% found this document useful (0 votes)
169 views73 pages

Cad Unit 2

This document provides an overview of computer-aided design and engineering (CAD/CAE) techniques for visual realism and hidden surface/line removal. It discusses fundamentals of CAD software and interactive graphics. Geometric modeling techniques like wireframe, surface and solid modeling are covered. Visualization methods like projection, shading and coloring are described to provide realistic images. Hidden line/surface removal algorithms like depth algorithm, area oriented algorithm and scanline algorithm are summarized. Key concepts in visible surface determination include silhouette edges, containment tests, and homogeneity tests.

Uploaded by

Aindrila Ganguly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views73 pages

Cad Unit 2

This document provides an overview of computer-aided design and engineering (CAD/CAE) techniques for visual realism and hidden surface/line removal. It discusses fundamentals of CAD software and interactive graphics. Geometric modeling techniques like wireframe, surface and solid modeling are covered. Visualization methods like projection, shading and coloring are described to provide realistic images. Hidden line/surface removal algorithms like depth algorithm, area oriented algorithm and scanline algorithm are summarized. Key concepts in visible surface determination include silhouette edges, containment tests, and homogeneity tests.

Uploaded by

Aindrila Ganguly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

PRPC26 COMPUTER AIDED

DESIGN AND ENGINEERING


V.MURUGABALAJI
DEPT OF PRODUCTION ENGINEERING
NIT TRICHY

1
SYLLABUS
• Fundamentals of computer - configurations - workstations - data communications - input/output
devices, display technology, CAD software. Interactive graphics - point plotting techniques.
Transformations techniques, viewing operations: window, viewport and clipping.
• Visual realism : Hidden line/surface removal, shading and colour models. Computer
drafting through high level languages.
• Geometric modeling: Wireframe modeling, Surface modeling: Representation of curves and
surfaces, design of curves: cubic splines, bezier curves and B-spline, design of surfaces.
• Solid modeling: Constructive solid geometry (C-rep) and Boundary representation (B-rep).
Graphics standards: GKS, DXF and IGES standards - Parametric design programmes.
• Finite element modeling and analysis: types of analysis, degrees of freedom, element and
structure- stiffness equation, assembly procedure. Database concepts and data base management
systems - SQL.

2
Visual realism
• Visualization can be defined as a technique for creating images,
diagrams or animations to communicate ideas.
• Projection and shading are common methods for visualizing geometric
models.
• CAD uses isometric and perspective projection in addition to
orthographic projection for generating rich visual images with
complete design information.

3
• To project 3D to 2D objects we need to remove the ambiguities of the
different views, which can be got by the elimination of hidden lines,
surfaces , solid removal approaches.
• Shading,
• Lighting
• Transparency
• Coloring approaches provide more visual realism

4
Applications of realism
• Robot Simulations : Visualization of movement of their links and joints and end effector
movement etc.
• CNC programs: verification of tool movement along the path prescribed and estimation of cup
height and surface finish etc.
• Discrete Event Simulation : Most of DES packages provide the user to create shop floor
environment on the screen to visualize layout of facilities, movement of material handling systems,
performance of machines and tools.
• Scientific Computing : Visualization of results of FEM analysis like iso-stress and iso-strain
regions, deformed shapes and stress contours. Temperature and heat flux in heat-transfer analysis.
Display and animation of mode shape in vibration analysis.
• Flight Simulation : Cockpit training for pilots is first being provided with flight simulators, which
virtually simulates the surrounding that an actual flight will pass through.

5
6
HIDDEN LINE REMOVAL
“For a given three dimensional scene, a given viewing point and a
given direction eliminate appropriate two dimensional projection of
the edges and faces which the observer cannot see”

• Object space method


• Image space method

7
• Object space: Determine which part of the object are visible. Also
called as World Coordinates. Object is described in physical
coordinate system.
• It compares the object and parts to each other within the scene
definition to determine which surface is visible.
• Image space: Determine per pixel which point of an object is visible.
• Also called as Screen Coordinates. Visibility is decided point by point
at each pixel position on view plane.
• Zooming does not degrade the quality.

8
HIDDEN LINE ELIMINATION PROCESS

9
VISIBILITY TECHNIQUES
MINIMAX TEST
CONTAINMENT TEST
SURFACE TEST
COMPUTING SILHOUETTES
EDGE INTERSECTION
SEGMENT COMPARISONS
HOMOGENITY TEST

10
MINIMAX TEST
• Minimax test (also called the overlap or bounding box test) checks if two polygons
overlap. The test provides a quick method to determine if two polygons do not
overlap.
• It surrounds each polygon with a box by finding its extents (minimum and maximum x
and y coordinates) and then checks for the intersection for any two boxes in both the X
and Y directions.
• If two boxed do not intersect, their corresponding polygons do not overlap (see Figure 1).
In such a case, no further testing of the edges of the polygons is required.
• If the minimax test fails (two boxes intersect), the two polygons may or may not overlap,
as shown in Figure 1. Each edge of one polygon is compared against all the edges of the
other polygon to detect intersections. The minimax test can be applied first to any two
edges to speed up this process

11
12
CONTAINMENT TEST
• The containment test checks whether a given point lies inside a given polygon or polyhedron.
There are three methods to compute containment or surroundness.
• For a convex polygon, one can substitute the X and Y coordinates of the point into the line
equation of each edge. If all substitutions result in the same sign, the point is on the same side
of each edge and is therefore surrounded.
• For non-convex polygons, two other methods can be used. In the first method, we draw a line from
the point under testing to infinity as shown in Figure 2a. The semi infinite line is intersected with
the polygon edges. If the intersection count is even, the point is outside the polygon (in Figure ).
If it is odd, the point is inside.
• If one of the polygon edges lies on the semi-infinite line, a singular case arises which needs special
treatment to guarantee the consistency of the results.
• The second method for non-convex polygons (Figure) computes the sum of the angles subtended
by each of the oriented edges as seen from the test point. If the sum is zero, the point is outside
the polygon. If the sum is -360 or +360 the point is inside. The minus sign reflects whether the
vertices of the polygon are ordered in a clockwise direction instead of counter clockwise.

13
CONTAINMENT TEST

14
Computing silhouettes
• A set of edges that separates visible faces from invisible faces of an
object with respect to a given viewing direction is called silhouette
edges (or silhouettes).
• The signs of the components of normal vectors of the object faces can
be utilized to determine the silhouette.
• An edge that is part of the silhouette is characterized as the
intersection of one visible face and one invisible face.
• An edge that is the intersection of two visible faces is visible, but does
not contribute to the silhouette.
• The intersection of two invisible faces produces an invisible edge.

15
16
Segment comparison
• The image is computed scan line by line that is in segments and
displayed in the same order.
• The scan line is divided into spans(dashed lines).
• The visibility is determined within each span by comparing the depths
of the edge segments that lie in the span.
• Segments with maximum depth are visible throughout the span.

17
18
Homogeneity test
• Points are compared for visibility.
• Homogeneously visible: Neighborhood of point P can be projected
objectively onto neighborhood of the projection of a point.
• Homogeneously invisible: Neighborhood of point P cannot be projected
objectively onto neighborhood of the projection of a point.
• In-homogeneously visible
• Pr(N(P))=N(Pr(P))
• Pr(N(P))≠N(Pr(P)) in homogeneously invisible.

19
Back-face elimination
• We cannot see the back-face of solid objects: Hence, these can be ignored

20
Back-face elimination

21
Algorithm

Hidden line removal algorithm


• Depth Algorithm (or) Z algorithm (or) Priority algorithm
• Area oriented algorithms
• Overlay algorithm-Curved surface
• Roberts algorithm
Hidden surface removal algorithm
• Depth buffer algorithm or z-buffer algorithm
• Area coherence algorithm or Warnock’s algorithm
• Scan-line algorithm or Watkin’s algorithm
Hidden solid removal algorithm
• Ray tracing algorithm

22
Priority algorithm

23
Depth or priority algorithm
Painter’s algorithm:
• As we utilize the procedure the painter’s way of creating the
background first and then the overlaying layer and then the outermost
layer with reducing depth.

24
Painter’s algorithm

25
26
27
AREA ORIENTED ALGORITHM
• Subdivides the data set of the given scene in a stepwise fashion until
all visible area in the scene are determined and displayed.
• No penetration of faces is allowed.

28
29
Hidden surface removal algorithm
• The elimination of parts of a solid objects that are covered by others is
called hidden surface removal.
• Depth buffer or Z-buffer Algorithm
• Area coherence or Warnock’s algorithm
• Scan-line algorithm or Watkin’s algorithm

30
Depth-Buffer Methods

• Three surfaces overlapping pixel position (x , y) on the view plane.


• The visible surface, S1, has the smallest depth value.

31
Depth buffer or z-buffer algorithm

32
• Two buffer areas are required
Depth buffer
• Store depth values for each (x, y) position.
• All positions are initialized to minimum depth.
• Usually 0 – most distant depth from the view plane.
Refresh buffer
• Stores the intensity values for each position.
• All positions are initialized to the background intensity.

33
Z-BUFFER ALGORITHM
• Its an extension of Frame Buffer
• Display is always stored on Frame Buffer
• Frame Buffer stores information of each and every pixel on the screen
• Bits (0, 1) decide that the pixel will be ON or OFF
• Z- Buffer apart from Frame buffer stores the depth of pixel
• After analyzing the data of the overlapping polygons, pixel closer to
the eye will be updated
• Resolution of X,Y => Array[X,Y]

34
Warnock’s Algorithm

35
SCAN LINE Z-BUFFER ALGORITHM

36
37
Shading
• Shading is a way to paint the object with light.
• Shading refers to the application of a reflection model over the surface
of an object.
• Shading assigns intensities to pixels to give the impression of opaque
surfaces rather than wireframes.

38
Constant-Intensity Shading
• A fast and simple method for rendering an object with polygon
surfaces is constant intensity shading, also called flat shading. In this
method, a single intensity is calculated for each polygon. All points
over the surface of the polygon are then displayed with the same
intensity value.
• Constant shading can be useful for quickly displaying the general
appearance of a curved surface.

39
Constant-Intensity Shading
In general, flat shading of polygon facets provides an accurate rendering for
an object if all of the following assumptions are valid: -
• The object is a polyhedron and is not an approximation of an object with a
curved surface.
• All light sources illuminating the objects are sufficiently far from the
surface so that N . L and the attenuation function are constant over the
surface(where N is the unit normal to a surface and L is the unit direction
vector to the point light source from a position on the surface).
• The viewing position is sufficiently far from the surface so that V . R is
constant over the surface.(where V is the unit vector pointing to the viewer
from the surface position and R represent unit vector in the direction of
ideal specular reflection).
40
Gouraud Shading
• This intensity-interpolation scheme, developed by Gouraud and generally
referred to as Gouraud shading, renders a polygon surface by linearly
interpolating intensity values across the surface.
• Intensity values for each polygon are matched with the values of adjacent
polygons along the common edges, thus eliminating the intensity
discontinuities that can occur in flat shading.
• Each polygon surface is rendered with Gouraud shading by performing the
following calculations:
1. Determine the average unit normal vector at each polygon vertex.
2. Apply an illumination model to each vertex to calculate the vertex
intensity.
3. Linearly interpolate the vertex intensities over the surface of the polygon.

41
Gouraud Shading
• At each polygon vertex, we obtain a normal vector by averaging the surface normals of all
polygons starting that vertex, as illustrated in Fig.

42
Gouraud Shading
• Interpolate intensities along the polygon edges. For each scan line, the intensity at the intersection
of the scan line with a polygon edge is linearly interpolated from the intensities at the edge
endpoints. For the example in Fig. the polygon edge with endpoint vertices at positions 1 and 2 is
intersected by the scan line at point 4. A fast method for obtaining the intensity at point 4 is to
interpolate between intensities I1, and I2 using only the vertical displacement of the scan line:

43
Gouraud Shading

• Similarly, intensity at the right intersection of this scan line (point 5) is interpolated from
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 Previous Fig is interpolated from the
bounding intensities at points 4 and 5 as

44
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 following Fig.

45
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 - I, as

46
Gouraud Shading
• Similar calculations are used to obtain intensities at successive
horizontal pixel positions along each scan line.
• When surfaces are to be rendered in color, the intensity of each color
component is calculated at the vertices.
• Gouraud shading can be combined with a hidden-surface algorithm to
fill in the visible polygons along each scan line.

47
Phong Shading
A more accurate method for rendering a polygon surface is to interpolate normal vectors,
and then apply the illumination model to each surface point. This method, developed by
Phong Bui Tuong, is called Phong shading, or normal vector interpolation shading. It
displays more realistic highlights on a surface and greatly reduces the Mach-band effect.
A polygon surface is rendered using Phong shading by carrying out the following steps:
1. Determine the average unit normal vector at each polygon vertex.
2. Interpolate the vertex normals over the surface of the polygon.
3. Apply an illumination model along each scan line to calculate projected pixel intensities
for the surface points.

48
Phong Shading
• Interpolation of surface normals along a polygon edge between two vertices is illustrated
in Fig. The normal vector N for the scan-line intersection point along the edge between
vertices 1 and 2 can be obtained by vertically interpolating between edge endpoint
normals

49
Phong Shading
• Incremental methods are used to evaluate normal between scan lines and along
each individual scan line. At each pixel position along a scan line, the illumination
model is applied to determine the surface intensity at that point.
• Intensity calculations using an approximated normal vector at each point along the
scan line produce more accurate results than the direct interpolation of intensities,
as in Gouraud shading.
• The trade-off, however, is that Phong shading requires considerably more
calculations.

50
Fast Phong Shading
• Surface rendering with Phong shading can be speeded up by using approximations in the
illumination-model calculations of normal vectors.
• Fast Phong shading approximates the intensity calculations using a Taylor series expansion and
triangular surface patches.
• Since Phong shading interpolates normal vectors from vertex normals, we can express the surface
normal N at any point (x, y) over a triangle as
N=Ax+By+C
• where vectors A, B, and C are determined from the three vertex equations:
• Nk=Axk+Byk+C, k=1,2,3 with (xk,yk) denoting a vector position.

51
Fast Phong Shading
• Omitting the reflectivity and attenuation parameters, we can write the
calculation for light source diffuse reflection from a surface point (x,
y) as

52
Fast Phong Shading
• We can rewrite this expression in the form

• where parameters such as a, b, c, and d are used to represent the various dot products. For
example

• Finally, we can express the denominator in Eq. (1) as a Taylor-series expansion and retain terms up
to second degree in x and y. This yields

• where each Tk, is a function of parameters a, b, c, and so forth.

53
Fast Phong Shading
• Using forward differences, we can evaluate Eq. (2) with only two
additions for each pixel position (x, y) once the initial forward-
difference parameters have been evaluated. Although fast Phong
shading reduces the Phong-shading calculations, it still takes
approximately twice as long to render a surface with fast Phong
shading as it does with Gouraud shading.
• Normal Phong shading using forward differences takes about six to
seven times longer than Gouraud shading.

54
55
56
Faceted Lambert Shading
• Intesity of reflected light is independent of viewers position and is
given by, I=IskdcosƟ, Is = intensity of point source itself, Kd =
coefficient indicating reflectivity of the surface (0-1), cosƟ = n.i

• I= Ia + IskdcosƟ , Ia = contribution from ambient light.

57
Faceted Lambert Shading
• Given Three points A(0,0,1), B(1,0,0), C (0,1,0) and an illumination
source of intensity 9 located at a far distance in the direction
√2i+3j+4k. Determine the shaded intensity for reflectivity of 0.25.

• Ans: 2.1

58
COLOR MODELS
• A color model is an abstract mathematical model describing the way colors can be represented as
tuples of numbers, typically as three or four values or color components.

59
Properties of Light
• When white light is incident on an opaque object , some frequencies
are reflected and some are absorbed.
• The combination of frequencies present in the reflected in the reflected
light determines the color of the object that we see.(Dominant
frequency or Hue)

60
Characteristics of Color
• Dominant Frequency (Hue): The color we see (red, green, blue).-Tri-
stimulus theory of human brain.
• Brightness: The total light energy, how bright is the color (How bright
• are the lights illuminating the object?)
• Purity (Saturation): Purity describes how close a light appears to be
to a pure spectral color, such as pink is less saturated than red.
• Chromaticity refers to the two properties (purity & hue) together.

61
Color Model

62
RGB Model

63
RGB Model

64
CMY Model

65
66
HSV Model

67
HSV Model
• The Hue (H) of a color refers to which pure color it resembles. All
tints, tones and shades of red have the same hue. (simply the color we
see)

68
HSV Model
• The Saturation (S) of a color describes how white the color is. Or the
amount of white added to the color. A pure red is fully saturated (S=1)
means no white added

69
HSV Model
• The Value (V) of a color, also called its lightness, describes how dark
the color is. A value of 0 is black, with increasing lightness moving
away from black.

70
Color Models Applications

71
Halftone

72
Dithering

73

You might also like