Docsity

Back Face Culling and Triangle Strips in Computer Graphics, Study notes of Computer Graphics

Toggle sidebar
bg1
1 Back Face Culling
It is an optimization technique allowing to (conservatively) reject some of the
back-facing trianglers. In order to make it work, all the triangles have to be
oriented so that their vertices appear counterclockwise when looked at from
outside (just a convention.... clockwise would work too with obvious changes).
Now, after the triangle’s vertices are projected, and they turn out to come in
the clockwise order, the triangle is not scan-converted. In particular, do not
even have to compute the pixels of the screen its projection covers, their depths
or colors. Thus, some work is spared in the fragment processing stage (less
fragments are generated) and on the rasterization stage (back facing triangles
are not rasterized).
2 Triangle Strips
This is a way to reduce the number of vertices that are processed. All in all,
it is a compromise between this goal and the fact that we need to be able to
code the procedure in hardware, using a small fixed number of ’registers’ (here:
three). The triangle strip definition is shown in Figure 1. The right way to use
strips is to cover the object to be rendered with them; the strips should be made
as long as possible: the longer they are, the more savings in the rendering time
(Why?). Computing the optimal layout of triangle strips is a hard problem, but
it often can be solved nicely for special cases.
Triangle fans work like triangle strips. See Figure 1.
0
1
2
3
4
5
6
7
0
1
2
3
4
5
triangle strip (can be specified by listing all the vertices
0...7)
triangle fan (specified by listing vertices 0...5)
Figure 1: Triangle strips, fans and polygons
How does it work? If the triangles on the strip on the Figure were to be
processed separately, we would have to project a vertex as many as 18 times
(3 times per triangle). If we draw the triangles as a triangle strip, we need to
project each vertex only once, which means we need to do 8 projections. Much
less than 18. Triangle fans work in a similar way. To draw a triangle strip,
1
pf2

Partial preview of the text

Download Back Face Culling and Triangle Strips in Computer Graphics and more Study notes Computer Graphics in PDF only on Docsity!

1 Back Face Culling

It is an optimization technique allowing to (conservatively) reject some of the back-facing trianglers. In order to make it work, all the triangles have to be oriented so that their vertices appear counterclockwise when looked at from outside (just a convention.... clockwise would work too with obvious changes). Now, after the triangle’s vertices are projected, and they turn out to come in the clockwise order, the triangle is not scan-converted. In particular, do not even have to compute the pixels of the screen its projection covers, their depths or colors. Thus, some work is spared in the fragment processing stage (less fragments are generated) and on the rasterization stage (back facing triangles are not rasterized).

2 Triangle Strips

This is a way to reduce the number of vertices that are processed. All in all, it is a compromise between this goal and the fact that we need to be able to code the procedure in hardware, using a small fixed number of ’registers’ (here: three). The triangle strip definition is shown in Figure 1. The right way to use strips is to cover the object to be rendered with them; the strips should be made as long as possible: the longer they are, the more savings in the rendering time (Why?). Computing the optimal layout of triangle strips is a hard problem, but it often can be solved nicely for special cases. Triangle fans work like triangle strips. See Figure 1.

0

1

2

3

4

5

6

7

0

1

2

3

4 5 triangle strip (can be specified by listing all the vertices 0...7)

triangle fan (specified by listing vertices 0...5)

Figure 1: Triangle strips, fans and polygons

How does it work? If the triangles on the strip on the Figure were to be processed separately, we would have to project a vertex as many as 18 times (3 times per triangle). If we draw the triangles as a triangle strip, we need to project each vertex only once, which means we need to do 8 projections. Much less than 18. Triangle fans work in a similar way. To draw a triangle strip,

you first tell OpenGL to interpret the forthcomming sequence of vertices as a specification of a triangle strip. Then you specify the strip’s defining vertices in order. OpenGL will know that it has to interpret each consecutive triple as bounding a different triangle.