Archived

This topic is now archived and is closed to further replies.

Triangle fans and normals

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been using triangle fans to draw a 3d box on the screen using OpenGL. The box is comprised of the triangle fans with each 6 triangles. However when I add lighting to the application I get strange results with the triangle fans. If I use triangles to draw the box, lighting works correctly, so my normals are correctly calculated. When I use triangle fans I supply the normal for every vertex. I believe my problem is that the triangles share points, but not normals for these points, eg. a corner vertex of my box is used to generate four side faces and two top (or bottom) faces, obviously that single vertex will not have the same normal for every face generated. Can anyone confirm this problem? It effectively renders triangle fans useless for objects that aren''t "flat"...

Share this post


Link to post
Share on other sites
yep, that''s the problem. If you really want to use tri fans you could make the "tip" of the fan the center of each side. For the cube you need to have 3 normals per corner vertex, so it doesn''t really make sense to reuse the points.

lonesock

Piranha are people too.

Share this post


Link to post
Share on other sites
Thanks for your reply, it''s nice to have it confirmed.

This literaly means that complex objects will have to be drawn using GL_TRIANGLES... Do you know anything about the slowdown of using that, instead of TRIANGLE_FAN?

Share this post


Link to post
Share on other sites
in my experience, slowest to fastest was actually:

tri-fans, tris, tri-strips

but that was a long time ago, and it probably just meant that the driver was not optimized at all for fans (this was back in the TNT2 days).

Tri strips are pretty cool, and there are utilities that will stripify a model for you (I think there is one from nVidia, and another called stripe?) Maybe look into those.


lonesock

Piranha are people too.

Share this post


Link to post
Share on other sites
Actually triangle strips are as fast as traisngle fans. They both benefit the vertex caching capabilities of todays'' graphics cards.

As for vertex sharing, well, it just depends on what your model is meant to represent.
You can share your vertices for your cube if you want to make a roundish look. And you can dissociate vertices over a sphere if you want to make a metalish look.

Share this post


Link to post
Share on other sites