Why are polygons typically triangulated in computer graphics?

  • Context: High School 
  • Thread starter Thread starter Synthetix
  • Start date Start date
  • Tags Tags
    Geometry
Click For Summary

Discussion Overview

The discussion revolves around the significance of triangulating polygons in computer graphics, exploring the reasons for using triangles over other polygon types such as quadrilaterals. Participants delve into the geometric, mathematical, and practical implications of this choice, particularly in relation to rendering and hardware optimization.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest that triangles are the simplest representation of a closed area and that trigonometric functions operate effectively on them.
  • Others note that while any polygon can be broken into triangles, using higher polygons can lead to complications, as triangles are optimized in most graphics hardware and software.
  • A participant mentions that triangles can be processed in parallel due to their uniform structure, which is beneficial for modern graphics pipelines.
  • There is a discussion about the mathematical functions applicable to polygons, with some participants questioning whether similar functions exist for quadrilaterals or other shapes.
  • One participant describes the basic method of rasterizing triangles, emphasizing the role of interpolation in texturing.
  • Another participant highlights that three points are the minimum required to define a plane, and that using triangles can yield more accurate approximations of complex shapes like spheres compared to quads.

Areas of Agreement / Disagreement

Participants generally agree on the advantages of using triangles in computer graphics, particularly regarding their ability to define a plane and the optimization of rendering processes. However, there are competing views on the potential use of other polygon types and the mathematical implications of such choices, leaving some aspects of the discussion unresolved.

Contextual Notes

Limitations include the dependence on specific hardware capabilities and the unresolved nature of mathematical functions applicable to polygons beyond triangles.

Synthetix
Messages
5
Reaction score
0
Hello, I just have a basic geometry question (really within the context of computer graphics). What is the significance in triangulating polygons? Why not squares, or polys with more angles? Why triangles? Is that because it is the simplest representation of a closed area? Also, is it due to trigonometric functions being able to operate on triangles? Are there similar functions in mathematics for rectangles, etc? I never took geometry in school, so now that I'm working with 3D graphics these questions are on the brain!
 
Physics news on Phys.org
The Sega Saturn used quadrilaterals as primitives. Any polygon triangle or higher can be used. Any polygon can be broken into triangles. There is potential in using higher polygons, but it also caused problems because triangles are the standard much of the hardware and software is optimized for them. Often when evaluating the tradeoffs it is better to just use more triangles.
 
Hey Synthetix and welcome to the forums.

The main advantage is they form a plane (minimum to form one) and you can do them in parallel with the right hardware design (and algorithms).

The way graphics cards are setup nowadays, you have a vertex pipeline and a fragment pipe-line.

With triangles, these are well understood and the card can be optimized to do them per triangle since it is uniform for all triangles but not necessarily for other non-parametric primitives (like quadrilaterals).
 
Thanks for the replies. I wasn't aware that the Saturn used quads as primitives. I read the Wikipedia entry on it and was surprised to see that triangular surfaces required the fourth edge to be a length of zero! That's just wacky, especially when we're so used to triangles. And texturing must be a real challenge in this case!

What about it terms of geometry (math) in general? Clearly, trigonometry operates on triangles, but are there similar mathematical functions that operate on other polygons? I haven't come across any computer graphics math from what I can recall that would be specific to anything more than a triangle or quad.
 
Last edited:
Are you familiar with how triangles are rasterized (i.e textured) in terms of the technique?
 
chiro said:
Are you familiar with how triangles are rasterized (i.e textured) in terms of the technique?

I'm familiar with it, although I don't completely understand all of the math involved. I use a Phong shader written in GLSL as part of the fragment program. I send the coordinates (vectors) of the lights, along with the vectors for each point in 3D. The shader seems to sort this all out, resulting in a nicely Phong-rendered scene.

I've recently tried to take on shadow mapping, and although I am getting a "result," it is not correct. How the fragment shader takes coordinates from lights and objects and rasterizes shadows is beyond me at the moment. I've of course used a lot of code taken from forums, etc., but again I really don't understand how the math is working (it's more of a "try this, oops, that doesn't work, try something else" approach).

That's why I've decided I need to understand the math better, not just "paste this code and see if it works." :smile:
 
The basic texturing method involves interpolation.

You do is do a line by line scan of the triangle raster by associating the texture co-ordinates with the end-points of the triangle.

You then do a horizontal line scan and interpolate across each line for the texels (texture element) and that location on the screen buffer becomes the texel.

So in short, you do a series of horizontal line scans and each line retrieves the texels for that line and dumps that in the screen buffer which is what you see.
 
Three points are the smallest number of points to define a plane, as chiro said.

Furthermore, any more points, and you have to CHECK they all fall on the same plane. Three points always define a triangle, but four points don't always form a quadrilateral!

Triangles are also a "finer" structure. If you're approximating a sphere with triangles, you will get a much more accurate result if you're using triangles instead of quads (given the same number of points).

Three ordered points also gives you a very fast way to take the normal of the triangle's plane. If your tri has coordinates(p0, p1, p2), then simply take the cross product of (p1 - p0) x (p2 - p1), and normalize it.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
22
Views
4K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 9 ·
Replies
9
Views
5K