POV-Ray : Newsgroups : povray.general : Normals with large and small traingles. : Re: Normals with large and small traingles. Server Time
6 Aug 2024 10:24:44 EDT (-0400)
  Re: Normals with large and small traingles.  
From: Warp
Date: 8 Apr 2002 19:43:02
Message: <3cb22b06@news.povray.org>
Shay <sah### [at] simcopartscom> wrote:
> How can I calculate the normal of a vertex which lies on the side of a
> triangle. but not at the corner?
>  ___________y
>  |\       /|
>  | \  B  / |
>  |  \   /  |
>  |   \ /   |
>  | C  X    |
>  |   /     |
>  |  /   A  |
>  | /       |
>  |/________|
   z

>  How would I calculate the normal at point X given the normals of triangles
> A, B, & C?

  If B and C both share a vertex with A (marked as vertices 'y' and 'z' in
the picture), and X lies on the side of A, then B and C lie on the same plane
and could be replaced with one triangle.
  If replacing them is not an option, then the answer is that the normal
at X is the interpolation of the normal vectors at 'y' and 'z', that is,
the weigthed average of the normals, where the weighting factor is the
distance of X from y or z.
  This is how POV-Ray interpolates the normals of a smooth triangle (or at
least I suppose so), so you should get smooth lighting in this edge. (If
POV-Ray interpolates in some other way, you'll get a sharp edge in the
lighting.)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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