why are used triangles and not quads?

I know,…VERY noob question, but would like to understand it.

Is it only to save space? 3 is less than 4, or is there some deeper reason?

thanks in advance…

its that hardware is optimized ONLY for rendering triangles. in case of other geometry the driver splits up everything in triangles. about saving space its a strange question. if you want a quad you need 4 vertices anyways rendered with TRIANGLE_STRIP as best solution. so apparently you cant draw a quad with 3 vertices right?

wow…this I didn’t know. So for example if I make a simple quad (4 vertices) it is presented to hardware as 2 triangles.

But why then in for example ‘human face’ modeling we should avoid using triangles and in gaming we should use only triangles? (I quess that in ‘human face’ case the triangle can cause a problem in case we are going to subdivide the model)

any geometry can be represented with triangles. even triangles can be split up into infinite amount of triangles (tesselation). when modeling faces you only see them as quads. check f.e. this image. triangles everywhere.

“So for example if I make a simple quad (4 vertices) it is presented to hardware as 2 triangles.”
2 triangles with 4 vertices! aka triangle strip or triangle fan.

now I see - MANY thanks!

welcome. btw, OpenGL supportes many primitives. Direct3D on the onther side can only operate on triangles (besides points and lines), no quads, no quad strips, no polygons.

There is a good reason for this. The vertices defining a triangle can only be co-planar. Not so with quads. This can effect lighting and texturing. Triangles are also easier to scan convert and making an efficient and quick triangle scan converter is a trivial matter.

There are several legitimate reasons, none of which are to make the developer’s life hard. :wink:

Yea, it has more to do with the modeling software itself, for faces you normally uses something called nurbs, it’s basically quads that can be subdivided at any level, triangles used to subdivide less than optimally compared to quads and in the case of faces also less uniformly too, and that could cause rendering problems.
However most modern subdiv algorithms are built to get around this, in either case these quads are later converted to triangles at render time or when exporting to a game.

This is the most important reason, i think.

Another problem is unclear interpolation. Imagine the rasterization of a quad with tex coords:

0.0---1.0
 |  ?  |
0.5---0.2

Has the central fragment the tex coords 0.75 or 0.1, or (0.75+0.1)/2?
(There was a nvidia slide about custom interpolation in the geometry shader, but i can’t find it right now).

Yes, when you try to subdivide a face model, at triangles you get nasty artifacts and it’s hard/impossible to fix them.
In software and hardware rasterizers, triangles are a few orders faster/easier to calculate. Funny thing is that software rasterizers (and maybe HW ones) internally split triangles in two triangles.

Yep. The easiest and fastest triangle to scan convert is one with a horizontal edge. Since that is rarely the case, the rasterizer makes it so. In most cases, splitting a triangle as such and rasterizing two triangles is actually faster than rasterizing the original triangle.