# Normal Calculation

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How would I calculate a normal for a triagle. All I need is calculation for a flat shaded triangle or the normal being perendicualar to the triangle face.

##### Share on other sites
You would take the three points of the triangle, then use those to find two vectors composing the triangle (for example, if you have a triangle consisting of points A, B and C, AB, AC and BC would be the vectors composing the triangle). Then take the cross product of the two vectors to get a vector orthogonal to the triangle. Normalize it and there you have it, a normal.

To make sure you're getting the correct normal (each triangle can have two normals - one coming out of each side of the triangle's surface), I believe you have to perform cross multiplication on your vectors using the proper winding order of your vertices.

I don't know if I can explain that any better, but, here's a link to an article you can read: Clickity!

-Auron

Edit: Also, if you need the normals at the vertices, then you can use the same normal as the rest of the triangle, or you can choose to interpolate that triangle's normal with the normals of all other triangles sharing that vertex.

##### Share on other sites
Auron:

Nicely put. Rating++.

SuperNerd:

I'm posting a thread this weekend in the Beginners or DirectX forum on computing efficient normals for a regular heightfield. Its probably the next step if you're just learning normal calculations, but I thought I'd let you know. You can follow the existing discussion of the article HERE.

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
16
5. 5

• 9
• 33
• 13
• 12
• 10
• ### Forum Statistics

• Total Topics
632575
• Total Posts
3007154

×