02-05-2001, 04:05 AM

I need to implement a flat shading using vertex array.

I have reached a perfect smooth shading computing the average of triangle's normals sharing each vertex and assigning them to the corresponding elements of normal array.

vertex[i] ---> normal[i] = average of sharing triangles normals;

But, this doesn't work on flat shading.

I know that to reach a correct result I should have to assign the triangle normal to all its vertices normals, but the problem raises on shared vertices.

I don't want to duplicate the shared vertices to keep their normals and, for speeding problems, I can't draw my triangles one by one.

How can I solve my problems?

Thanks

I have reached a perfect smooth shading computing the average of triangle's normals sharing each vertex and assigning them to the corresponding elements of normal array.

vertex[i] ---> normal[i] = average of sharing triangles normals;

But, this doesn't work on flat shading.

I know that to reach a correct result I should have to assign the triangle normal to all its vertices normals, but the problem raises on shared vertices.

I don't want to duplicate the shared vertices to keep their normals and, for speeding problems, I can't draw my triangles one by one.

How can I solve my problems?

Thanks