Sei sulla pagina 1di 22

Hidden Surface Removal

Methods
Visibility
Introduction
• A set of 3-D surfaces are to be projected onto
a 2-D screen.
• Hidden surface removal or Visible-surface
detection methods are used to identify those
parts of a scene that are visible from a chosen
viewing position.
• Correct visibility
– when multiple opaque polygons cover the same
screen space, only the closest one is visible.
• There are many algorithms developed and still
being developed for hidden surface removal.
• Deals with the projected images of the
objects and not directly with objects.
• Visibility is determined point by point at each
pixel position on the projection plane.
• It is a discrete method.
• Accuracy of the calculation is bounded by the
display resolution.
• A change of display resolution requires re-
calculation
Back face Removal
• Only those faces that are facing the camera (centre of projection) are
visible. The normal from a polygon face indicates the direction in which it
is facing. Thus face can be seen if some component of the normal N is
along the direction of projector ray P.
• The polygon normal of a …
 front-facing polygon points towards the viewer
 back-facing polygon points away from the viewer

back-facing

front-facing
Detecting Back-face Polygons
We can simplify test this by considering the normal vector N to a
polygon surface. In general, if V is a vector in the viewing
direction from the eye (camera) position, then this polygon is a
back face if

If (N  V) > 0  “back-face” back

If (N  V) ≤ 0  “front-face”
V = view vector

front
Depth-Buffer Method
(Z-Buffer Method)
• It compares the surface depths at each pixel
position on the projection plane.
• Object depth is usually measured from the view
plane along the z axis of a viewing system.
• Each surface of a scene is processed separately,
one point at a time across the surface.
• Sorting is done at the pixel level
Rule: Only draw a polygon at a pixel if it is closer
than a polygon that has already been drawn to this
pixel.
This method requires 2 buffers:
1) Depth buffer or z-buffer:
• To store the depth values for each (X, Y) position, as
surfaces are processed.
• 0 ≤ depth ≤ 1
2) Frame Buffer:
• To store the intensity value or Color value at each
position (X, Y).

The z-coordinates are usually normalized to the range


[0, 1]. The 0 value for z-coordinate indicates back face
and 1 value for z-coordinates indicates front face.
Algorithm
1. depthbuffer(x,y) = 0
framebuffer(x,y) = background color
2. Process each polygon one at a time
 For each projected (x,y) pixel position of a
polygon, calculate depth z.
 If z > depthbuffer(x,y)
compute surface color,
set depthbuffer(x,y) = z,
framebuffer(x,y) = surfacecolor(x,y)
Z-buffer

DAM Entertainment

Color buffer Depth buffer


Example
• The Final Image

Z = 0.3

Z = 0.5
• Step 1: Initialize the depth buffer

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0
• Step 2: Draw the polygon with depth 0.3

0 0 0 0

0 0 0 0

0.3 0.3 0 0

0.3 0.3 0 0
• Step 3: Draw the polygon with depth 0.5

0 0 0 0

0 0.5 0.5 0

0.3 0.5 0.5 0

0.3 0.3 0 0
Advantages
 It is simple to implement.
 It reduces the speed problem if implemented in hardware.
 It processes one object at a time.

Disadvantages
 It requires large memory (uses 2 buffers).
Database Structures for Graphics Modelling

Functions:
• To manipulate the data on screen, such as
zooming, panning.
• To interact with the user
• To edit the geometry
• To evaluate the properties like areas, volumes,
inertias etc.
• To provide additional information like
manufacturing specifications.
Database Structures for Graphics Modelling
The graphic data bases may contain graphical information such as point coordinates.
Alphanumerical information such as manufacturing requirements or some
procedural type.
Typical data that would normally be contained in drawing file is of two types:

Organizational data Technological data

 Identification number  Geometry


 Drawing number
 Dimensions
 Design origin and status of changes
 Current status
 Tolerances
 Designer name  Surface finishes
 Date of design  Material specifications
 Scale  Manufacturing procedures
 Type of projections  Inspection procedures
 Company
Database Structures for Graphics Modelling

Records that are contained in a graphical database are maintained


as random access files and all the files present are linked by
means of pointers.
Head record: the record, to and from which a number of pointers
link the entire data required for the component in a coherent
form.
Database Structures for Graphics Modelling

Boundary Representation or B-rep: A solid is first broken into edges, which are
further broken into surfaces and vertices for completely defining the object.
Each vertex being indicated by means of its Cartesian coordinates X, Y, and
Z.
Relational database: When data is organized in a database it is required to
ensure the basic integrity of the data in terms of eliminating redundancy
and security problems while maintaining the standards and ease of use.
The most common form in which the graphical database is organized is in
terms of number of tables that are interlinked by relations.

Potrebbero piacerti anche