Download Graphics Pipeline and Clipping Algorithms: A Deep Dive and more Slides Computer Science in PDF only on Docsity!
Clipping and
other geometric
algorithms
Final projects • Rest of semester
- Weekly meetings with TAs – Office hours on appointment
- This week, with TAs
- Refine timeline – Define high-level architecture
- Project should be a whole, but subparts should be
identified with regular merging of code
Last time • Polygon scan conversion
- Smart
- Take advantage of coherence • Good for big triangles
- back to brute force
- Incremental edge equation • Good for small triangles • Simpler clipping
- Visibility
- Painer: complex ordering – Z buffer: simple, memory cost
- Hyperbolic z interpolation
Z interpolation • X’=x/z• Hyperbolic variation• Z cannot be linearly interpolated
z
z
x
image
x’
Plan • Review of rendering pipeline • 2D polygon clipping • Segment intersection • Scanline rendering overview
The Graphics Pipeline
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
Illumination (Shading) (Lighting)
Vertices lit (shaded) according to materialproperties, surface properties (normal) and light
Local lighting model(Diffuse, Ambient, Phong, etc.)
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
2 4 ) ( ) ( ) (
d
k
k
k
L
s q s d a r
Φ ⋅ + ⋅ + =
r
v
l
n
Viewing Transformation
Viewing position is transformed to origin &direction is oriented along some axis (usually
z
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
Yet another4x4 matrix
x' y' z'^1
x y z 1
a e i 0
b f j 0
c g k 0
d h l 1
P
near
v u
-n
o
far
z
y
x
o
eye Seth Teller
Image adapted from:
World space
Eye space
Docsity.com
Clipping – modern hardware
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
(eye
, eyex^
,y
eye
)z
imageplane
z axis
"clip" geometry to
near plane
Projection
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
near
eye
far
y
z
z
x
y
x
o
Seth Teller Image adapted from:
y^
y
x
x z^
o
z
When to clip? •
Before perspective transform in 3D space
Use the equation of 6 planes
Natural, not too degenerate
In homogeneous coordinates after perspective transform (Clip space)
Before perspective divide (4D space, weird
w
values)
Canonical,independent of camera
The simplest to implement in fact
In the transformed 3D screen space after perspective division
Problem: objects in the plane of the camera
M
NEAR CLIP PLANE
v
u
-n
o
FAR CLIP PLANE
z
y
x
o
EYE Docsity.com
Scan Conversion (Rasterization)
- Incremental edge equations• Interpolate values as we go
(color, depth, etc.)
- Screen-space bbox clipping
Modeling
Transformations
Illumination
(Shading)
Viewing Transformation (Perspective / Orthographic)
Clipping Projection
(to Screen Space)^ Scan Conversion
(Rasterization) Visibility / Display
Rendering Pipeline vs. ray casting Ray Casting For
each
pixel
For
each
object
Send pixels to the scene Discretize first
Rendering Pipeline For
each
triangle
For
each
pixel
Project scene to the pixels Discretize last
Rendering Pipeline vs. ray casting Ray Casting For
each
pixel
For
each
object
Depth complexity: no calculationfor hidden part
Whole scene must be in memory
Very atomic computation
More general, more flexible
Primitive, lighting effects, adaptiveantialiasing
Rendering Pipeline For
each
triangle
For
each
pixel
Coherence: geometric transformsfor vertices only
Arithmetic intensity: the amount ofcomputation increases in the depthof the pipeline
Good bandwidth/computation ratio
Harder to get global illumination(shadows, interreflection, etc.)