View Full Version : Triangle Normal Calculation

DerTherion

03-31-2009, 12:16 PM

hello,

i am looking for a little help with the normals

my 3 vertex of the triangle should get the

same normal but i dont know how to calculate the

normal vector of this?

tri_x[0],tri_y[0],tri_z[0]

tri_x[1],tri_y[1],tri_z[1]

tri_x[2],tri_y[2],tri_z[2]

nor_x=?,nor_y=?,nor_z=?

thanks for any help

trinitrotoluene

03-31-2009, 01:03 PM

To calculate the normal, take the cross product (http://en.wikipedia.org/wiki/Cross_product) of the two vectors formed by v1 = (tri_x[1]-tri_x[0];tri_y[1]-tri_y[0];tri_z[1]-tri_z[0]) and v2 = (tri_x[2]-tri_x[0];tri_y[2]-tri_y[0];tri_z[2]-tri_z[0]). Don't forget that v1^v2 = -v2^v1.

dletozeun

03-31-2009, 02:09 PM

Wow! I think there is an epidemic about normals computation issue this week, perhaps the premices of the april, 1st virus... :) Seriously, an article about this on the opengl wiki might be helpful.

DerTherion

03-31-2009, 11:56 PM

thank you very much for the help with the formula

I think there is an epidemic about normals computation issue this week

hehe, i wonder about opengl and directx why they use

normal vectors with each vertex ?

why not one normal vector for each triangle.

opengl make all the stuff with light,cullface etc...

why does it not automatic generate the normals of triangle surfaces,life could much more easyer;)

greetings :)

ephtracy

04-01-2009, 01:55 AM

thank you very much for the help with the formula

I think there is an epidemic about normals computation issue this week

hehe, i wonder about opengl and directx why they use

normal vectors with each vertex ?

why not one normal vector for each triangle.

opengl make all the stuff with light,cullface etc...

why does it not automatic generate the normals of triangle surfaces,life could much more easyer;)

greetings :)

if your model is hard-edged, like box, one normal per triangle is OK;

if your model is curved, like sphere, the normals must represent the actual ones on the curved surface rather than the ones on the approximate polyhedron model.

sometimes both kinds of normals even exist on the same model.

in order to make the result as you expect, OpenGL just leave the work to you.

dletozeun

04-01-2009, 02:09 AM

And for the sake of completeness, most meshes not have only one normal per vertex but several, especially at hard edges. This follows what ephtracy said, vertex normal depend on the triangle it belongs to, that is why it could have several normals on hard edges.

I advise you to play withy normals in 3d modelers like 3dsmax, blender, maya and friends just to understand this concept.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.