You are on page 1of 11

3D clipping

Shuabhangi Shinde

bottom. box used for parallel projection or axmonmetric projection – A truncated pyramidal volume.e. . those outside are not displayed. • Common 3-d clipping volumes – Rectangular paralleloiped i. • These volumes are six sided with sides : left. right. and only the portion with in the view volume is shown. hither(near) and yon(far) • Objects within the view volume may be seen. top. • Objects crossing the boundary are cut. used for perspective projection.Clipping volume • In 3-D we are using clipping volume or view volume.

Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Far Near Top Bottom Right left • The two dimensional concept of region codes can be extended to 3d by considering 6 sides and 6-bit code instead of four sides and 4 bit code. .

.• • • • • • • • 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 as below and behind the view volume and the region code 000000 indicates a point with in the view volume.

Point is behind view volume Bit 6 .Point is left of view volume Bit 5 .Point is below view volume Bit 3 . Outcode of six bits.Point is right of view volume Bit 4 .Point is above view volume Bit 2 . A bit is true (1) when the appropriate condition is satisfied Bit 1 .Y axis +1 3D Cohen-Sutherland Algorithm y=z Back Clipping Plane z=-1 -1 -Z Front Clipping Plane y=-z -1 3-D Extension of 2-D Cohen-Sutherland Algorithm.Point is in front of view volume y > -z y<z x > -z x<z z < -1 z > zmin .

endpoint codes of line segments with respect to clipping volume.3d midpoint subdivision algorithm • Find the locations of endpoints i. Draw the visible line segment and discard the invisible one • STop . • If codes for both endpoints are zero then the line is completely visible and stop. • If codes for endpoints are not zero and the logical anding of them is also non zero then line is completely invisible and stop • If codes for two endpoints do not satisfy the conditions 2 and 3 the lines are partially visible. • Divide the partially visible line segments in equal parts and repeat steps 2 and 2 for sudivided line segments until we get completely visible and completely invisible line segments.e.

Normalized View Volume  Dx 0  0 Dy  0 0  0 0 0 0 Dz 0 Kx  Ky   Kz   1  Dx= Dy= XV max XW max YV max YW max   XV min XW min Dz= ZV max ZW max  ZV min  ZW min  YV min  YW min Kx= Ky= Kz= XV min YV min  XW min Dx Dy  YW min  ZW min ZV min Dz .

X1)u • Y = Y2 + (Y2 .Viewport Clipping • Cohen Sutherland (6 Bit code) • • • • • • Bit 1 =1 x<XVmin (left) Bit 2 =1 x<XVmax (right) Bit 3 =1 y<YVmin (below) Bit 4 =1 y>YVmin (above) Bit 5 =1 z<ZVmin (front) Bit 6 =1 z>ZVmax (back) • Cyrus-Beck or Liang-Barsky • X = X1 + (X2 .Y1)u • Z = Z3 + (Z2 – Z1)u 0  u  1 .