POV-Ray : Newsgroups : povray.general : Calculate normal vector? : Re: Calculate normal vector? Server Time
1 Aug 2024 14:35:38 EDT (-0400)
  Re: Calculate normal vector?  
From: Slime
Date: 8 Sep 2005 02:52:57
Message: <431fdfc9$1@news.povray.org>
> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.