POV-Ray : Newsgroups : povray.advanced-users : smooth triangle Normal Server Time
30 Jul 2024 14:30:34 EDT (-0400)
  smooth triangle Normal (Message 1 to 5 of 5)  
From: Phil Clute
Subject: smooth triangle Normal
Date: 9 Jun 1999 01:00:46
Message: <375DF68F.2E0443E8@tiac.net>
From the DOCs:
"The smooth triangles use a formula called Phong normal interpolation to
calculate the surface normal for any point on the triangle based on
normal vectors which you define for the three corners." 

I'm curious as to what the "Phong normal interpolation" formula is.

Actually I guess my real question is: 
In a smooth_triangle you have a 'surface normal' vector. What is
considered
the NORMAL normal for each vertex? I really have no idea how to use this 
part.
I want to be able to average any given number of smooth_triangles who
have
a vertex at the same vector location, .ie (please excuse my ascii art) 
      ____
     \    /\     I want to average a,b and c's normals together
for       
      \  /  \    a smooth transition but I'm not sure what would be
     a \/c___\   the correct starting point.
      b \    /
         \  /
          \/


-- 
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Jerry Anning
Subject: Re: smooth triangle Normal
Date: 9 Jun 1999 05:18:00
Message: <375e2dde.1343158@news.povray.org>
On Wed, 09 Jun 1999 01:07:27 -0400, Phil Clute <pcl### [at] tiacnet>
wrote:
>I'm curious as to what the "Phong normal interpolation" formula is.
>
>Actually I guess my real question is: 
>In a smooth_triangle you have a 'surface normal' vector. What is
>considered
>the NORMAL normal for each vertex? I really have no idea how to use this 
>part.
>I want to be able to average any given number of smooth_triangles who
>have
>a vertex at the same vector location,

Gouraud shading of triangles, a cheap and common method, interpolates
the color intensity at a point in the triangle from those at the
corners.  Phong shading, which is more work but looks better, just
linearly interpolates the surface normal between the corners which is
then used to calculate the shading at the point in the usual way.
This allows the appearance of the triangle to be more accurate.  In
particular, highlights can appear in the interior of the triangle with
Phong shading.  Note that this has nothing to do with Phong vs.
specular highlights.  That is something else entirely.
As to the other question, do it this way:
B  C
|   /
| /
A____D
| \
|  \
...  E

vnormalize(vcross(b-a, c-a)+vcross(c-a,d-a)+vcross(d-a,e-a)...)
Make sure that you are consistent in the sense (clockwise or
counterclockwise) in which you go around the vertex.

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

From: Ron Parker
Subject: Re: smooth triangle Normal
Date: 9 Jun 1999 09:09:38
Message: <375e6792@news.povray.org>
On Wed, 09 Jun 1999 09:18:26 GMT, Jerry Anning wrote:
>vnormalize(vcross(b-a, c-a)+vcross(c-a,d-a)+vcross(d-a,e-a)...)
>Make sure that you are consistent in the sense (clockwise or
>counterclockwise) in which you go around the vertex.

You sure about that?  I think you might get some unintentional
weighting in your average, making the resultant vector lean a bit
towards the longer edges.  I would have thought you'd have to 
normalize all the cross products first, then normalize the result.

Of course, I haven't really thought about it, so I could be wrong.


Post a reply to this message

From: Jerry Anning
Subject: Re: smooth triangle Normal
Date: 9 Jun 1999 13:14:26
Message: <375ea028.2061215@news.povray.org>
On 9 Jun 1999 09:09:38 -0400, par### [at] fwicom (Ron Parker) wrote:

>On Wed, 09 Jun 1999 09:18:26 GMT, Jerry Anning wrote:
>>vnormalize(vcross(b-a, c-a)+vcross(c-a,d-a)+vcross(d-a,e-a)...)
>>Make sure that you are consistent in the sense (clockwise or
>>counterclockwise) in which you go around the vertex.
>
>You sure about that?  I think you might get some unintentional
>weighting in your average, making the resultant vector lean a bit
>towards the longer edges.  I would have thought you'd have to 
>normalize all the cross products first, then normalize the result.
>
>Of course, I haven't really thought about it, so I could be wrong.

Good catch, Ron.  You should indeed change vcross(b-a, c-a) etc. to
vnormalize(vcross(b-a,c-a)) if you want a robust result.  I tend to
forget about that because I usually do it to meshes where local edge
lengths are fairly constant.

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

From: Phil Clute
Subject: Re: smooth triangle Normal
Date: 10 Jun 1999 19:44:02
Message: <37604F55.7198EE52@tiac.net>
Thank you both

-- 
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

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