how to calculate face normals?

Started by
2 comments, last by amish1234 22 years, 2 months ago
I now have a clue about BSP, but I need to calculate the face normals for all my polygons. I tried looking in the SKD docs, but they didn''t say. (it says normals are calculated by D3D when needed, so you don''t have to worry about them). Anyone know a formula to do this? Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Advertisement
the face normal will be the cross product of two lines defined each by two of the three vertices of a triangle.
If you have three points of the triangle: A,B,C, then you do this:
vector Normal;vector U;vector V;U = A - C;V = A - B;Normal = U cross V; 

"Cross" is the cross-product. If A, B, and C are in counterclockwise order, this will return the correct normal... either that, or clockwise order, I forget.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
This is the cross-product:

      Vector( (V1.Y * V2.Z) - (V1.Z * V2.Y),        (V1.Z * V2.X) - (V1.X * V2.Z),        (V1.X * V2.Y) - (V1.Y * V2.X) );      


~CGameProgrammer( );



Edited by - CGameProgrammer on January 30, 2002 8:26:24 PM

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

This topic is closed to new replies.

Advertisement