Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7
-
Upload
lionel-schwartz -
Category
Documents
-
view
29 -
download
1
description
Transcript of Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7
![Page 1: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/1.jpg)
University of British ColumbiaCPSC 314 Computer Graphics
May-June 2005
Tamara Munzner
http://www.ugrad.cs.ubc.ca/~cs314/Vmay2005
Sampling, Virtual Trackball, Hidden Surfaces
Week 5, Tue Jun 7
![Page 2: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/2.jpg)
2
News
Midterm handed back solutions posted distribution posted all grades so far posted
P1 Hall of Fame posted P3 grading
after 3:20 P4 proposals
email or conversation to all
![Page 3: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/3.jpg)
3
H3 Corrections/Clarifications
Q1 should be from +infinity, not -infinity Q 2-4 correction for point B Q7 clarified: only x and y coordinates are
given for P Q8 is deleted
![Page 4: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/4.jpg)
4
Review: Texture Coordinates
texture image: 2D array of color values (texels) assigning texture coordinates (s,t) at vertex with
object coordinates (x,y,z,w) use interpolated (s,t) for texel lookup at each pixel use value to modify a polygon’s color
or other surface property specified by programmer or artist glTexCoord2f(s,t)
glVertexf(x,y,z,w)
![Page 5: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/5.jpg)
5
glTexCoord2d(1, 1);glVertex3d (x, y, z);
(1,0)
(0,0) (0,1)
(1,1)
Review: Tiled Texture Map
glTexCoord2d(4, 4);glVertex3d (x, y, z);
(4,4)(4,0)
(0,4)(0,0)
![Page 6: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/6.jpg)
6
Review: Fractional Texture Coordinates
(0,0) (1,0)
(0,1) (1,1)
(0,0) (.25,0)
(0,.5) (.25,.5)
textureimage
![Page 7: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/7.jpg)
7
Review: Texture
action when s or t is outside [0…1] interval tiling clamping
functions replace/decal modulate blend
texture matrix stackglMatrixMode( GL_TEXTURE );
![Page 8: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/8.jpg)
8
Review: Basic OpenGL Texturing
setup generate identifier: glGenTextures load image data: glTexImage2D set texture parameters (tile/clamp/...): glTexParameteri
set texture drawing mode (modulate/replace/...): glTexEnvf
drawing enable: glEnable bind specific texture: glBindTexture specify texture coordinates before each vertex: glTexCoord2f
![Page 9: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/9.jpg)
9
Review: Perspective Correct Interpolation
screen space interpolation incorrect
P1(x,y,z)
V0(x’,y’)
V1(x’,y’)
P0(x,y,z)
210
221100
///
///
www
wswswss
![Page 10: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/10.jpg)
10
Review: Reconstruction
how to deal with: pixels that are much larger than texels?
apply filtering, “averaging”
pixels that are much smaller than texels ? interpolate
![Page 11: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/11.jpg)
11
Review: MIPmapping
image pyramid, precompute averaged versions
Without MIP-mappingWithout MIP-mapping
With MIP-mappingWith MIP-mapping
![Page 12: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/12.jpg)
12
Review: Bump Mapping: Normals As Texture
create illusion of complex geometry model
control shape effect by locally perturbing surface normal
![Page 13: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/13.jpg)
13
Review: Environment Mapping
cheap way to achieve reflective effect generate image of surrounding map to object as texture
![Page 14: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/14.jpg)
14
Review: Sphere Mapping
texture is distorted fish-eye view point camera at mirrored sphere spherical texture coordinates
![Page 15: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/15.jpg)
15
Review: Cube Mapping
6 planar textures, sides of cube point camera outwards to 6 faces
use largest magnitude of vector to pick face other two coordinates for (s,t) texel location
![Page 16: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/16.jpg)
16
Review: Volumetric Texture define texture pattern
over 3D domain - 3D space containing the object texture function can be
digitized or procedural for each point on object
compute texture from point location in space
3D function x,y,z)
![Page 17: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/17.jpg)
17
Review: Perlin Noise: Procedural Textures
function marble(point)
x = point.x + turbulence(point);
return marble_color(sin(x))
![Page 18: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/18.jpg)
18
Review: Perlin Noise
coherency: smooth not abrupt changes turbulence: multiple feature sizes
![Page 19: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/19.jpg)
19
Review: Generating Coherent Noise
just three main ideas nice interpolation use vector offsets to make grid irregular optimization
sneaky use of 1D arrays instead of 2D/3D one
![Page 20: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/20.jpg)
20
Review: Procedural Modeling
textures, geometry nonprocedural: explicitly stored in memory
procedural approach compute something on the fly
not load from disk often less memory cost visual richness
adaptable precision noise, fractals, particle systems
![Page 21: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/21.jpg)
21
Review: Language-Based Generation
L-Systems F: forward, R: right, L: left Koch snowflake:
F = FLFRRFLF Mariano’s Bush:
F=FF-[-F+F+F]+[+F-F-F] angle 16
http://spanky.triumf.ca/www/fractint/lsys/plants.html
![Page 22: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/22.jpg)
22
Correction/Review: Fractal Terrain
1D: midpoint displacement divide in half, randomly displace scale variance by half
2D: diamond-square generate new value at midpoint average corner values + random displacement
scale variance by half each time
http://www.gameprogrammer.com/fractal.html
![Page 23: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/23.jpg)
23
Review: Particle Systems
changeable/fluid stuff fire, steam, smoke, water, grass, hair, dust,
waterfalls, fireworks, explosions, flocks life cycle
generation, dynamics, death rendering tricks
avoid hidden surface computations
![Page 24: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/24.jpg)
24
Sampling
![Page 25: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/25.jpg)
25
Samples
most things in the real world are continuous everything in a computer is discrete the process of mapping a continuous function to a
discrete one is called sampling the process of mapping a discrete function to a
continuous one is called reconstruction the process of mapping a continuous variable to a
discrete one is called quantization rendering an image requires sampling and
quantization displaying an image involves reconstruction
![Page 26: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/26.jpg)
26
Line Segments
we tried to sample a line segment so it would map to a 2D raster display
we quantized the pixel values to 0 or 1 we saw stair steps, or jaggies
![Page 27: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/27.jpg)
27
Line Segments
instead, quantize to many shades but what sampling algorithm is used?
![Page 28: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/28.jpg)
28
Unweighted Area Sampling
shade pixels wrt area covered by thickened line equal areas cause equal intensity, regardless of
distance from pixel center to area rough approximation formulated by dividing each pixel
into a finer grid of pixels primitive cannot affect intensity of pixel if it does not
intersect the pixel
![Page 29: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/29.jpg)
29
Weighted Area Sampling
intuitively, pixel cut through the center should be more heavily weighted than one cut along corner
weighting function, W(x,y) specifies the contribution of primitive passing through
the point (x, y) from pixel center
x
IntensityW(x,y)
![Page 30: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/30.jpg)
30
Images
an image is a 2D function I(x, y) that specifies intensity for each point (x, y)
![Page 31: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/31.jpg)
31
Image Sampling and Reconstruction
convert continuous image to discrete set of samples
display hardware reconstructs samples into continuous image finite sized source of light for each pixel
discrete input values continuous light output
![Page 32: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/32.jpg)
32
Point Sampling an Image
simplest sampling is on a grid sample depends
solely on valueat grid points
![Page 33: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/33.jpg)
33
Point Sampling
multiply sample grid by image intensity to obtain a discrete set of points, or samples.
Sampling Geometry
![Page 34: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/34.jpg)
34
some objects missed entirely, others poorly sampled could try unweighted or weighted area sampling but how can we be sure we show everything?
need to think about entire class of solutions!
Sampling Errors
![Page 35: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/35.jpg)
35
Image As Signal
image as spatial signal 2D raster image
discrete sampling of 2D spatial signal 1D slice of raster image
discrete sampling of 1D spatial signal
Examples from Foley, van Dam, Feiner, and Hughes
Pixel position across scanline
Inte
nsi
ty
![Page 36: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/36.jpg)
36
Sampling Theory
how would we generate a signal like this out of simple building blocks?
theorem any signal can be represented as an (infinite)
sum of sine waves at different frequencies
![Page 37: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/37.jpg)
37
Sampling Theory in a Nutshell
terminology bandwidth – length of repeated sequence on
infinite signal frequency – 1/bandwidth (number of repeated
sequences in unit length) example – sine wave
bandwidth = 2 frequency = 1/ 2
![Page 38: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/38.jpg)
38
Summing Waves I
![Page 39: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/39.jpg)
39
Summing Waves II
represent spatial signal as sum of sine waves (varying frequency and phase shift)
very commonlyused to representsound “spectrum”
![Page 40: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/40.jpg)
40
1D Sampling and Reconstruction
![Page 41: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/41.jpg)
41
1D Sampling and Reconstruction
![Page 42: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/42.jpg)
42
1D Sampling and Reconstruction
![Page 43: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/43.jpg)
43
1D Sampling and Reconstruction
![Page 44: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/44.jpg)
44
1D Sampling and Reconstruction
problems jaggies – abrupt changes
![Page 45: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/45.jpg)
45
1D Sampling and Reconstruction
problems jaggies – abrupt changes lose data
![Page 46: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/46.jpg)
46
Sampling Theorem
continuous signal can be completely recovered from its samples
iff
sampling rate greater than twice maximum frequency present in signal
- Claude Shannon
![Page 47: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/47.jpg)
47
Nyquist Rate
lower bound on sampling rate twice the highest frequency component in the
image’s spectrum
![Page 48: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/48.jpg)
48
Falling Below Nyquist Rate
when sampling below Nyquist Rate, resulting signal looks like a lower-frequency one this is aliasing!
![Page 49: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/49.jpg)
49
Nyquist Rate
![Page 50: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/50.jpg)
50
Aliasing
incorrect appearance of high frequencies as low frequencies
to avoid: antialiasing supersample
sample at higher frequency low pass filtering
remove high frequency function parts aka prefiltering, band-limiting
![Page 51: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/51.jpg)
51
Supersampling
![Page 52: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/52.jpg)
52
Low-Pass Filtering
![Page 53: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/53.jpg)
53
Low-Pass Filtering
![Page 54: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/54.jpg)
54
Filtering
low pass blur
high pass edge finding
![Page 55: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/55.jpg)
55
Previous Antialiasing Example
texture mipmapping: low pass filter
![Page 56: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/56.jpg)
56
Virtual Trackball
![Page 57: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/57.jpg)
57
Virtual Trackball
interface for spinning objects around drag mouse to control rotation of view volume
rolling glass trackball center at screen origin, surrounds world hemisphere “sticks up” in z, out of screen rotate ball = spin world
![Page 58: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/58.jpg)
58
Virtual Trackball
know screen click: (x, 0, z) want to infer point on trackball: (x,y,z)
ball is unit sphere, so ||x, y, z|| = 1.0 solve for y
eye
image plane
![Page 59: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/59.jpg)
59
Trackball Rotation correspondence:
moving point on plane from (x, 0, z) to (a, 0, c) moving point on ball from p1 =(x, y, z) to p2 =(a, b, c)
correspondence: translating mouse from p1 (mouse down) to p2 (mouse up) rotating about the axis n = p1 x p2
![Page 60: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/60.jpg)
60
Trackball Computation
user defines two points place where first clicked p1 = (x, y, z) place where released p2 = (a, b, c)
create plane from vectors between points, origin axis of rotation is plane normal: cross product
(p1 - - o) x (p2 - - o): p1 x p2 if origin = (0,0,0) amount of rotation depends on angle between
lines p1 • p2 = |p1| |p2| cos θ |p1 x p2 | = |p1| |p2| sin θ
compute rotation matrix, use to rotate world
![Page 61: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/61.jpg)
61
Visibility
![Page 62: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/62.jpg)
62
Reading
FCG Chapter 7
![Page 63: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/63.jpg)
63
Rendering Pipeline
GeometryGeometryDatabaseDatabaseGeometryGeometryDatabaseDatabase
Model/ViewModel/ViewTransform.Transform.Model/ViewModel/ViewTransform.Transform. LightingLightingLightingLighting PerspectivePerspective
Transform.Transform.PerspectivePerspectiveTransform.Transform. ClippingClippingClippingClipping
ScanScanConversionConversion
ScanScanConversionConversion
DepthDepthTestTest
DepthDepthTestTest
TexturingTexturingTexturingTexturing BlendingBlendingBlendingBlendingFrame-Frame-bufferbuffer
Frame-Frame-bufferbuffer
![Page 64: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/64.jpg)
64
Covered So Far
modeling transformations viewing transformations projection transformations clipping scan conversion lighting shading
we now know everything about how to draw a polygon on the screen, except visible surface determination
![Page 65: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/65.jpg)
65
Invisible Primitives
why might a polygon be invisible? polygon outside the field of view / frustum
solved by clipping polygon is backfacing
solved by backface culling polygon is occluded by object(s) nearer the viewpoint
solved by hidden surface removal for efficiency reasons, we want to avoid spending
work on polygons outside field of view or backfacing for efficiency and correctness reasons, we need to
know when polygons are occluded
![Page 66: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/66.jpg)
66
Hidden Surface Removal
![Page 67: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/67.jpg)
67
Occlusion
for most interesting scenes, some polygons overlap
to render the correct image, we need to determine which polygons occlude which
![Page 68: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/68.jpg)
68
Painter’s Algorithm
simple: render the polygons from back to front, “painting over” previous polygons
draw blue, then green, then orange will this work in the general case?
![Page 69: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/69.jpg)
69
Painter’s Algorithm: Problems
intersecting polygons present a problem even non-intersecting polygons can form a
cycle with no valid visibility order:
![Page 70: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/70.jpg)
70
Analytic Visibility Algorithms early visibility algorithms computed the set of visible
polygon fragments directly, then rendered the fragments to a display:
![Page 71: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/71.jpg)
71
Analytic Visibility Algorithms
what is the minimum worst-case cost of computing the fragments for a scene composed of n polygons?
answer: O(n2)
![Page 72: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/72.jpg)
72
Analytic Visibility Algorithms
so, for about a decade (late 60s to late 70s) there was intense interest in finding efficient algorithms for hidden surface removal
we’ll talk about two: Binary Space Partition (BSP) Trees Warnock’s Algorithm
![Page 73: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/73.jpg)
73
Binary Space Partition Trees (1979)
BSP Tree: partition space with binary tree of planes idea: divide space recursively into half-spaces
by choosing splitting planes that separate objects in scene
preprocessing: create binary tree of planes runtime: correctly traversing this tree
enumerates objects from back to front
![Page 74: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/74.jpg)
74
Creating BSP Trees: Objects
![Page 75: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/75.jpg)
75
Creating BSP Trees: Objects
![Page 76: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/76.jpg)
76
Creating BSP Trees: Objects
![Page 77: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/77.jpg)
77
Creating BSP Trees: Objects
![Page 78: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/78.jpg)
78
Creating BSP Trees: Objects
![Page 79: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/79.jpg)
79
Splitting Objects
no bunnies were harmed in previous example but what if a splitting plane passes through
an object? split the object; give half to each node
Ouch
![Page 80: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/80.jpg)
80
Traversing BSP Trees tree creation independent of viewpoint
preprocessing step tree traversal uses viewpoint
runtime, happens for many different viewpoints each plane divides world into near and far
for given viewpoint, decide which side is near and which is far
check which side of plane viewpoint is on independently for each tree vertex
tree traversal differs depending on viewpoint! recursive algorithm
recurse on far side draw object recurse on near side
![Page 81: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/81.jpg)
81
Traversing BSP Trees
renderBSP(BSPtree *T)BSPtree *near, *far;if (eye on left side of T->plane)
near = T->left; far = T->right;else
near = T->right; far = T->left;renderBSP(far);if (T is a leaf node)
renderObject(T) renderBSP(near);
query: given a viewpoint, produce an ordered list of (possibly split) objects from back to front:
![Page 82: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/82.jpg)
82
BSP Trees : Viewpoint A
![Page 83: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/83.jpg)
83
BSP Trees : Viewpoint A
F N
F
N
![Page 84: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/84.jpg)
84
BSP Trees : Viewpoint A
F NFN
FN
decide independently ateach tree vertex
not just left or right child!
![Page 85: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/85.jpg)
85
BSP Trees : Viewpoint A
F N
F
N
NF
FN
![Page 86: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/86.jpg)
86
BSP Trees : Viewpoint A
F N
F
N
NF
FN
![Page 87: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/87.jpg)
87
BSP Trees : Viewpoint A
F N
FNF
N
NF
1
1
![Page 88: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/88.jpg)
88
BSP Trees : Viewpoint A
F NF
N
FN
FN NF
1
2
1 2
![Page 89: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/89.jpg)
89
BSP Trees : Viewpoint A
F N
F
N
FN
FN
N F
NF
1
2
1 2
![Page 90: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/90.jpg)
90
BSP Trees : Viewpoint A
F N
F
N
FN
FN
N F
NF
1
2
1 2
![Page 91: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/91.jpg)
91
BSP Trees : Viewpoint A
F N
F
N
FN
FN
N F
NF
1
2
3
1 2
3
![Page 92: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/92.jpg)
92
BSP Trees : Viewpoint A
F N
FN
FN
N F
NF
1
2
3
4
FN
1 2
34
![Page 93: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/93.jpg)
93
BSP Trees : Viewpoint A
F N
FN
FN
N F
NF
1
2
3
4 5
FN
1 2
34
5
![Page 94: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/94.jpg)
94
BSP Trees : Viewpoint A
F N
FN
FN
N F
NF
1
2
3
4 5
1 2
34
5
6
78
96
7
8
9
FN
FN
FN
![Page 95: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/95.jpg)
95
BSP Trees : Viewpoint B
N F
F
NF
N
FN
F N
FNF N
N F
![Page 96: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/96.jpg)
96
BSP Trees : Viewpoint B
N F
F
NF
N
FN
1
34
2
F N
FNF N
N F5
6
7
891
2
3
4
5
6
7
9
8
![Page 97: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/97.jpg)
97
BSP Tree Traversal: Polygons
split along the plane defined by any polygon from scene
classify all polygons into positive or negative half-space of the plane if a polygon intersects plane, split polygon into
two and classify them both recurse down the negative half-space recurse down the positive half-space
![Page 98: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/98.jpg)
98
BSP Demo
useful demo:http://symbolcraft.com/graphics/bsp
![Page 99: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/99.jpg)
99
Summary: BSP Trees
pros: simple, elegant scheme correct version of painter’s algorithm back-to-front
rendering approach was very popular for video games (but getting less so)
cons: slow to construct tree: O(n log n) to split, sort splitting increases polygon count: O(n2) worst-case computationally intense preprocessing stage restricts
algorithm to static scenes
![Page 100: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/100.jpg)
100
Warnock’s Algorithm (1969)
based on a powerful general approach common in graphics if the situation is too complex, subdivide
BSP trees was object space approach Warnock is image space approach
![Page 101: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/101.jpg)
101
Warnock’s Algorithm
start with root viewport and list of all objects
recursion: clip objects to
viewport if only 0 or 1 objects
done else
subdivide to new smaller viewports
distribute objects to new viewpoints
recurse
![Page 102: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/102.jpg)
102
Warnock’s Algorithm
termination viewport is single
pixel explicitly check for
object occlusion
![Page 103: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/103.jpg)
103
Warnock’s Algorithm pros:
very elegant scheme extends to any primitive type
cons: hard to embed hierarchical schemes in hardware complex scenes usually have small polygons
and high depth complexity (number of polygons that overlap a single pixel)
thus most screen regions come down to the single-pixel case
![Page 104: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/104.jpg)
104
The Z-Buffer Algorithm (mid-70’s)
both BSP trees and Warnock’s algorithm were proposed when memory was expensive first 512x512 framebuffer was >$50,000!
Ed Catmull proposed a radical new approach called z-buffering.
the big idea: resolve visibility independently at each
pixel
![Page 105: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/105.jpg)
105
The Z-Buffer Algorithm
we know how to rasterize polygons into an image discretized into pixels:
![Page 106: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/106.jpg)
106
The Z-Buffer Algorithm
what happens if multiple primitives occupy the same pixel on the screen? which is allowed to paint the pixel?
![Page 107: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/107.jpg)
107
The Z-Buffer Algorithm
idea: retain depth after projection transform each vertex maintains z coordinate
relative to eye point can do this with canonical viewing volumes
![Page 108: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/108.jpg)
108
The Z-Buffer Algorithm
augment color framebuffer with Z-buffer or depth buffer which stores Z value at each pixel at frame beginning, initialize all pixel depths
to when rasterizing, interpolate depth (Z)
across polygon check Z-buffer before storing pixel color in
framebuffer and storing depth in Z-buffer don’t write pixel if its Z value is more distant
than the Z value already stored there
![Page 109: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/109.jpg)
109
Interpolating Z
edge equations: Z just another planar parameter:
z = (-D - Ax – By) / C if walking across scanline by (Dx)
znew = zold – (A/C)(Dx)
total cost: 1 more parameter to
increment in inner loop 3x3 matrix multiply for setup
![Page 110: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/110.jpg)
110
Interpolating Z
edge walking just interpolate Z along edges and across
spans barycentric coordinates
interpolate Z like otherparameters
![Page 111: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/111.jpg)
111
Z-Buffer
store (r,g,b,z) for each pixel typically 8+8+8+24 bits, can be more
for all i,j {for all i,j { Depth[i,j] = MAX_DEPTHDepth[i,j] = MAX_DEPTH Image[i,j] = BACKGROUND_COLOURImage[i,j] = BACKGROUND_COLOUR} } for all polygons P {for all polygons P { for all pixels in P {for all pixels in P { if (Z_pixel < Depth[i,j]) {if (Z_pixel < Depth[i,j]) { Image[i,j] = C_pixelImage[i,j] = C_pixel Depth[i,j] = Z_pixelDepth[i,j] = Z_pixel } } } } } }
![Page 112: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/112.jpg)
112
Depth Test Precision
reminder: projective transformation maps eye-space z to generic z-range (NDC)
simple example:
thus:
10100
00
0010
0001
1
z
y
x
baz
y
x
T
10100
00
0010
0001
1
z
y
x
baz
y
x
T
eyeeye
eyeNDC z
ba
z
bzaz
eyeeye
eyeNDC z
ba
z
bzaz
![Page 113: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/113.jpg)
113
Depth Test Precision
therefore, depth-buffer essentially stores 1/z, rather than z!
issue with integer depth buffers high precision for near objects low precision for far objects
-z-zeyeeye
zzNDCNDC
-n-n -f-f
![Page 114: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/114.jpg)
114
Depth Test Precision
low precision can lead to depth fighting for far objects two different depths in eye space get mapped to
same depth in framebuffer which object “wins” depends on drawing order
and scan-conversion gets worse for larger ratios f:n
rule of thumb: f:n < 1000 for 24 bit depth buffer with 16 bits cannot discern millimeter
differences in objects at 1 km distance
![Page 115: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/115.jpg)
115
Z-Buffer Algorithm Questions
how much memory does the Z-buffer use? does the image rendered depend on the
drawing order? does the time to render the image depend on
the drawing order? how does Z-buffer load scale with visible
polygons? with framebuffer resolution?
![Page 116: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/116.jpg)
116
Z-Buffer Pros
simple!!! easy to implement in hardware
hardware support in all graphics cards today polygons can be processed in arbitrary order easily handles polygon interpenetration enables deferred shading
rasterize shading parameters (e.g., surface normal) and only shade final visible fragments
![Page 117: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/117.jpg)
117
Z-Buffer Cons
poor for scenes with high depth complexity need to render all polygons, even if
most are invisible
shared edges are handled inconsistently ordering dependent
eyeeye
![Page 118: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/118.jpg)
118
Z-Buffer Cons
requires lots of memory (e.g. 1280x1024x32 bits)
requires fast memory Read-Modify-Write in inner loop
hard to simulate translucent polygons we throw away color of polygons behind
closest one works if polygons ordered back-to-front
extra work throws away much of the speed advantage
![Page 119: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/119.jpg)
119
Hidden Surface Removal
two kinds of visibility algorithms object space methods image space methods
![Page 120: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/120.jpg)
120
Object Space Algorithms
determine visibility on object or polygon level using camera coordinates
resolution independent explicitly compute visible portions of polygons
early in pipeline after clipping
requires depth-sorting painter’s algorithm BSP trees
![Page 121: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/121.jpg)
121
Image Space Algorithms
perform visibility test for in screen coordinates limited to resolution of display Z-buffer: check every pixel independently Warnock: check up to single pixels if needed
performed late in rendering pipeline
![Page 122: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/122.jpg)
122
Projective Rendering Pipeline
OCS - object coordinate system
WCS - world coordinate system
VCS - viewing coordinate system
CCS - clipping coordinate system
NDCS - normalized device coordinate system
DCS - device coordinate system
OCSOCS WCSWCS VCSVCS
CCSCCS
NDCSNDCS
DCSDCS
modelingmodelingtransformationtransformation
viewingviewingtransformationtransformation
projectionprojectiontransformationtransformation
viewportviewporttransformationtransformation
alter walter w
/ w/ w
object world viewing
device
normalizeddevice
clipping
perspectiveperspectivedivisiondivision
glVertex3f(x,y,z)glVertex3f(x,y,z)
glTranslatef(x,y,z)glTranslatef(x,y,z)glRotatef(th,x,y,z)glRotatef(th,x,y,z)........
gluLookAt(...)gluLookAt(...)
glFrustum(...)glFrustum(...)
glutInitWindowSize(w,h)glutInitWindowSize(w,h)glViewport(x,y,a,b)glViewport(x,y,a,b)
![Page 123: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/123.jpg)
123
Rendering Pipeline
GeometryGeometryDatabaseDatabaseGeometryGeometryDatabaseDatabase
Model/ViewModel/ViewTransform.Transform.Model/ViewModel/ViewTransform.Transform. LightingLightingLightingLighting PerspectivePerspective
Transform.Transform.PerspectivePerspectiveTransform.Transform. ClippingClippingClippingClipping
ScanScanConversionConversion
ScanScanConversionConversion
DepthDepthTestTest
DepthDepthTestTest
TexturingTexturingTexturingTexturing BlendingBlendingBlendingBlendingFrame-Frame-bufferbuffer
Frame-Frame-bufferbuffer
OCSOCS
object
WCSWCSworld
VCSVCSviewing
CCSCCS
clipping
NDCSNDCS
normalizeddevice
SCSSCSscreen
(2D)DCSDCSdevice
(3D)
(4D)
/w/w
![Page 124: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/124.jpg)
124
Backface Culling
![Page 125: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/125.jpg)
125
Back-Face Culling
on the surface of a closed orientable manifold, polygons whose normals point away from the camera are always occluded:
note: backface cullingalone doesn’t solve the
hidden-surface problem!
![Page 126: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/126.jpg)
126
Back-Face Culling
not rendering backfacing polygons improves performance by how much?
reduces by about half the number of polygons to be considered for each pixel
optimization when appropriate
![Page 127: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/127.jpg)
127
Back-Face Culling most objects in scene are typically “solid” rigorously: orientable closed manifolds
orientable: must have two distinct sides cannot self-intersect a sphere is orientable since has
two sides, 'inside' and 'outside'. a Mobius strip or a Klein bottle is
not orientable closed: cannot “walk” from one
side to the other sphere is closed manifold plane is not
![Page 128: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/128.jpg)
128
Back-Face Culling
Yes No
most objects in scene are typically “solid” rigorously: orientable closed manifolds
manifold: local neighborhood of all points isomorphic to disc
boundary partitions space into interior & exterior
![Page 129: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/129.jpg)
129
Manifold
examples of manifold objects: sphere torus well-formed
CAD part
![Page 130: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/130.jpg)
130
Back-Face Culling
examples of non-manifold objects: a single polygon a terrain or height field polyhedron w/ missing face anything with cracks or holes in boundary one-polygon thick lampshade
![Page 131: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/131.jpg)
131
Back-face Culling: VCS
yy
zz
first idea:first idea:cull if cull if 0ZN
sometimessometimesmisses polygons thatmisses polygons thatshould be culledshould be culled
better idea:better idea:cull if eye is below polygon planecull if eye is below polygon plane
eyeeye
aboveabove
belowbelow
![Page 132: Sampling, Virtual Trackball, Hidden Surfaces Week 5, Tue Jun 7](https://reader035.fdocuments.in/reader035/viewer/2022062718/56812fa6550346895d9525dd/html5/thumbnails/132.jpg)
132
Back-face Culling: NDCS
yy
zz eyeeye
VCSVCS
NDCSNDCS
eyeeye works to cull ifworks to cull if 0ZNyy
zz