|
|
Le 03/09/2016 à 22:12, clipka a écrit :
> Hi folks,
>
> does anyone have time to examine the mesh in the benchmark scene, and
> check whether the surface normals make any sense? I have reason to
> believe they don't, at least not at the kink in the generating function.
>
You mean :
#macro L_GetVN(ResSpl)
#local I = 0;
#local A = array[ResSpl+1][2]
#while (I<=ResSpl)
#local P0 = 0+<FnA(I/ResSpl), I/ResSpl, 0>;
#if (P0.x=0 & P0.z=0)
#local P0 = <1e-25,P0.y,1e-25>;
#end
#if (I=0)
#local P1 = 0+<FnA(((I-0.5)/ResSpl)), I/ResSpl, 0>;
#local P2 = 0+<FnA(((I+0.5)/ResSpl)), I/ResSpl, 0>;
#else
#local P1 = P2;
#local P2 = 0+<FnA(((I+0.5)/ResSpl)), I/ResSpl, 0>;
#end
#local P3 = vrotate(P0,<0,1,0>);
#local P4 = vrotate(P0,<0,-1,0>);
#local B1 = P4-P0;
#local B2 = P2-P0;
#local B3 = P3-P0;
#local B4 = P1-P0;
#local N1 = vcross(B1,B2);
#local N2 = vcross(B2,B3);
#local N3 = vcross(B3,B4);
#local N4 = vcross(B4,B1);
#local N = vnormalize((N1+N2+N3+N4)*-1);
#local A[I][0] = P0;
#local A[I][1] = N;
#local I = I+1;
#end
A
#end
P0 is the point to compute, P1 is the previous intermediate point
P2 is the next intermediate point
P3 & P4 are a bit strange, rotation around y for 1 degree of P0, so kind of sideway
(from origin)
B1,B2,B3,B4 are "diagonal" from P0
N1,N2,N3,N4 are normal computation from 2 neighbouring diagonals.
N is the average of all contributions (negated)
As the original P0 is with .z = 0, the small rotation for P3 & P4 seems ok. as long as
FnA avoid 0.
Post a reply to this message
|
|