|
![](/i/fill.gif) |
"Tim Nikias" <JUSTTHELOWERCASE:timISNOTnikias(at)gmx.netWARE> wrote:
> If you have the same amount of vertices as you have normals, the mesh will
> use the first vertex with the first normal, the second vertex with the
> second normal and so on.
>
> But, if you have tons of the same normal (e.g. in a very planar mesh, you
> might have lots of <0,1,0> normals), you can use normal_indices. For every
> triangle defined with face_indices, you'd need to index which normals you
> want to use.
>
> Regards,
> Tim
>
> --
> "Tim Nikias v2.0"
> Homepage: <http://www.nolights.de>
Like Tim says , you must each vertex normals. But common sides's vertex
numbers
must same. For normal calc, My visual basic code :
' x1 , x2, x3 vertex point.
Dim v1(2) As Single, v2(2) As Single
Dim nX As Single, nY As Single, nZ As Single
' Calculate two vectors from the three points
v1(0) = X2 - x1
v1(1) = Y2 - y1
v1(2) = z2 - z1
v2(0) = x3 - x1
v2(1) = y3 - y1
v2(2) = z3 - z1
' Take the cross product of 2 vectors to get the normal
' vector which will be stored in out
nX = (v1(1) * v2(2)) - (v1(2) * v2(1))
nZ = (v1(2) * v2(0)) - (v1(0) * v2(2))
nY = (v1(0) * v2(1)) - (v1(1) * v2(0))
Regards.
Hasan
Post a reply to this message
|
![](/i/fill.gif) |