|
|
Marcus Fritzsch wrote:
>Hi,
>
>i wrote a simple triangulation algo for a noise program to generate
>something like a hieghtfield, and i wanted to use this with
>smooth_triangles, does anybody knows how to calculate the normals of the
>three points from the known triangle?
>
>greetings, Marcus
>
to get the normal (N) of a straigh triangle, if your vertexes points are V0,
V1, V2,
#declare N= vcross(V1-V0,V2-V0);
the to make it a unit vector (Nu) try,
#declare Nu = vnormalize(vcross(V1-V0,V2-V0));
For a smooth Triangle each vertex will have a differant normal, in that case
you'd have to find two vectors that are tangent with the surface at the
vertex (just as V1-V0 and V2-V0 are). If you know of two other points
close to the vertex then you could get a normal that is close. Best is to
take the derivites at the vertex (which is what the others are talking
about).
Tony
Post a reply to this message
|
|