POV-Ray : Newsgroups : povray.advanced-users : Help : Normals and utilities. Server Time
2 Nov 2024 07:26:42 EDT (-0400)
  Help : Normals and utilities. (Message 1 to 4 of 4)  
From: Sybs ALHABSHI
Subject: Help : Normals and utilities.
Date: 8 Dec 1999 23:55:47
Message: <384f3653@news.povray.org>
I'm trying to find the formula and explanation about normals for smooth
triangles. All info is helpful thanks.


Post a reply to this message

From: Ken
Subject: Re: Help : Normals and utilities.
Date: 9 Dec 1999 00:04:16
Message: <384F36EB.589687A1@pacbell.net>
Sybs ALHABSHI wrote:
> 
> I'm trying to find the formula and explanation about normals for smooth
> triangles. All info is helpful thanks.

Try Warp's mesh smoothing utility. It is made specificaly for POV-Ray
plus the docs give a good explaination of triangle smoothing.

http://www.students.tut.fi/~warp/PovUtils/

-- 
Ken Tyler -  1200+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Help : Normals and utilities.
Date: 9 Dec 1999 03:47:16
Message: <qqmd7sgxzzf.fsf@goldach.fmi.uni-konstanz.de>
"Sybs ALHABSHI" <syb### [at] htsavoiecom> writes:

> I'm trying to find the formula and explanation about normals for smooth
> triangles. All info is helpful thanks.

The comments in the source code is the only place I know, where the
calculation of the normals is explained. It is written in triangle.c:


/*****************************************************************************
*
* FUNCTION
*
*   Smooth_Triangle_Normal
*
* INPUT
*   
* OUTPUT
*   
* RETURNS
*   
* AUTHOR
*
*   POV-Ray Team
*   
* DESCRIPTION
*
*   Calculate the Phong-interpolated vector within the triangle
*   at the given intersection point. The math for this is a bit
*   bizarre:
*
*      -         P1
*      |        /|\ \
*      |       / |Perp\
*      |      /  V  \   \
*      |     /   |    \   \
*    u |    /____|_____PI___\
*      |   /     |       \    \
*      -  P2-----|--------|----P3
*                Pbase    PIntersect
*          |-------------------|
*                         v
*
*   Triangle->Perp is a unit vector from P1 to Pbase. We calculate
*
*   u = (PI - P1) DOT Perp / ((P3 - P1) DOT Perp).
*
*  We then calculate where the line from P1 to PI intersects the line P2 to P3:
*   PIntersect = (PI - P1)/u.
*
*   We really only need one coordinate of PIntersect.  We then calculate v as:
*
*        v = PIntersect[X] / (P3[X] - P2[X])
*   or   v = PIntersect[Y] / (P3[Y] - P2[Y])
*   or   v = PIntersect[Z] / (P3[Z] - P2[Z])
*
*   depending on which calculation will give us the best answers.
*
*   Once we have u and v, we can perform the normal interpolation as:
*
*     NTemp1 = N1 + u(N2 - N1);
*     NTemp2 = N1 + u(N3 - N1);
*     Result = normalize (NTemp1 + v(NTemp2 - NTemp1))
*
*   As always, any values which are constant for the triangle are cached
*   in the triangle.
*
* CHANGES
*
*   -
*
******************************************************************************/

I hope this helps.
Thomas

P.S.: I'm curious: For what project do you need this info?

-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Help : Normals and utilities.
Date: 14 Dec 1999 14:18:31
Message: <38569807@news.povray.org>
In article <qqm### [at] goldachfmiuni-konstanzde> , Thomas Willhalm
<tho### [at] willhalmde>  wrote:

>> I'm trying to find the formula and explanation about normals for smooth
>> triangles. All info is helpful thanks.
>
> The comments in the source code is the only place I know, where the
> calculation of the normals is explained. It is written in triangle.c:

All (or at least most) computer graphics books are the place :-)  The books
you look for are in most libraries, the list of books is at the end of the
POV-Ray manual.


    Thorsten


Post a reply to this message

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