UNIT 7 Visible Surface Determination
UNIT 7 Visible Surface Determination
com
Visible Surface
1
https://genuinenotes.com
Visible Surface Detection (Hidden
Surface Removal) Method
It is the process of identifying those parts of a scene that
are visible from a chosen viewing position. There are numerous
algorithms for efficient identification of visible objects for
different types of applications. These various algorithms are
referred to as visible-surface detection methods. Sometimes
4
https://genuinenotes.com
Object-Space methods
Object-Space methods
14
https://genuinenotes.com
Case-III:
For other objects, such as the concave polyhedron in Fig., more
tests need to be carried out to determine whether there are additional
faces that are totally or partly obscured by other faces. 17
Numerical https://genuinenotes.com
# Find the visibility for the surface AED in rectangular pyramid where an
observer is at P (5, 5, 5).
Solution
Here,
AE = (0-1)i + (1-0)j + (0-0)k = -i + j
AD= (0-1)i + (1-0)j + (1-0)k =-i + k
Step-1:
Normal vector N for AED
Case-II
Step-2: If observer at P(5, 5, 5) so we can construct the view vector V from
surface to view point A(1, 0, 0) as:
V = AP = (5-1)i + (5-0)j + (5-0)k = 4i + 5j + 5k
Step-3: To find the visibility of the object, we use dot product of view vector V
and normal vector N as:
V.N = (4i + 5j + 5k).(i + j + k) = 4+5+5 = 14> 0 18
19
https://genuinenotes.com
• # Find the visibility for the surface AED in rectangular pyramid
where an observer is at P (0,0.5, 0).
21
https://genuinenotes.com
22
https://genuinenotes.com
3. After all pixels and surfaces are compared, draw object using X,Y,Z from depth 25
and intensity refresh buffer.
https://genuinenotes.com
Let depth z’ at (x + 1 , y) Z Z’
z’ = {-A(x+1) – By – D}/c
z’ = {-Ax –By – D-A}/c
z’ = (-Ax –By – D)/c - A/c
or
26
z’ = z – A/c………..(ii)
https://genuinenotes.com
Class Work
Q.N.1> Write a procedure to fill the interior of a given ellipse
with a specified pattern. (2070 TU)
.
Q.N.2> What do you mean by line clipping? Explain the
30
https://genuinenotes.com
A – Buffer Method
• The A-buffer (anti-aliased, area-averaged, accumulation
buffer) is an extension of the ideas in the depth-buffer
method (other end of the alphabet from "z-buffer").
• A drawback of the depth-buffer method is that it deals only
with opaque(Solid) surfaces and cannot accumulate intensity
A – Buffer Method
• The A-buffer expands on the depth buffer method to allow
transparencies. The key data structure in the A-buffer is the
accumulation buffer
A – Buffer Method
If depth is >= 0, then the surface data field stores the depth
A – Buffer Method
• The A-buffer can be constructed using methods similar to
those in the depth-buffer algorithm. Scan lines are processed
to determine surface overlaps of pixels across the individual
scan lines. Surfaces are subdivided into a polygon mesh and
clipped against the pixel boundaries. Using the opacity factors
35
https://genuinenotes.com
Class Work
Q.N.1 > Explain with algorithm of generating curves. (TU 2071)
Q.N.2 > Set up a procedure for establishing polygon tables for
any input set of data defining an object. (TU 2071)
Q.N.3 > Explain the window to view port transformation with its
36
https://genuinenotes.com
38
https://genuinenotes.com
39
https://genuinenotes.com
43
https://genuinenotes.com
Scan-Line Method
• This image-space method for removing hidden surfaces is an
extension of the scan-line algorithm for filling polygon
interiors where, we deal with multiple surfaces rather than
one.
• Each scan line is processed with calculating the depth for
45
https://genuinenotes.com
Scan-Line Method
• To facilitate the search for surfaces crossing a given scan line,
we can set up an active list of edges from information in the
edge table that contain only edges that cross the current scan
line, sorted in order of increasing x.
• In addition, we define a flag for each surface that is set on or
46
https://genuinenotes.com
Scan-Line Method
DATA STRUCTURE
• A. Edge table containing
• Coordinate endpoints for each line in a scene
• Inverse slope of each line
• Pointers into polygon table to identify the surfaces bounded by each line
• B. Surface table containing
Note :
• The edges are sorted in order of increasing x
47
• Define flags for each surface to indicate whether a position is inside or
outside the surface
https://genuinenotes.com
Scan-Line Method
I. Initialize the necessary data structure
1. Edge table containing end point coordinates, inverse slope and
polygon pointer.
2. Surface table containing plane coefficients and surface intensity
3. Active Edge List
Scan-Line Method
• For scan line 1
• The active edge list contains edges AB,BC,EH, FG
• Between edges AB and BC, only flags for s1 == on and
between edges EH and FG, only flags for s2==on
• no depth calculation needed and corresponding surface
intensities are entered in refresh buffer
• For scan line 2
• The active edge list contains edges AD,EH,BC and FG
Scan-Line Method
Problem:
Dealing with cut through surfaces and
cyclic overlap is problematic when
used coherent properties
• Solution: Divide the surface to
50
https://genuinenotes.com
Class Work
Q.N.1> What do you mean by homogeneous coordinates? Rotate a triangle
A(5,6), B(6,2) and C(4,1) by 45 degree about an arbitrary pivot point (3,3).
(TU 2072)
Q.N.2> Given a clipping window P(0,0), Q(30,20), S(0,20) use the Cohen
Sutherland algorithm to determine the visible portion of the line A(10,30)
51
Binary Space Partitioning
https://genuinenotes.com
(BSP)
• Binary space partitioning is a 3-D graphics programming
technique of dividing a scene into two recursively using
hyperplanes.
• In other words, a 3-D scene is split in two using a 2-D plane,
then that scene is divided in two using a 2-D plane, and so on.
52
Binary Space Partitioning
https://genuinenotes.com
(BSP)
• binary space partitioning (BSP) is a method
for recursively subdividing a space into convex
sets by hyperplanes. This subdivision gives rise to a
representation of objects within the space by means of a tree
data structure known as a BSP tree.
(BSP)
• Previous list priority algorithms fail in a number of cases non
of them is completely general
• BSP tree is a general solution, but with its own problems
• Tree size
54
https://genuinenotes.com
Binary Space Partitioning Trees
(Fuchs, Kedem and Naylor `80)
• More general, can deal with inseparable objects
• Automatic, uses as partitions planes defined by the scene
polygons
• Method has two steps:
• building of the tree independently of viewpoint
55
https://genuinenotes.com
{1, 2, 3, 4, 5, 6}
A set of polygons 56
https://genuinenotes.com
57
https://genuinenotes.com
58
https://genuinenotes.com
60
https://genuinenotes.com
Back-to-Front Traversal
void traverse_btf(Tree *t, Point vp)
{
if (t = NULL) return;
endif
if (vp in-front of plane at root of t)
traverse_btf(t->back, vp);
draw polygons on node of t;
61
https://genuinenotes.com
Representation of Polygons
Representation of Polyhedra
65
https://genuinenotes.com
Recap
• A BSP is a sequence of binary partitions of space
• Can be built recursively or incrementally
• Choice of plane used to split is critical
• BSP trees are hard to maintain for dynamic scenes
octree
• octree is a tree data structure in which each internal node has
exactly eight children. Octrees are most often used to
partition a three-dimensional spaceby recursively
subdividing it into eight octants.
• Octrees are the three-dimensional analog of quadtrees. The
67
https://genuinenotes.com
octree
Ray tracing
• Ray tracing is a rendering technique for generating
an image by tracing the path of light as pixels in an image
plane and simulating the effects of its encounters with virtual
objects.
• The technique is capable of producing a very high degree of
69
https://genuinenotes.com
Ray tracing
• This makes ray tracing best suited for applications where
taking a relatively long time to render a frame can be
tolerated, such as in still images and film and television visual
effects, and more poorly suited for real-time applications such
as video games where speed is critical. Ray tracing is capable
70
https://genuinenotes.com
Ray tracing
Ray tracing
• Optical ray tracing describes a method for producing visual
images constructed in 3D computer graphic senvironments,
with more photorealism than either ray casting or scanline
rendering techniques.
• It works by tracing a path from an imaginary eye through
72
https://genuinenotes.com
Chapter 6