efficient 3d programming...

Started by
3 comments, last by GameDev.net 17 years, 2 months ago
The other day a read somewhere about efficient programming in 3D. I've read that triangles are more efficiently computed than polygonal faces because the triangles poitns are coplanar, and I'd like to know if this is true. It's a good idea to try to develop all the meshes in a game using triangles? it's better the triangle strip? and if there are a lot of triangles against a little of polygonal faces? I'm developing a game and I'd like to know the best way to develop it as more efficient as possible, if you can give some hint (not refering to glHint), or point me to the wright direction please... Please help me I'm confused!!!! xD Thank you all and sorry for my bad writting
Advertisement
Triangles have the nice property of being coplanar; this is advantages for a number of reasons. Modern graphics hardware deals with triangles; the ability for you to specify quads or polygons to a graphics API is simply an abstraction -- they'll get converted to triangles. Consequently all your modelling should generally be done with triangles.

Triangle strips may be useful for some applications, but the performance gain isn't necessarily worthwhile compared to the extra effort you'll put in modelling the objects or in the extra batches you may have to submit to the card. In general, indexed triangle lists should be your default choice.

Don't worry too much about efficiency when you're just starting out. Focus on getting things working first. If you have performance issues once you have achieved desired behavior, then you can worry about them then.
Yes, the points in a triangle are always coplanar.

Even if you build a mesh full of complex polygons and thus have fewer polys compared to a large number of triangles; your graphics card operates using Triangles internally. And by doing this polygon approach you actually create more work because they will need to be triangulated for rendering-either by yourself or by the card at runtime(performance loss).

Also, since a complex polygon can be non-coplanar; there can be ambiguouity in how they get triangulated. meaning you dont have total control of the exact shape of your mesh or texture mapping.


Use Triangles!
So if I'm drawing a cube it's better drawing it with triangles than polygons although there are the double of faces within?

Yes

the number of polygons is not what you care about
what matters is the number of triangles they break into when the graphics card renders them

each square side of the cube will be broken into two triangles
for 12 total
might as well save a step and have your mesh just be 12 triangles to begin with

This topic is closed to new replies.

Advertisement