POV-Ray : Newsgroups : povray.advanced-users : normal interpolation Server Time
25 Dec 2024 21:45:57 EST (-0500)
  normal interpolation (Message 1 to 4 of 4)  
From: Anton Sherwood
Subject: normal interpolation
Date: 6 Sep 2006 11:59:53
Message: <44fef079$1@news.povray.org>
When I define the normals at the corners of a smooth_triangle,
how exactly is the interpolation done -- is it a linear weighted sum of 
the corner vectors, or something subtler?  Is each normal vector first 
converted to a unit vector?

(Yes, I have a project in mind which could depend on such subtleties.)

-- 
Anton Sherwood, http://www.ogre.nu/
"How'd ya like to climb this high *without* no mountain?" --Porky Pine


Post a reply to this message

From: Anthony D'Agostino
Subject: Re: normal interpolation
Date: 6 Sep 2006 18:40:34
Message: <44ff4e62$1@news.povray.org>
I don't think they have to be normalized at all -- the averaged vector will 
still point in the same direction -- but normalizing is standard. (I could 
be wrong on this, though.)


Post a reply to this message

From: Mike Williams
Subject: Re: normal interpolation
Date: 6 Sep 2006 20:07:20
Message: <EB6y$PArG2$EFwzG@econym.demon.co.uk>
Wasn't it Anton Sherwood who wrote:
>When I define the normals at the corners of a smooth_triangle,
>how exactly is the interpolation done -- is it a linear weighted sum of 
>the corner vectors, or something subtler?  Is each normal vector first 
>converted to a unit vector?

I don't know what the rule is, but it doesn't appear to be linear
weighted sum.

This code looks at the normals along one edge of a particular smooth
trinagle. The "N" vector is what trace() finds at points along one edge,
and "A" is the vnormalized linear weighted sum. There are distinct
differences.


#version 3.6;
camera {location  <0,0,-10>*10 look_at <0,0,0> angle 50}
light_source {<-30, 100, -30> color rgb 1}

#include "strings.inc"

#declare N1 = <0,  0.7071, -0.7071>; 
#declare N2 = <0, -0.8664, -0.5>;
#declare N3 = <0, -0.5,    -0.8664>;

#declare T = smooth_triangle {
  <  0,  30, 0> N1 
  < 30,   0, 0> N2
  <  0,   0, 0> N3 
  pigment {rgb 2}
}

object {T}

#declare Y=0;
#while (Y<=30) 
  #declare N=<0,0,0>;
  #declare P = trace(T, <0,Y,-100>, <0,0,1>, N);
  
  #declare A = N1*(Y/30) + N3*(1-Y/30);
  
  #debug concat( str(Y,0,0),": ",VStr(N)," ", VStr(vnormalize(A)), "\n")
  #declare Y=Y+1;
#end


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Anton Sherwood
Subject: Re: normal interpolation
Date: 6 Sep 2006 22:32:35
Message: <44ff84c3@news.povray.org>
Anton Sherwood wrote:
> (Yes, I have a project in mind which could depend on such subtleties.)

On second thought, never mind.

-- 
Anton Sherwood, http://www.ogre.nu/
"How'd ya like to climb this high *without* no mountain?" --Porky Pine


Post a reply to this message

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