0% found this document useful (0 votes)
45 views

Unit Iv: Hidden Surfaces or Lines Determination Algorithms and Curves

This document discusses various algorithms used for hidden surface determination and 3D curve projection. It covers object-space and image-space visibility determination methods. It also describes algorithms for backface detection, depth buffering, A-buffering, scanline rendering, painter's algorithm, Warnock area subdivision, and Bézier curves. Key steps of the depth buffer, A-buffer, scanline and painter's algorithms are provided.

Uploaded by

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

Unit Iv: Hidden Surfaces or Lines Determination Algorithms and Curves

This document discusses various algorithms used for hidden surface determination and 3D curve projection. It covers object-space and image-space visibility determination methods. It also describes algorithms for backface detection, depth buffering, A-buffering, scanline rendering, painter's algorithm, Warnock area subdivision, and Bézier curves. Key steps of the depth buffer, A-buffer, scanline and painter's algorithms are provided.

Uploaded by

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

HI DDEN SURFACES OR LI NES

DETERMI NATI ON ALGORI THMS AND CURVES


UNIT IV
Given a set of 3-D surfaces to be projected
onto a 2-D screen, obtain the nearest surface
corresponding to any point on the screen.

Two types of methods used:
Object-space methods :- Compares parts of objects to
each other to determine which surfaces should be
labeled as visible
Image Space methods:-Visibility is decided point by
point at each pixel position on the projection plane






Plane Equation






ax + by + cz + d = 0
Back-face Detection
In a solid object, there are surfaces which are facing
the viewer (front faces) and there are surfaces which
are opposite to the viewer (back faces).
Each surface has a normal vector. If this vector is
pointing in the direction of the center of projection,it
is a front face and can be seen by the viewer.
If it is pointing away from the center of projection,
it,is a back face and cannot be seen by the viewer





If a normal vector N =(A,B,C) to a surface
If Vector v is the viewing direction from the eye
(camera)
Then the surface is backface if V.N>0
Let V = (0, 0, Vz) and
N = Ai + Bj+ Ck

Then V.N = Vz.C
Let Vz be +ve(view along +ve Z-direction),Check the sign of C


The test
In a right handed viewing system with viewing
direction along with ve Z axis
Backface if C<= zero
If the z component of the vector is negative, it is a
back face

Depth-Buffer Method (Z-Buffer Method)
This method requires 2 buffers:
one is the image buffer and the other is called the
z-buffer (or the depth buffer).
As surfaces are processed, the image buffer is used to
store the color values of each pixel position
the z-buffer is used to store the depth values for each
(x,y) position.



Algorithm
1. Initially each pixel of the z-buffer is set to the depth value zero
2. The image buffer is set to the background color.
3. Surfaces are rendered one at a time.
4. For the first surface, the depth value of each pixel is
calculated.
5. If this depth value is smaller than the corresponding depth
value in the z-buffer (ie. it is closer to the view point), both the
depth value in the z-buffer and the color value in the image
buffer are replaced by the depth value and the color value of
this surface calculated at the pixel position.
6. Repeat step 4 and 5 for the remaining surfaces.
7. After all the surfaces have been processed, each pixel of the
image buffer represents the color of a visible surface at that
pixel.

For horizontal scanline
Z1=Z-(a/c)

For Vertical Scanline
Z1=Z+(b/c)


Z-Buffer Example

1. Initialize:

Draw blue polygon first:

Draw yellow polygon second:

Alternatively, draw yellow polygon first:

Draw blue polygon second:

A Buffer Method
Extension of Z buffer which overcomes the draw
backs of Z buffer algorithm.
Ie.it can find only one visible surface at each pixel
positions.
it deals with opaque surfaces and cannot accumulate
intensities vales of more than one surface.
A buffer method expands the depth buffer so that
each position in the buffer can reference a linked list
of surfaces
A- buffer has two fields
Depth field (stores -ve or +ve real number)
Intensity field(store surface intensity or pointer value)




If the depth field is positive single surface
If the depth field is negative- indicates multiple surfaces
contribution to pixel intensity
Surface information in the A-buffer includes:
RGB intensity components
Opacity parameter
Depth
Percent of area coverage
Surface identifier
Scan Line method
Scan line algorithm for filling polygon interiors,
instead we deal with multiple surfaces .
All polygon surfaces intersecting the scan line are
examined to determine which are visible
It use tables for various surfaces Edge table and
polygon table
Edge table: contains endpoints, inverse slope and
pointers to the polygon table
Polygon table contains coefficients of the plane
equation ,intensity and pointers to the edge table


We define a flag for each surface to set ON at left
most boundary and OFF on the right most
boundaries
Scan line 1 intersects AB,BC,EH and FG ,Flag S1 is
on while entering AB and OFF at BC
Depth is calculated when two or more flag is set ON
Depth is calculated using the Coefficients of the
plane.
If S1 depth<s2 depth intensity of s1 is loaded into the
frame buffer


Painters Algorithm (Depth Sorting)
Surfaces are sorted in order of decreasing depth
Surfaces are scan converted in order, starting with
the surface of greatest depth

Sorting can carried in both image space and object
space
Scan conversion are made in image space

