Archived

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

Normals... per vertex? Or per triangle?

This topic is 5656 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

Okay. I want to make a triangle class. This triangle class will be made up of three points etc... for lighting what has the normals? The triangle or the vertices? I''m thinking the triangle would have the normal (cross product all of the vertices). But what about the vertices? Would the normal to that be the average of the normal to all the triangles that use it? When i design my geometric data classes what should i consider? Thanks in advance! -jonnii

Share this post


Link to post
Share on other sites
You should consider using indexed meshes IMHO. I.e. your triangle structure looks like

class Triangle
{
unsigned short a, b, c;
};

these a, b, c are the indices in the array where you store vertices, normals, texture coordinates etc.. this implies that the number of normals == number of vertices etc. This kind of structure is very suitable for use with opengl vertex arrays.

and yes, you should use per-vertex normal, gouraud shading just looks so much better than flat shading.

-Lev

Share this post


Link to post
Share on other sites