Visibility culling Clipping - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Visibility culling Clipping

Description:

Visibility culling Clipping. The visibility problem. What polygons are visible? ... Outside the volume (view frustum culling) Facing away (back-face culling) ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 24
Provided by: ayel9
Category:

less

Transcript and Presenter's Notes

Title: Visibility culling Clipping


1
Visibility culling Clipping
2
The visibility problem
  • What polygons are visible?
  • There are few visible polygons.
  • Avoid redundant processing
  • Three classes of non visible objects
  • Outside the volume (view frustum culling)
  • Facing away (back-face culling)
  • Occluded (occlusion culling)

3
Visibility culling
4
Visibility culling
View frustum culling
5
Visibility culling
Occlusion culling
View frustum culling
6
Visibility culling
Occlusion culling
View frustum culling
Back-face culling
7
Clipping
  • 2D clipping
  • Line / polygon clipping by the viewport
  • 3D frustum culling
  • Occlusion culling
  • Lines are used for polygons

8
Convex
  • Convex polygon line between every two points
    belong to the polygon.
  • The intersection of two convex regions convex
    region (single).
  • The intersection of convex and concave ?
  • Clipping intersection of a polygon with
    rectangle.

9
Clipping endpoints
B
Ymax
A
Ymin
Xmin
Xmax
Ax gt Xmin, Ax lt Xmax
Ay gt Ymin, Ay lt Ymax
10
Clipping lines
  • Both points inside trivially accepted
  • Brute force
  • Calculate the infinite line-edge intersection
  • Check if the intersection is on the edge/line

11
Cohen-Sutherland algorithm
  • Trivial acceptance
  • Trivial rejection
  • Subdivision into two trivial parts
  • Especially effective in two common cases
  • Large viewports
  • Small viewports

12
Cohen-Sutherland algorithm
  • Region coding
  • Assign code to endpoints
  • Simple calculation
  • Sign for bit value
  • Zero for acceptance
  • And for rejection
  • Or for acceptance

13
Cohen-Sutherland example
  • Line AB
  • And(A,B) 0, Or(A,B) ? 0
  • Test A with bottom edge
  • Create AC (rejected) and CB
  • Code(C) 0 ? Choose B
  • Test B with the right/top edge

B
E
D
C
A
14
Cohen-Sutherland
15
Cohen-Sutherland disadvantages
  • Random edge choice
  • Redundant edge-line cross calculations

16
Cyrus-Beck algorithm
  • Put line in a parametric form
  • P(t) P0 (P1 P0)t
  • Calculate 4 line-edge intersections only 1D
  • Check if there is intersection

P1
C0
C1
P0
17
Cyrus-Beck algorithm
  • Denote L(t) P0(P1 ? P0)t, t?0,1 .
  • PiD is a point on the edge LiD with normal NiD.
  • For every vector V colinear with LiD, V?NiD 0.
  • Specifically, for VL(t) ? PiD,
  • 0 NiD?(L(t) ? PiD)

18
Cyrus-Beck algorithm
  • 0 NiD ? (L(t) ? PiD)
  • NiD ? (P0 (P1 ? P0)t ? PiD)
  • NiD ? (P0 ? PiD) NiD ? ((P1 ? P0)t)
  • Solving for t, where ? (P1 ? P0)
  • Works especially fast when rectangle is upright

19
Cyrus-Beck algorithm
  • If ?NiD?? 0, L and LiD are parallel
  • The intersections of L and LiD are computed
  • If ti?0,1, there might be an intersection
  • Based on the sign of ?NiD??, each point is
    classified as PE (potentially entering) or PL
    (potentially leaving)
  • PE with the largest t and PL with the smallest t
    define the intersection

20
Cohen-Sutherland polygons
  • Create a list of vertices v1, , vn
  • Clip against a single infinite edge

21
Cohen-Sutherland polygons
Inside
Outside
Inside
Outside
Inside
Outside
Inside
Outside
p
s
i
s
p
1st Output
2nd Output
s
p
i
p
s
Output
No Output
Output
22
Hierarchical clipping
  • Build hierarchical scene representation
  • The bounding box of root includes the children
  • Test the root node
  • If it is outside, stop and discard everything
  • If its fully inside, render everything
  • Otherwise, test recursively every child

23
Example
1
3
2
6
1
4
5
2
3
5
6
4
Write a Comment
User Comments (0)
About PowerShow.com