Docsity

Line Clipping and Rasterization in Graphics Pipeline, Slides of Computer Science

Partial preview of the text

Download Line Clipping and Rasterization in Graphics Pipeline and more Slides Computer Science in PDF only on Docsity!

The Graphics^ Pipeline: Line Clipping & Line Rasterization

Docsity.com

Last Time?

-^ Ray Tracing vs. Scan Conversion•^ Overview of the Graphics Pipeline•^ Projective Transformations ModelingTransformations Illumination(Shading) Viewing Transformation(Perspective / Orthographic)^ Clipping Projection(to Screen Space) Scan Conversion(Rasterization) Visibility / Display

Docsity.com

Today: Line Clipping & Rasterization

-^ Portions of theobject outsidetheview frustumare removed•^ Rasterizeobjectsinto pixels ModelingTransformations Illumination(Shading) Viewing Transformation(Perspective / Orthographic)^ Clipping^ Projection(to Screen Space) Scan Conversion(Rasterization) Visibility / Display

Docsity.com

Today • Why Clip? • Line Clipping • Overview of Rasterization • Line Rasterization • Circle Rasterization • Antialiased Lines

Docsity.com

Why clip? • Avoid degeneracies– Don’t draw stuffbehind the eye– Avoid divisionby 0 and overflow• Efficiency– Don’t waste time on objectsoutside the image boundary• Other graphics applications (often non-convex)– Hidden-surface removal, Shadows, Picking,Binning, CSG (Boolean) operations (2D & 3D)

Docsity.com

Clipping strategies • Don’t clip (and hope for the best) • Clip on-the-fly during rasterization • Analytical clipping: alter input geometry

Docsity.com

Today • Why Clip? • Point & Line Clipping^ – Plane – Line intersection^ – Segment Clipping^ – Acceleration using outcodes • Overview of Rasterization • Line Rasterization • Circle Rasterization • Antialiased Lines

Docsity.com

Implicit 3D Plane Equation • Plane defined by:^ point

p &^ normal

n^ OR

normal^ n &

offset^ d^

OR

3 points • Implicit plane equation A x +B y +C

z +D = 0

P^ P^0 Docsity.com

Point-to-Plane Distance

P^0 P’

P d^ H = (A,B,C,D)

  • If (A,B,C) is normalized:^ d = H•p = H

Tp

(the dot product in homogeneous coordinates) • d is a^ signed distance positive = "inside" negative = "outside"

Docsity.com

Clipping a Point with respect to a Plane

P^0 P’

P d^ H = (A,B,C,D)

  • If d = H•p

≥^0 Pass through • If d = H•p < 0: Clip (or cull or reject)

Docsity.com

What are the View Frustum Planes?

H=(^0 near^ H= far^ H= bottom^ H= top^ H= left^ H= right^

–1^ – near ) (^0

1 far^ ) (^0 near bottom

(^0 – near

  • top^ 0 ) (^ left^ near
^0 0 )

(– right^ – near

^0 0 )

P ( left , bottom , – near

( right*far/near

,^ top*far/near

, – far )

Docsity.com

Clipping & Transformation • Transform M (e.g. from world space to NDC) • The plane equation is transformed with (M

-1T )^ ( 1,1,1 )

y nearfar z

y x

xo^ eye

z

Docsity.com

Segment Clipping • If H^ •^ p > 0 and H

•q < 0

  • clip q to plane • If H^ •^ p < 0 and H

•q > 0

  • If H^ •^ p > 0 and H

•q > 0

  • If H^ •^ p < 0 and H

•q < 0

p^ n q Docsity.com

Segment Clipping • If H^ •^ p > 0 and H

•q < 0

  • clip q to plane • If H^ •^ p < 0 and H

•q > 0

  • clip p to plane • If H^ •^ p > 0 and H

•q > 0

  • If H^ •^ p < 0 and H

•q < 0

n^ p q Docsity.com