POV-Ray : Newsgroups : povray.binaries.images : POVghanistan Revisited! : Re: POVghanistan Revisited! Server Time
26 Apr 2024 20:59:00 EDT (-0400)
  Re: POVghanistan Revisited!  
From: Jörg "Yadgar" Bleimann
Date: 24 Nov 2019 19:16:10
Message: <5ddb1d4a$1@news.povray.org>
Hi(gh)!

On 24.11.19 11:21, Melody wrote:
> 
> calculate normals of each point, respective to all adjacent faces and use smooth
> triangles, lines go bye bye. iterate verts and compare to each triangle face.
> 
> 
> #macro normal_vector(A,B,C)
>   #local result = vcross(C-B,A-B);
>   result
>   // 1
>   // |
>   // 2__ 3 vz points at you (neg) unless reverse y like pov, then
>   //
>   // 2__ 3
>   // |
>   // 1
> #end
> 
> #macro FastNorms77(sw)
>    // set norms based on ALL adjacent faces-lots of verts means lots of time
>    #local i=0;
>    #while (i<NumVertices)
>      #local nrm = <0,0,0>;
>      #local j = 0;
>      #while (j<NumFaces)
>        #if ((i = Face_Arr[j].x)|(i = Face_Arr[j].y)|(i = Face_Arr[j].z))
>          #local norm =
>
normal_vector(V_vec_Arr[Face_Arr[j].x],V_vec_Arr[Face_Arr[j].y],V_vec_Arr[Face_Arr[j].z]);
>          #local nrm = vnormalize(nrm+vnormalize(norm));
>        #end
>        #local j=j+1;
>      #end // Faces
>      #declare N_vec_Arr[i] = nrm;
>      #local i=i+1;
>      #if (sw)  // Progress on/off
>          #if (mod(100*i/NumVertices,20)<0.1)
>            #debug concat("Checking Normals  >
> ",str(int(100*i/NumVertices),5,1),"%\n")
>         #end
>      #end
>    #end // Verts
> #end
> 
> 
> 
> 

Where did you define Face_Arr and V_vec_Arr?

See you in Khyberspace!

Yadgar


Post a reply to this message

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