|
![](/i/fill.gif) |
> How can I calculate '<0, 0.7071, -0.7071>' SurfaceNormal1 ?
If all you have is a single triangle, you can use any vector for the normal
of a vertex. Use what looks good.
If you have multiple triangles connected at a single vertex, you typically
use the average of all of the triangle's normals as the normal for that
vertex. To do this, you take the normal of each triangle, which can be
calculated by a cross product between the vectors forming two sides of that
triangle:
(triangle consists of v1, v2, v3)
normal = vnormalize(vcross(v2 - v1, v3 - v1));
To get the average of all the triangle's normals, add them together and
vnormalize() the result.
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
![](/i/fill.gif) |