View Full Version : Calculating Normals From 3DS Files
06-29-2001, 04:01 AM
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 ?
06-29-2001, 08:37 PM
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.
07-02-2001, 12:04 PM
So I guess 3DS Files always use one of these conventions: clockwise order or counter clockwise order to calculate the normal vector
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.