View Full Version : Calculating Normals From 3DS Files

humberto

06-29-2001, 03:01 AM

Hi,

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 ?

MrShoe

06-29-2001, 07: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:

AB

and

BC

(simple vector subtraction)

and get the cross product of these two resulting vectors. finally normalize the thing and voila, your face normal.

humberto

07-02-2001, 11:04 AM

Hi Styx,

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

Thanx

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.