Chapter 13
Hidden Entities Removal

         |   •|
        |||   |  •|
       || |   || |
     |||•||| |•|||
    |||||||| ||•|
  ||--•||•|  •
 ---- ••||
 o. --- |||
     ---

13.1 Point Hidden by Plane

13.2 Point Hidden by Polygon

Point-in-Polygon Test

Normal to a Polygon

Choose 3 consecutive noncolinear vertices v1, v2, v3

Normal: N = (v1 , v2 ) × (v2 , v3 )

Front normal: vertex listed in clockwise order |----------------------------------------|
|    --||||--|||           -------       |
|||-|||||   --           v3        v2    |
||      |||--                       |    |
|      ||||                         |    |
|                                   |    |
|   v1------- v2                   v1    |
|              |                  ||     |
|              |                  |||    |
|              |               -|||      ||
|              |             |||--|||||-||
|             v3           |||| ||||     |
|----------------------------------------|

Minmax Testing

Simple tests that may eliminate the need to more complex tests

Linear extents disjoint along z (simplified front/behind test).              ----||----------------zmax2
Y|         Z       ||||||
 ||     ||           |||
 |    ------------------------zmin2
 |  ---   ---- --------     zmax1
 |----------------------zmin1
 -----------------||| X

Bounding box/rectangular extent disjoint along x or along y . Y
||        |        |
|         |        |
|         |        |
|         |        |        |||
|        |Z        |      ||| ||
|----------------||---------   ||
|   ---   |   |||||||      -----||
|---------||||--|-|-------     ---
----------|------||| X

13.3 Back-Face Culling

            -------
   ---------- ---
||--        ---
 |||       -----
   |||         -----
     |||         ----
       |||   -----
         ||---

13.4 Apple’s Hidden-Line Algorithm

13.5 Visible-Surface Ray Casting

Follow a ray from the eye through a pixel to determine the object visible in the pixel.               -----|
    --|--|--|---|   |            ||||-||
    | |  |  |---|---|      ----||-  |||--
    |-|--|---- |||||-------      |||-
 o. ----------|•--|---|
    | |  |  |   |   |
    |-|--|--|---|---|
    |----|  |   |   |
         -------|---|

13.6 Z/Depth Buffer

||--|  |--|-|--|--|--|--|--|  |-|--|--|--|--|--|--|
||--|  |--|-|--|--|--|--|--|  |-|--|--|--|--|--|--|
5|--|  |--|-|--|--|--|--|--|  |-|--|--|--|5-|--|--|
55|  |  |  | |  |  |  |  |  |  | |  |  |5#|5#|  |  |
555|--|  |--|-|--|--|--|--|--|  |-|--|5-|5-|5-|--|--|
||--|  |--|-|--|--|--|--|--|  |-|--|--|--|--|--|--|
5555|--|  |--|-|-2|3-|4-|5-|--|  |-|-5|2-|3-|4-|5-|--|
55555|--|  |--|-|-3|4-|5-|6-|--|  |5|-5|3-|4-|5-|6-|--|
55555|  |  |  | |#4|5#|6#|7#|  |  |5|#5|4#|5#|5#|7#|  |
||--|  |--|-|-5|6-|7-|8-|--|  |-|--|5-|6-|7-|8-|--|
||--|  |--|-|--|--|--|--|--|  |-|--|--|--|--|--|--|
||--|  |--|-|--|--|--|--|--|  |-|--|--|--|--|--|--|

Coherence in Midpoint Line Algorithm

Coherence in Scanline Fill Algorithm

Resources

13.7 List-Priority Algorithms

Painter’s Algorithm

Depth Sort

Different tests performed in order of increasing complexity.

z-minimum of polygon > z-maximum of other polygons Y
 |         Z        ||||||||||||||
|||    ||------------|||||||-------- zmin
 |   -----------------------
 | ---   ----   ------- z‘max
 |-----------------||
                 -|   X

Y                    |||
|   |        |      || ||
|   |        |     ---  ||
--------||||-------- -----|
|   | ||||||||            -
----Z||||--|-|------
||| |        |
|-  |        |
|   |        |
|   |      |||
-----------| | X

