| 
  | 
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 
 | 
  |