Assuming we are viewing along the z axis.
Surface S with the greatest depth is then compared
to other surfaces in the list to determine whether
there are any overlaps in depth
If no depth overlaps occur, S can be scan converted
This process is repeated for the
next surface in the list




if depth overlap is detected, we need to make some
additional comparisons to determine whether any of
the surfaces should be reordered

Test for reordering the surfaces
a.The bounding rectangles in the xy plane for the 2 surfaces
do not overlap
b. The surface S with greater depth is completely behind the
overlapping surface relative to the viewing position.
c. The overlapping surface is completely in front of the
surface S with greater depth relative to the viewing
position.
d. The projections of the 2 surfaces onto the view plane do not
overlap.
If any of the above tests is passed (true) , then the
surfaces no need to be re-ordered.




Warnock Algorithm(Area-Subdivision)
The area-subdivision method takes advantage of area
coherence in a scene by locating those view areas
that represent part of a single surface.
The total viewing area is successively divided into
smaller and smaller rectangles until each small area
is simple
ie. it is a single pixel, or is covered wholly by a part of
a single visible surface or no surface at all.





4 possible surface relationship
We first classify each of the surfaces, according to
their relations with the area:
Surrounding surface - a single surface completely encloses the
area
Overlapping surface - a single surface that is partly inside and
partly outside the area
Inside surface - a single surface that is completely inside the
area
Outside surface - a single surface that is completely outside the
area.




if any of the following condition is true, then, no
subdivision of this area is needed.
a. All surfaces are outside the area.
b. Only one surface is inside, overlapping or
surrounding surface is in the area.
c. A surrounding surface obscures all other
surfaces within the area boundaries.

For cases b and c, the color of the area can be
determined from that single surface



Test a is carried out by checking the bounding rectangles
of all surfaces against the area boundaries
Test b can use bounding rectangles against the XY plane
C is tested to order surfaces according to their minimum
depth from the
view plane

Curves Parametric curves
3 basic representation strategies:
Explicit: y = mx + b
Implicit: ax + by + c = 0
Parametric: P = P0 + t (P1 - P0)


Advantages of parametric forms
More degrees of freedom
Directly transformable
Dimension independent
No infinite slope problems
Easy to express in vector and matrix form
Common form for many curves and surfaces

Curve
Parametric linear curve
p(u) = au + b [ u 1]

x = axu + bx
y = ayu + by
z = azu + bz
Parametric cubic curve [u
3
u
2
u 1 ]
p(u) = au3 + bu2 + cu + d
x = axu3 + bxu2 + cxu + dx
y = ayu3 + byu2 + cyu + dy
z = azu3 + bzu2 + czu + dz


Parametric function
P(u) = B
n,i
(u)p
i
Where

B
n,i
(u) = . n!. u
i
(1-u)
n-i

i!(n-i)! 0<= u<= 1

For 3 control points, n = 2
P(u) = (1-u)
2
p
0
+ 2u(1-u) p
1
+ u
2
p
2


For four control points, n = 3
P(u) = (1-u)
3
p
0
+ 3u(1-u)
2
p
1
+ 3u
2
(1-u)p
2
+ u
3
p
3


| |
1 0 ) 1 (
3
) 1 ( 3 ) 1 ( 3 ) 1 ( ) (
0 0 0 1
0 0 3 3
0 3 6 3
1 3 3 1
1 ) (
3
3
0
4
3
3
2
2
2
1
3
4
3
2
1
2 3
s s
|
|
.
|

\
|
=
+ + + =
=
(
(
(
(

(
(
(
(

t , P t t
i

P t P -t t P -t t P t t Q
G M T
P
P
P
P
t t t t Q
i
i i
i
b b
3
)) 1 ( ( t t +
Bzier curves
P
i
is called control point for the Bzier curve.
By connecting all control points with lines, we receive a
polygon - starting in P
0
and finishing in P
n
- that is called
Bzier polygon.
The Bzier curve is completely contained in the hull built
from the Bzier polygon.
Properties of Bezier Curve
The starting point of the curve is P
0
and the ending
point is P
n
.
Normally, the other control points are not
positioned on the curve.
The Bzier curve is completely contained in the
convex hull built from the control points.
If and only if all control points lie on the curve it is a
straight line.
The start (end) of the curve is tangent to the first
(last) section of the Bzier polygon.
Convex hull
Convex polygon formed by connecting the control points of the
curve.
Curve resides completely inside its convex hull

De Casteljau Algorithm
With the de Casteljau algorithm it is possible to
construct a Bzier curve or to find a particular point
on the Bzier curve

To construct a Bzier curve we have to find several
points through which the curve will go. These points
depend on a parameter t "element" 0,1



B-SPLine

FRACTALS
Fractals are geometric objects.
Many real-world objects like ferns are shaped like
fractals
Shapes containing copies of itself
Details present at any scale
A fractal consists of multiple (transformed) copies of
itself
Shape that is recursively constructed or self-similar
Go on for ever

Koch Fractals (Snowflakes)
Iteration 0 Iteration 1 Iteration 2 Iteration 3
Generator
1/3 1/3
1/3
1/3
1
Fractal Tree
Iteration 1 Iteration 2 Iteration 3 Iteration 4 Iteration 5
Generator
Fractal Fern
Generator
Iteration 0 Iteration 1 Iteration 2 Iteration 3

You might also like