Upload
shubhangi
View
214
Download
0
Embed Size (px)
Citation preview
8/13/2019 3D Clipping
1/11
3D clipping
Shuabhangi Shinde
8/13/2019 3D Clipping
2/11
Clipping volume
In 3-D we are using clipping volume or view volume.
Common 3-d clipping volumes
Rectangular paralleloiped i.e. box used for parallelprojection or axmonmetric projection
A truncated pyramidal volume, used for perspectiveprojection.
These volumes are six sided with sides : left, right, top,bottom, hither(near) and yon(far)
Objects within the view volume may be seen, thoseoutside are not displayed.
Objects crossing the boundary are cut, and only theportion with in the view volume is shown.
8/13/2019 3D Clipping
3/11
Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1
Far Near Top Bottom Right left
The two dimensional concept of region codescan be extended to 3d by considering 6 sides
and 6-bit code instead of four sides and 4 bit
code.
8/13/2019 3D Clipping
4/11
Bit 1=1 if the end point is left of the view volume
Bit 2 = 1 if the end point is right of the view volume
Bit 3 = 1 if the end point is below of the view volume
Bit 4 = 1 if the end point is above of the view volume
Bit 5 = 1 if the end point is front of the view volume
Bit 6 = 1 if the end point is behind of the view volume
Otherwise the bit is set to 0
For example region code of 100100 identifies a point asbelow and behind the view volume and the region code000000 indicates a point with in the view volume.
8/13/2019 3D Clipping
5/11
Y axis
+1
-1
-Z-1
BackClippingPlanez=-1
FrontClipping
Plane
y=z
y=-z3-D Extension of 2-D Cohen-Sutherland Algorithm,
Outcode of six bits. A bit is true (1) when theappropriate condition is satisfied
Bit 1 - Point is above view volume y > -z
Bit 2 - Point is below view volume y < z
Bit 3 - Point is right of view volume x > -z
Bit 4 - Point is left of view volume x < z
Bit 5 - Point is behind view volume z < -1
Bit 6 - Point is in front of view volume z > zmin
3D Cohen-Sutherland Algorithm
8/13/2019 3D Clipping
6/11
3d midpoint subdivision algorithm
Find the locations of endpoints i.e. endpoint codes of linesegments with respect to clipping volume.
If codes for both endpoints are zero then the line iscompletely visible and stop.
If codes for endpoints are not zero and the logical andingof them is also non zero then line is completely invisibleand stop
If codes for two endpoints do not satisfy the conditions 2and 3 the lines are partially visible.
Divide the partially visible line segments in equal parts andrepeat steps 2 and 2 for sudivided line segments until weget completely visible and completely invisible linesegments. Draw the visible line segment and discard theinvisible one
STop
8/13/2019 3D Clipping
7/11
Normalized View Volume
1000
00
00
00
KzDz
KyDy
KxDx
DxXWXV minmin
DyYWYV minmin
DzZWZV minmin
Kx=
Ky=
Kz=
minmax
minmax
XWXW
XVXV
minmax
minmax
YWYW
YVYV
minmax
minmax
ZWZWZVZV
Dx=
Dy=
Dz=
8/13/2019 3D Clipping
8/11
Viewport Clipping
Cohen Sutherland (6 Bit code) Bit 1 =1 x
8/13/2019 3D Clipping
9/11
8/13/2019 3D Clipping
10/11
8/13/2019 3D Clipping
11/11