Calculating Normals From 3DS Files


I did a 3DS Viewer where I can visualize 3DS Objects on the screen But now I want to add Lighting and to do so I need to calculate the normals for each face.
But there is a problem, How can I know the order of the points of a face so that I can produce the right normal vector ?

Well, if yo have all the vertex data you should be able to calculate the normals by creating an algorith that has arguments taking the verteces and returns a normal value.

in .3ds you have the vertices A B and C. hmm, ****, I forgot whether they are CW or CCW. anyway. they are stored within your object information, so if you read it out completely you have that.
now you calc the vectors:
(simple vector subtraction)
and get the cross product of these two resulting vectors. finally normalize the thing and voila, your face normal.

Hi Styx,

So I guess 3DS Files always use one of these conventions: clockwise order or counter clockwise order to calculate the normal vector