1
Tong-Yee Lee
2
3
4
5
3D Clipping
3D Culling
6
Clipping
7
This manner is OK. But, it needs “Division” before clipping.
Sometimes, it is kind of waste.
For example, red color shapes below.
Z = -n
Z=-f
Z=0
8
9
10
Another Trivial Rejection Clipping
w = -z
What does it imply?
Remember if a point is behind eye, we can not
see it!!. i.e., z > 0, means it is behind eye.
So, we can check the fourth item (before division).
If the fourth item is negative, this point is behind
the eye point.
11
Removing Back-Faces
It always culls half
number of input polygons
12
13
A
B
P: output
Inside
Outside
Case 1
A
B
Inside
Outside
P’: output
Case 2
A
B
No output
Case 3
Inside
Outside
A
B
P’: output
first
P: output
second
Case 4
Inside
Outside
14
A
B
15
P’: output
first
A
B
P: output
second
16
A
B
P: output
17
A
B
P’: output
18
A
B
No output
19
A
B
No output
20
21
Polygon Clipping in
Homogeneous Coordinates
(Clipping Space Coordinates
22
Aout != Bout
C’ color is also linearly interpolated
such as
C’(r) = A’ (r)+(B’ (r)-A’(r))*t
C’(g) = A’(g)+(B’(g)-A’(g))*t
…………….
Or even for original 3D position (x,y,z) or texture space (u,v) or normal vector (Nx,Ny,Nz)
23
Case 4
Case 1
Case 2
Case 4
Return #num of vertex
Ex: left: C0=-C3
C0=A0+t(B0-A0)
C3=A3+t(B3-A3)
A0+t(B0-A0) =
-A3-t(B3-A3)
=>>
(-A3-A0)=t(B0-A0+B3-A3)
A0,A1,A2,A3
B0,B1,B2,B3
Ex: left side
24
A
B
P’: output
first
P: output
second
Case 4
Inside
Outside
Ex: left boundary:
C0=-C3
C0=A0+t(B0-A0)
C3=A3+t(B3-A3)
A0+t(B0-A0) =
-A3-t(B3-A3)
=>>
(-A3-A0)=t(B0-A0+B3-A3)
X : A0, B0
Y : A1, B1
Z : A2, B2
W: A3, B3
C
C
Left boundary
C0=-C3
Right boundary
C0=+C3
bottom boundary
C1=-C3
………..
………..
25
A
B
P: output
Inside
Outside
Case 1
!Aout = !Bout
Aout!=Bout
Then, Bout is also input into the polygon!
26
At most,it will have 6 extra
vertex after clipping with
six planes
Circulate each
Input polygon
Vertex according
To Sutherland-
Hodgman polygon
clipping