# Why split polygons into triangles?

This topic is 4887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

For a software rendering engine, what are the advantages (if any) of converting , say, a quad into two triangles before drawing? I know this is what modern graphics cards do but is it so they only have to work with a fixed number of vertices or is there some "mathematical" advantage of trangles?

##### Share on other sites
The main reason for working with triangles is that all corners are always in a single plane. So interpolation of the in between 'pixels' is determinable.

cheers

##### Share on other sites
Its mostly a question of:

1. Simplifying the hardware
2. Simplifying the design
3. Improving the speed by adopting a constant special case

Triangles are a special case of a polygon. They are guaranteed to be always convex, and to render them, you don't need a loop or a sophisticated algorithm. Many algorithms (barycentric coordinates, for example), can be applied to triangles directly, while they require a more complex general case algorithm for other convex polygons.

Triangles are also the most basic polygon possible, so they are sort of a common element... And well, since you can convert any polygon into a set of triangles or a triangle strip, its just not a problem, is it?

##### Share on other sites
you cant really screw up a triangle. Only 2 cases where 3 points doesnt make a triangle. the 3 points are all the same point. Or the 3 points make up a straight line. and the first case is really just an extension of the 2nd case

##### Share on other sites
Quote:
 Original post by Raymond_Porter420you cant really screw up a triangle. Only 2 cases where 3 points doesnt make a triangle. the 3 points are all the same point. Or the 3 points make up a straight line. and the first case is really just an extension of the 2nd case

That's not really the reason, because you could also say that a triangle is a special case of a quad with two coincident vertices. These special cases are not a big problem, not even for n-gons.

ernow nailed it.

##### Share on other sites
Quote:
 Original post by Alt F4For a software rendering engine, what are the advantages (if any) of converting , say, a quad into two triangles before drawing? I know this is what modern graphics cards do but is it so they only have to work with a fixed number of vertices or is there some "mathematical" advantage of trangles?

For a software renderer it can actually make sense to use quads. Mainly the polygon setup and rasterization time is halved. On the other hand, it becomes messy to work with, and most 3D formats only offer triangles. The performance benefit is also only minimal.

Or let's put it this way: I've seen several software renderers with support for quad rasterization, but without actually useful features like even texture mapping. So just don't waste your time with it. Maybe in a few months when you're reaching 100 FPS and you want 101, you can give it a try.

##### Share on other sites
another more important reason is triangles can approximate arbitrary topology, which quadrilaterals cannot. consider a circle or a sphere

##### Share on other sites
sorry to post twice but another importatnt reason is scan line interpolation of triangle is rotatioaly invarient which rectangle and ngon scan line interpolation is not. scan line interpolation of triangles is mathematically equivilant to barycentric interpolation while scan line interpolation on a quad is NOT equivilent to bileanear interpolation across the quad. consider a quad with one pair of oposite verticies white and another black and imagin using scan line interpolation as it rotates and you will see it is rotationaly variant. also it I state the probably obvious that scan line interpolation on the two triangles that make up the quad is equivilent to bilinear interpolation across the quad, which is what we want in terms of quad rendering.

Tim W.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633685
• Total Posts
3013321
×