10 - Hidden Surface Removal

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

34 Terms

1
New cards

Why hidden surface removal?

Each part goes through the pipeline independently, so without HSR whatever is drawn last wins. Show only front surfaces and skip work on hidden ones.

2
New cards

Back-face culling

On a closed object, drop faces pointing away from the viewer early in the pipeline.

3
New cards

How much does back-face culling save?

Roughly half the polygons, up to about half the rendering time.

4
New cards

Back-face test with v = look direction (look-at - eye)

Back face if n . v > 0.

5
New cards

Back-face test with v = polygon to eye

Back face if n . v < 0.

6
New cards

Back-face culling exam trap

The sign depends on which way v points. Always say how v is defined.

7
New cards

Is back-face culling full HSR?

No. Only fully works for a single convex object; with several or concave objects, front faces can still overlap.

8
New cards

Painter's algorithm

Sort triangles back to front and draw from the back, so nearer ones paint over farther ones.

9
New cards

Painter's algorithm problems

Cyclic overlaps (can't sort without splitting), O(n log n) sorting, wasted drawing of covered things.

10
New cards

Z-buffer setup

Same resolution as the screen; initialize every entry to the farthest value (far plane).

11
New cards

Z-buffer per-pixel rule

If the new z' is closer than the stored value, write the colour and update the buffer; otherwise ignore it.

12
New cards

How does the z-buffer get depth inside a polygon?

Interpolates z' from the projected vertices during rasterization.

13
New cards

Z-buffer vs painter's

Z-buffer handles cyclic overlaps, needs no sorting. Costs buffer memory and overdraw. Simple and in hardware.

14
New cards

Z-buffer bins

Stores integers (e.g. 32 bits = 2^32 values), so depth is cut into B bins; two z in the same bin look identical.

15
New cards

Orthographic z bin size

Delta z = (f - n) / B, linear.

16
New cards

Z-fighting

Two surfaces closer than one depth bin (especially co-planar) get the same depth; the buffer can't tell which is in front, so pixels flicker between both.

17
New cards

Why perspective makes z-fighting worse

z' = n + f - fn/z is non-linear: precision bunched near the near plane, bins grow with distance.

18
New cards

Perspective bin size at distance z

Delta z_world ~ (z^2 / fn) Delta z'. At z = f it's about (f/n) Delta z'.

19
New cards

Should you set n = 0?

Never. Bins blow up.

20
New cards

Avoiding z-fighting

Bracket the scene tightly (n as large as possible, f no bigger than needed, small f/n), avoid co-planar overlapping polygons, use more depth bits or a float depth buffer.

21
New cards

Z-fighting (review Q)

Finite depth precision: surfaces closer than one bin get the same stored depth and flicker. Worse with perspective. Fix with tight n/f (large n, never 0), no co-planar overlaps, more depth bits.

22
New cards

BSP tree idea

Each polygon's plane f(p) = 0 splits space into + and - sides. Eye on + side: draw - side, then the polygon, then + side.

23
New cards

BSP tree structure

Binary tree; each node holds a polygon and its plane. Plus subtree = polygons on its + side, minus subtree = - side.

24
New cards

BSP big win

Independent of eye position: build once, draw correctly from anywhere. No z-buffer needed (Doom used it).

25
New cards

BSP draw, eye on minus side

draw(plus), draw poly, draw(minus).

26
New cards

BSP draw, eye on plus side

draw(minus), draw poly, draw(plus).

27
New cards

Which side of a plane is a point on?

Plug it into the plane equation: f(p) > 0 is the + side, < 0 the - side.

28
New cards

BSP mini-example

Plane x + 2y + 2z - 2 = 0, eye (1, 0, 1): f = 1 > 0, eye on + side, draw negative side first.

29
New cards

BSP construction

Pick a root, insert the rest: all vertices positive -> plus subtree, all negative -> minus subtree, recursively.

30
New cards

BSP straddling polygon

Split it and insert each piece on its side. A polygon in the plane can go either side.

31
New cards

BSP efficiency

Tree size (display visits every node). Minimize splits, which depends on insertion order.

32
New cards

Choosing BSP root polygons

No efficient optimal algorithm. Pick randomly, or try ~5 random candidates and use the one with fewest splits.

33
New cards

BSP downside

Splitting can increase the polygon count a lot.

34
New cards