Normal Calculation
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.
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement