visual realism
DESCRIPTION
cadTRANSCRIPT
VISUAL REALISM
Visualization
• As a tool for better understanding the image presented on the
computer screen.
• As a means of representing graphically complex multidimensional
data sets.
• Therefore two types of visualization can be identified: visualization
in geometric modeling and visualization in scientific computing
Visualization in geometric modeling
• The most common methods of visualizing geometric models are
Projection and Shading.
• They are useful in determining spatial relationship in design applications.
For example it can be used for interference detection between mating
parts in assemblies.parts in assemblies.
Visualization in scientific computing
• This is in itself viewed as a method of geometrical modeling. It transforms
the numerical data into image display, enabling the user to observe their
simulation and computations. This is of great interest to scientists and
engineers.
• Animation and simulation are considered a popular form of visualization.• Animation and simulation are considered a popular form of visualization.
Problems in Visualization
• Display of three dimensional objects and scenes on two dimensional
screens
• How can the third dimension, the depth be displayed on the screen?
• How can real environment such as lighting, color , shadows and texture be
represented as image attribute?represented as image attribute?
HIDDEN LINE TECHNIQUES
• Visibility of object views
• Sorting • Sorting
• Coherence
• Formulation and implementation
• Sample hidden line algorithms
VISIBILITY OF OBJECT VIEWS
• MINIMAX TEST:
This test is also called overlap or bounding box test which checks if two polygonsThis test is also called overlap or bounding box test which checks if two polygons
overlap.
It surrounds each polygon with a box by finding its extent ( minimum and maximum x
& Y coordinates) and then checks for the intersections for any two boxes in both X
and Y directions.
If two boxes don’t overlap then the corresponding
polygons don’t intersect and in such cases no further
testing of edges of the polygon are required.
If the minimax test fails, the two polygon may or may not
overlap. Each edge of one polygon is compared
against all the edges of the other polygon to detect
intersections
• CONTAINMENT TEST : It is to check the vertices of one polygon for
containment in the other.
Angle method
Containment proceeds:
(a) If the sum of the angles is equal to zero, point P is outside the polygon.
(b) If the sum is equal to 360°, point P is inside the polygon.
• CONTAINMENT TEST : It is to check the vertices of one polygon for
containment in the other.
Intersection method
Containment proceeds:
Even count of intersection =>
point not surrounded
Odd count of intersection =>
point surrounded
(a) Draw a line from the point under testing to infinity
(b) The semi-infinite line is intersected with the polygon edges
(c) 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.
• COMPUTING Silhouettes: It is set of edges that separate visible faces
from the invisible faces of an object with respect to a given viewing direction
Containment proceeds:
(a) The sign of the Zv components of normal vectors of the object faces can be
utilised to determine the silhouette.
(b) An edge that is part of silhouette is characterized as the intersection on one
visible face and one invisible face
(c) An edge that is the intersection of two visible faces is visible, but does not (c) An edge that is the intersection of two visible faces is visible, but does not
contribute to the silhouette.
(d) If a normal does not have a Zv component, as in second case additional
information is needed to compute silhouette.
SORTING
Many visible algorithms make extensive use of sorting operations.
For visibility algorithms , sorting and searching techniques operates on the records ofFor visibility algorithms , sorting and searching techniques operates on the records of
the scene database.
These records contains geometrical, topological and viewing information about the
polygons an faces that make the scene.
Sorting is an operation that orders a given set of records according to a selected
criterion.
Time required to perform the sort depends on the number of records to be processed,
the algorithm that performs the sort and the statical properties of the initial
ordering of records.
COHERENCE
The elements of a scene have some interrelationships and this is called coherence.
Hidden line algorithms that utilise coherence in the sorting techniques are more
efficient that other algorithms that do not.
It is a measure of how rapid a scene changes. It describes the extent to which a scene
is locally constant.
Types of coherences :
� Edge coherence
� Face coherence Object Space Based
� Geometric coherence� Geometric coherence
� Frame coherence
� Scan line coherence
� Area coherence Image Based
� Depth coherence
� Edge coherence : the visibility of an edge changes only when it
crosses another edge
� Face coherence : if a part of a face is visible, the entire face is
probably visible. Penetration of faces is relatively
rare occurrence.
� Geometric coherence : edges that share the same vertex or faces that
share the same edge have similar visibilities inshare the same edge have similar visibilities in
most cases.
� Frame coherence : A picture does not change very much from frame
to frame.
� Scan line coherence : Segments of a scene visible on one scan line are
most probably visible on the next line.
� Area coherence : A particular element of an image and its
neighbors are likely to have the same visibility
and to be influenced by the same faceand to be influenced by the same face
� Depth coherence : The different surfaces at a given screen location
are generally well separated in depth relative to
the depth range of each.
FORMULATION AND IMPLEMENTATION
3D scene ( object ) data
2D scene ( object ) data2D scene ( object ) data
Sorting of image data
Application of visibility techniques
Elimination of hidden lines of image
Generic Hidden Line Algorithm
Display and / or plot results
Sample hidden line algorithm
• The Priority algorithm
This algorithm is also known as the depth or z algorithm. The algorithm is
based on sorting all the faces (polygons) in the scene according to thebased on sorting all the faces (polygons) in the scene according to the
largest z coordinate value of each. This step is sometimes known as
assignment of priorities.
If a face intersects more than one face, other visibility tests besides the z
depth are needed to resolve any ambiguities.
The priority algorithm is based on assigning priorities to the faces in the faceThe priority algorithm is based on assigning priorities to the faces in the face
list. The priority assignment is determined by comparing two faces at any
one time. The priority list is continuously changed and the final list is
obtained after few iterations
• The first face in the face list F1 assigned highest priority.
• F1 is intersected with the other faces in the list, that is F2 to F6
• The intersection between F1 and another face may be an area as in the case of F1 and F4 , an
edge as for faces F1 and F2 , or an empty set (no intersection) as for faces F1 and F6 .
• In the case of an area of intersection (A in Figure), the coordinates of a point C inside A can
be computed (notice the corner points of A are known).
• For both faces of F1 and F4 , and , the two corresponding Zv values of point C can be
calculated and compared. The face with the highest values Zv 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 are assigned priority 1.
F and F intersect in an area.• F1 and F4 intersect in an area.
• Using the depth test, and assuming the depth of F4 is less than that of F1 , F4 is assigned
priority 2.
• When we intersect faces F1 and F5 , we obtain an empty set, that is, no priority assignment is
possible
• In this case, the face F1 is moved to the end of the face list and the sorting process
to determine priorities starts all over again.
• In each iteration, the first face in the face list is assigned priority 1.
• The end of each iteration is detected by no intersection.
• Figure shows four iterations before obtaining the final priority list. In iteration 4, faces F4 to
F6 are assigned the priority 1 first.
• When F4 is intersected with F1 , the depth test shows that F1 has higher priority.
• Thus, F1 is assigned priority 1 and priority of F4 to F6 is dropped to 2.
• Reorder the face and priority lists so that the highest priority is on top of the list. In this
case, the face and priority lists are [F1 F2 F3 F4 F5 F6 ]and [1,1,1,2,2,2]respectively.
HIDDEN SURFACE TECHNIQUES
• Z-buffer algorithm
• Warnock’s algorithm
The z-buffer algorithm
This is also known as the depth-buffer algorithm. In addition to the frame
(refresh) buffer, this algorithm requires a z buffer in which z values can be
sorted for each pixel.
The z buffer is initialized to the smallest z value, while the frame buffer isThe z buffer is initialized to the smallest z value, while the frame buffer is
initialized to the background pixel value. Both the frame and z buffers are
indexed by pixel coordinates (x, y). These coordinates are actually screen
coordinates. The z-buffer algorithm works as follows. For each polygon in the
scene, find all the pixels (x, y) that lie inside or on the boundaries of the polygon
when projected onto the screen. For each of these pixels, calculate the depth z
of the polygon at (x, y). If z>depth (x, y), the polygon is closer to the viewing eyeof the polygon at (x, y). If z>depth (x, y), the polygon is closer to the viewing eye
than others already stored in the pixel. In this case, the z buffer is updated by
setting the depth (x, y) to z. Similarly, the intensity of the frame buffer location
corresponding to the pixel is updated to the intensity of the polygon at (x, y).
After all the polygons have been processed, the frame buffer contains the
solution.
WARNOCK ALGORITHM
�Hidden surface problem by recursively
Subdividing the image into sub images.Subdividing the image into sub images.
�Each window is subdivided into four sub
windows and applied same solution
technique to every window.
�The recursion terminates if the hidden
surface problem can be solved for all the
windows.
�Window is recursively subdivided unless it
contains two polygon. In such case,
comparing the Z depth of the polygons
determines which one hides the other.
HIDDEN SOLID REMOVAL
• Ray tracing algorithm
Ray tracing algorithms – based on “brute-force” technique, the light is traced backRay tracing algorithms – based on “brute-force” technique, the light is traced back
from the observer to the object as the image of the object is created. The ray travels
through the center of all pixels on the raster grid. Determine which parts of the object
are intersected with the ray, and all intersections are calculated and sorted in depth.
(simplicity and reliability)
SHADING
• Gouraud (smooth) Shading – light intensities are computed at each
vertex. A bilinear interpolation of the intensity across each face producesvertex. A bilinear interpolation of the intensity across each face produces
Gouraud shading.
Disadvantages: appearance a discontinuous slope for the intensity at the edges of
faces. Gouraud shading gives the appearance of lighter edges. These lighter-
appearing edges are an optical illusion, called Mach bands, which occur when the
slope (rate-of-change) of intensity abruptly changes.
• For the trapezoid shown in the accompanying figure, find the intensity at the point P (5, 2),using Gouraud shading and scan lines parallel to BC. The averaged intensities at the fourvertices are:
• Phong Shading uses a bilinear interpolation for the normal vector, instead
of the bilinear interpolation of the intensity I used for Ground shading.
That is, for Phong shading the I terms in scan-line equation are replaced by
corresponding normal vector terms.
Because three components of the normal vector and the cosine functions
are calculated at each point, the Phong shading model requires a longer
computation time than the Gouraud model.computation time than the Gouraud model.
However, the Phong model smoothes surfaces more realistically because it
is interpolating the normal vector, not just intensities determined from the
normal vectors to flat faces.
COLOURS
The description of colour generally includes three properties: Hue, saturation and
brightness, defining a position in the colour spectrum, purity and the intensitybrightness, defining a position in the colour spectrum, purity and the intensity
value of a colour.
• Colour models
1. RGB (Red, Green, Blue) colour model [colour CRT monitors]
2. CMY (Cyan, Magenta, Yellow) colour model [colour-printing devices]
3. YIQ colour model [TV colour system]
4. HSV (hue, saturation, value) colour model, also called HSB (brightness) model.
• CMY model
The RGB and CMY colour models are complemented to each other.
Where ‘1’ represents the colour of white.
Another colour model CMYK (K denotes black) is used in the four-color
hardcopy devices. Black is used in place of equal amounts of C, M, and Y.
YIQ model
It is used in commercial colour-TV broadcasting and is therefore closely related
to colour raster graphics. The RGB-to-YIQ mapping is defined as
The HSV model allows the user to specify the hue (0°~360°), saturation (0~1), and value
(brightness 0~1) of a colour.