Polygon’s projection is x-disjoint or y-disjoint from all the other polygons projections.

Polygon behind the planes containing the other polygons.                                 |||
                              ---
                           ----
                        ---- |-----
                     ----|   |    ----
                    ----------------||-|--
Y                   | -----      ----- |||||--
 |         Z        |----------      ----- || |
|||    |||            -------------      -----|
 |   ---                  ----------|        --
 |----                        ------|
 |---------------||||             ---
                      X

Y            |||||||||
|          ||  |||||||||||||
|         ||||  ||||||||||
|        ||  |    |||||||
|       ||    |     ||||
| Z    ||     -|     ||
||    || ------
|     ---
|
|---------||
         ||- X

Projected polygon does not intersect with the projections of other polygons.

Intersect polygon plane with the planes of the other polygons. Use these boundaries to partition the polygon.       -------------------|
       |   -----  --------|
       |   --   ---
       |   | ----
      --   ---
   ----|   -
 ---   -   |
--  ---|   |
  ---  |---

--------------||---------|
z=4              |         |
       |--------------------
      ||                   |
z=5----- |                   |
       |-------|---------|-|
               |         |
               |         |
               |         |
--------------||---------|
z=6

Above tests might fail to detect ordered polygons.

13.8 Scan-Line Hidden Surface Elimination Algorithm

Polygon Table

Edge Representation

             |--------------|---------------|
             |###x##########|###############|
y       ---||------max------|-----N---------|
  max        |##############|###############|
             ------dx--------polyg------id--

Edge Table (ET): sorted by (y,x)

7|--|-|--|--|--|
--  | |  ---|  |
6---|-|-----||-|
||-------|--||-|
5|  -----|  || |
4|----|--|--|-||
||  --| ||  | ||
3|--|---||--|-||
||--|-|--|--|---
2|  | ||--  | --
1|--|-||----|--|
-|  | || | --- |
0---------------
01  2 3  4  5  6 ||------   |-----|------|  |------|------
060|##4##| |||##5##|##4###||||##5###|#6###|
7|-------  ------|-------  -------|------
0A1|-A---|   |--1--|--B---|  |-0.2--|-B---|
6
5|------|
254|##5###|
4|------|
0.75B-0.25|-A----|
3|#####|
2036|--3---
0.5A-0.5|-B---|
1
|
0

13.9 Warnock’s Algorithm

Recursively divide the projection plane area into 4 until:

|----|-------------------
|    |                  |
| -- |                  |
|----|                  |
--  -|                  |
-    |                  |
-    |-                 |
-   -|------------      |
-----|-------------------
-   -|  --       |      |
----||----       |      |
|   ||           |      |
|   ||------------      |
|    |                  |
|    |                  |
|    |                  |
|    |                  |
-------------------------  |----|---------|---------
|    |         |        |
11--- |    1    |   1    |
|- --|         |        |
|--------------|---------
|    |-        |        |
1    |---------|-- 1    |
|   -| -       | |      |
|----|---------|---------
|   -|  --     | |      |
1---||----     | | 1    |
|   ||         | |      |
|--------------|---------
|    |         |        |
|    |         |        |
11    |    1    |   1    |
|----|---------|--------|

|----|---------|---------
|    |         |        |
11 -- |    1    |   1    |
|----|         |        |
||--------|----|---------
1|1  | 1  | 1  |        |
1|--------|----|   1    |
||  -|----|----|--      |
1|2--|----|-1--|---------
||  -|  --|    | |      |
1|--------|-1--| |      |
1|  ||    |    | | 1    |
1|1----1--|-1--|---------
|    |         |        |
|    |         |        |
11    |    1    |   1    |
|    |         |        |
-------------------------  |----|---------|---------
|    |         |        |
11--- |    1    |   1    |
|- --|         |        |
||--------|----|---------
1|1  |-1  | 1  |        |
1|------|-|----|-- 1    |
1|2 ----|1- 1  | |      |
||-|-|--|-|----|---------
11-2----|-- 1  | |      |
11-|----|-|----| | 1    |
1|1 || 1  | 1  | |      |
||--------|----|---------
|    |         |        |
|    |         |        |
11    |    1    |   1    |
|----|---------|--------|