Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
S.DHARANI KUMAR
Asst.professor
Department of MechanicalEngineering
SRI ESHWAR COLLEGE OFENGINEERING ,COIMBATORE,INDIA
UNIT-3VISUAL REALISM
Visualization
• Visualization can be defined as technique for creating images,
diagrams or animations to communicate ideas.
• It concentrates basically on visual appearance of objects.
• Projection and shading are two most common methods of
visualizing geometric models.
• Orthographic projection is one of the oldest methods.
• Orthographic projection is difficulty in interpreting various views
and also time consuming.
• CAD use isometric and perspective projection in addition to
orthographic projections for generating rich visual images with
complete design information.
• Visual realism can also convey appearance characteristics of the
model such as color and texture.
Two important methods ofvisualization
• Animation• Simulation
• 3D models are used to create the visual real effect.
• The object may consist of number of vertices ,edges ,surfaces which
are represented realistically in 3D modeling.
• The major problem in visualization of object is representing the
depth of 3D object into 2D screens.
• Projection 3D object into 2D screen displays the complex lines and
curves which may not give a clear picture to interpret .
Methods towards visual realism in CAD
• Hidden line removal (HLR)
• Hidden surface removal (HSR)
• Hidden solid removal approaches
Three process sequence in model clean –up
1. Generating orthographic views of
the model.
2. Eliminating hidden lines in each
view by applying visual realism
principle.
3. Changing the necessary hidden
lines are dashed lines.
• For a given three dimensional scene a given viewing point and a
given direction form an appropriate two dimensional projection of the
edges and faces which the observer cannot see.
• Various hidden line and hidden surface removal algorithms have been
developed .
These algorithms may be classified into
1. Object space method
2. Image space method
Object space method• Object are described in the world coordinate system.
• It compares the objects and parts to each other within the scene
definition to determine which surfaces are visible.
• Image space method is implemented in the screen coordinate
system in which the objects are viewed.
• The visibility is decided point by point at each pixel position on the
view plane .
Image space method
• Image space algorithms are much more efficient than object space
algorithms
•Object space algorithms are much more functional than image space
algorithms.
• Color calculation in object space algorithms is done only one time
and is retained by it but in image space algorithm the calculation
once done is over written later.
• Hidden line and hidden surface algorithms use image space method.
Hidden line elimination process
Three dimensional object data
Two dimensional image data
Sorting of 2D image data
Application of visibility techniques
Elimination of hidden lines
Display the results
DHARANI KUMAR.S/AP/MECH/SECE
STEP1 – 3D models have to be modified in such faces and order of their edges .
STEP2- Geometric transformation to the 3D data to obtain the 2D image data.
STEP3-sorting –is an operation that orders given set of records according to
a selected criterion.
• The elements of a scene or its image have some interrelation ships known as
coherence. Coherence is a measure of how rapidly a scene or its image changes.
• Coherence of a set of data can improve the speed of its sorting significantly.
STEP4-The visibility techniques normally check for overlapping of pairs of
polygons in the viewing plane.
STEP5 – The surface test to eliminate the blackfaces is usually sufficient to solve
the hidden line if the image has no holes.
STEP6 –Final images .
Visibility Techniques
• Minimax test
• Containment test
• Surface test
• Computing Silhouettes
• Edge intersection
• Segment Comparisons
Minimax test
• Test compares whether 2 polygons overlap or not.
• Each polygon is enclosed in box by finding its maximum and minimum X
and Y coordinates .
• If two boxes do not intersect, their corresponding polygons do not overlap,
no testing is required.
• If the minimax test fails (two box interest),each edges of one polygon is
compared against all the edges of the other polygon to detect intersections .
Containment test
• This test checks whether the location of a given point is inside or
outside of given polygon.
• For a convex polygon X and Y coordinates value of the points is
substituted into the line equation to see the results on the given edge .
• If the result of the sign same, the points lie on the same side.
Edge intersection
• In this techniques hidden line algorithm initially calculate the edges
intersection in two dimensions.
• These intersection are used to determine the edge visibility.
• The intersections are used to determine the
Edge visibility.
The two edges intersect at a point where
Y2-Y1=0 .
X1, Y1
DHARANI KUMAR.S/AP/MECH/SECE
Segment comparison
• This visibility techniques is used to solve hidden surface problems in image
space
• In image display or raster display scan lines are arranged on display screen from
top to bottom and left to right.
• The display screen is divided in to no of
Small segments .
This technique is use to solve the problem piecewise and a total image.
DHARANI KUMAR.S/AP/MECH/SECE
Surface test or back face test• There are surface which are facing the viewer (front faces ) and there are
surfaces which are opposite to the viewer (back faces).
• A back face test is used to determine the location of a surface with respect to
other surface.
• Test can provide an efficient way of implementing the depth comparison to
remove the faces which are not visible in a specific view port .
• Face whose surface normal has positive component in Z direction are visible
and those whose surface normal has a negative Z component are not visible.
Surface test or back face test
Silhouettes
• A set of edges which separates visible faces from invisible faces of an object
with respect to a given viewing direction is called silhouettes edges.
• Silhouettes is characterized as the intersection of one visible face and one
invisible face.
• Silhouettes are computed by using the sign of component of the surface
normal along the view direction .
Hidden line removal algorithms
1.Depth algorithm or Z algorithm or Priority algorithm
2.Area oriented algorithms
3.Overlay algorithms
4.Robert algorithms
Priority or depth or z-algorithm
• STEP1 –write the formulae vertices with coordinates of
(X,Y,Z).
• STEP2-Remove back faces to improve efficiency of the
priority algorithm.
• STEP3- assign priorities to the faces in the face list.
• Eq1 for both faces F1 and F4 ,the corresponding ZV values of
point C can be calculated and compared.
• The face with the highest ZV values is assigned the highest
priority.
• (In the case of an edge of intersection, both faces are assigned the
same priority).
• (In the case of no face intersection, no priority is assigned )
• F1 intersects F2 and F3 in edges, therefore both faces assigned
as priority 1
• F1 and F4 intersect in area. Using depth test F4 is less than
F1,so F4 assigned priority 2.
• We intersect F1 and F5 we obtain empty set no priority
assignment is possible.
• Face 1 is moved to the end of the face list and sorting process
to determine the priority starts over again.
• Each iteration, the first face in the face list is assigned priority 1.
• The End of each iteration is detected by no intersection.
• Four iterations that yield the final priority list.
• Fourth iteration shows faces F4 to F6 are assigned the priority 1 first .
• When F4 is intersected with F1,the depth shows that F1 has highest
priority.
• F1 is assigned as priority 1 and the priority of F4 to F6 is dropped to
2.
• STEP4 -Reorder the face and priority list so that the highest priority is on
top of the list in this case [F1,F2,F3,F4,F5,F6] and [1,1,1,2,2,2].
• STEP5- Display the faces in the reverse order of their priority.
• STEP6- The edges of faces are compared with all other edges of higher
priority.
• An edges list can be created which maintains a list of all line segment
that will have be drawn as visible .
• Visible techniques used for this method edge intersection and
containment test.
Painter’s Algorithm• Main Idea
A painter creates a picture by
drawing background scene elements
before foreground ones
• Requirements
Draw polygons in back-to-front order
Need to sort the polygons by depth
order to get a correct image from Shirley
DHARANI KUMAR.S/AP/MECH
Area oriented algorithms
1.Identify silhouette polygons
2.Assign quantitative hiding (QH) values to edges ofsilhouette polygons
S1 is smaller than that of S2.
Edge of C1&C2 is partially visible for point P1
Edge of C2&C3 is partially visible for point P2
Determination of the values of QH at the
various edges
A Value of 0 indicates that the edge or segment
is visible
AA Value of 1 indicates that the edge or
segment is invisible
3.Determine the visible silhouette segments
The values of QH the visibility of
silhouette segment can be determined
with the following rules in mind.
Segment with lowest QH values are
visible.
4.Interest the visible silhouette segment withpartially visible faces .
Edges E1 to E6 of S2 are intersected with
internal edges of F1.
Visible segment internal edges are
determined.
5.Display the interior of the visible or partiallyvisible polygons
E7 is not fully invisible
Hidden surface removal
• Hidden line removal is the process of eliminating line of
parts of objects which are covered by others
• The elimination of parts solid objects that are covered by
others is called hidden surface removal
DHARANI KUMAR.S/AP/MECH/SECE
Hidden surface Removal algorithm
1. Depth buffer algorithm or z – buffer algorithm
2. Area – coherence algorithm or Warnock’s algorithm
3. Scan line algorithm or Watkins algorithm
DHARANI KUMAR.S/AP/MECH/SECE
DHARANI KUMAR.S/AP/MECH/SECE
DHARANI KUMAR.S/AP/MECH/SECE
Advantages & Disadvantages• It is simple and it does not require additional date structure.
• The z value of a polygon can be incrementally calculated.
• No object –object comparison is required.
• It can only find one visible surface at each pixel position
• This method requires an additional buffer as compared with the depth or
priority algorthim and the overheads is involved in Updating the buffer.
Area – coherence algorithm or Warnock’s algorithm
Scan line algorithm or Watkins algorithm
Hidden solid removal algorithm
• Hidden line and surface removal algorithm described in the pervious
sections are applicable to hidden solid removal of B-rep .
• Z-Buffer can be extended to CSG models.
• Complexity of CSG model lies with both the visibility and combination
of primitives solids in one composite model.
• Techniques CSG to B-rep model conversion is done by hidden surface
algorithm.
Ray tracing or Ray –casting algorithm
• Ray-tracing is the process of tracking and plotting the path taken by
the rays of light staring at a light source to the center of the view
projection .
• Ray casting is to shoot rays from the eye, one per pixel, and find the closet
object blocking the path of that ray .
• This process involves an infinite number of lights rays, the light rays a traced
backward i.e. a ray from the view point is traced through the pixel until it
reaches a surface.
• X*Y resolution of screen ,XY pixels and so XY light rays are traced.
• After calculating all ray surfaces intersections ,the visible surface can be
identified as the one whose intersection point is the closest to the pixel.
Ray/solid classification
Ray/solid classification
Ray/solid classification
Advantages
• The most popular and powerful technique for hidden solid removal
because of its simple, elegant and easy implementation nature.
• The algorithm provides the flexibility to handle both flat and curved
surfaces.
Disadvantages
• Algorithm are speed and aliasing
AMBIENT LIGHT
DIFFUSE REFLECTION
SPECULAR REFLECTION
AMBIENTLIGHT
DIFFUSEREFLECTION
SPECULARREFLECTION
Shading Algorithm
1. Constant – Intensity shading algorithm or flat shading or
Lambert shading
2. Gourand Algorithm first derivative shading
3. Phong or second derivative shading
4. Half tone shading
1.Constant – Intensity shading algorithm or flatshading or Lambert shading
• A flat and simple method for rendering on object
with polygon surfaces .
• In this method surface the object is approximated by
polygon even though smooth surface.
• Surface can be smooth by increasing the polygon.
• Unit normal vector of a polygon never changes.
• Entire polygon has single intensity value.http://en.wikipedia.org/wiki/Phong_shading
1.Constant – Intensity shading algorithm orflat shading or Lambert shading
Advantages
• Fast and simple.
• Compute the color of a
polygon.
• Use that color on every pixel
of the polygon
• Object is a polyhedron and is not an
approximation of an object with a
curved surface.
• All light source illuminating the
object are sufficiently far from the
surface so that N.L.
• V.R constant over the surface.
viewing position far from the surface.
2.Gourand Algorithm first derivative shading
• Gourand shading is invented by henri gourand in
1971 .
• Gourand proposed a technique to eliminate intensity
discontinuities caused by constant shading.
• Intensity of each polygon is matched with the
values of adjacent polygons among the common
edges. https://en.wikipedia.org/wiki/Shading#/media/File:Gouraud_high.gif
2.Gourand Algorithm first derivative shading –STEPS
1. Calculate the surface normal
2. Determine the average unit normal vector at each polygon vertex.
3. Apply an illumination model to each vertex to calculate the vertex
intensity.
4. Linearly interpolate the vertex intensities over the surface of the polygon.
2.Gourand Algorithm first derivative shading (advantages &disadvantages)
• Removes the intensity discontinuities existing in constant shading model.
• Combined with a hidden surface algorithm to fill in the visible polygon along
each scan line.
Disadvantages
• It has poor highlighting from specular reflection.
• Irregular shading of concave polygon occurs.
• Linear intensity can cause dark or bright intensity streaks is called Mach bands.
3.Phong shading Algorithm
• This method is developed by Phong Bui Tuong is called phong shading.
• Phong shading uses similar principle as ground shading but instead of
interpolating the shade intensities.
• It interpolates normal vectors N at the surface vertices. This algorithm is also
called normal –vector interpolation shading.
• It displays more realistic highlights on a surface and greatly reduces the
Mach band effects.
3. Phong shading Algorithm–STEPS
1. Calculate the surface normal
2. Determine the average unit normal vector at
each polygon vertex.
3. Using a bilinear interpolation scheme
,determine the surface normal at each pixel.
4. On the basis of this surface normal,
determine the local intensity at this pixel . http://en.wikipedia.org/wiki/Phong_shading
Gouraud
Flat
Phong