Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Towards Solid objects: This has utility in some applications, but for anything
Hidden Surfaces and Texture mapping of complexity wire frame representations become
confusing.
Pi+1
Graphics Lecture 5: Slide 3 Graphics Lecture 5: Slide 4
Polygons should be ordered in a consistent manner Polygons whose normal is pointing away from the
(clockwise or counter clockwise) viewer can be culled. If α is the angle between the
Polygons whose normal does not face the viewpoint, normal and the viewer the polygon is front facing if
are not rendered
-90 < α < 90 or cos α > 90
n·v>0
Pi+1
Graphics Lecture 5: Slide 5 Graphics Lecture 5: Slide 6
1
Back Face Culling Types of Visibility Methods
Suppose we take each face of our wire frame and Polygons are rendered in depth order
draw it in two dimensions as a filled polygon.
5th
By filling it we hide anything behind it.
4th 1st 3rd
So, if we draw the furthest parts first then the hidden
parts of the scene are automatically eliminated
2nd
1st
3rd 2nd
5th
4th
Note that two polygons P and Q can be rendered in
any order, if they do not overlap in X-Y
P can be rendered before Q if its P’s z range is
completely behind Q’s
Graphics Lecture 5: Slide 11 Graphics Lecture 5: Slide 12
2
Depth-sort Types of Visibility Methods
The painter’s algorithm requires the objects to be When we render a new polygon we check at each
sorted into depth order. pixel to see whether it is nearer or further than the
object currently drawn at that pixel.
A Z-Buffer algorithm is similar, but avoids sorting.
We only set the pixel if the polygon is closer.
Every time we set a pixel in our image we record in a
separate array (the z-buffer) the 3D z co-ordinate at A further advantage of the z-buffer is that it can be
that pixel. simply implemented in hardware
• Most common usage is a a full window sized array of Interpolate z along edges AND interpolate between
size m x n of 16, 24 or 32 bit “depth” values. edges on each scan-line (bi-linear interpolation)
• Basic idea:
• Initialise buffer to Z_MAX
• For each pixel in each polygon
• If z < ZBUF[x,y] set CBUF[x,y] = col (X2,Y2,Z2)
3
Texture
4
Textures need not map exactly to polygons. They Mapping texture to individual pixels
can be smaller or larger than the polygon
P3
P2 Diagram 7.2
Texture Definition Space Texture applied to a polygon Bi-linear texture
β e
map
c
b
p
1.5β
Polygon being
β
textured
a
α 2α P4
P1 α
Photographs can be used to enhance reality with One major problem with texture mapping is called
virtually no design effort. alias effects.
For a flight simulator landing at an airport the distant These are caused by undersampling, and can cause
landscape can be presented as a photograph which unreal visual artefacts.
forms the back clipping plane
5
Appearance of the textured
polygon in the image
Texture Alias effects in static images
Polygon width
They have the characteristic of making straight line
12 Pixels boundaries look jagged.
6 Pixels
4 Pixels
3 Pixels
This is also due to undersampling.
Samples
Diagram 7.3
Alias Effects in Texture Mapping
Graphics Lecture 5: Slide 31 Graphics Lecture 5: Slide 32
Supersampling
6
Limitations of Supersampling
I/4 I/4
However, it does require a lot of extra computation.
Actual Pixel
I/4 I/4 0 0 intensities
It does not work for line drawings.
7
Convolution
Theoretical Line 1/36 1/9 1/36 mask located
at one pixel
1/9 4/9 1/9
Convolution Pixels set to
Theoretical Line 1/36 1/9 1/36 mask located intensity I
1/36 1/9 1/36
at one pixel (others set to 0)
1/9 4/9 1/9
Pixels set to
intensity I
1/36 1/9 1/36 Final Pixel Intensities
(others set to 0)
(9/36)I (21/36)I
Diagram 7.7:
(21/36)I (9/36)I Anti-aliasing by convolution filtering
It is very fast and can be done in hardware, This is essentially the same technique.