POV-Ray : Newsgroups : povray.beta-test : HF* macros issues : HF* macros issues Server Time
29 Jul 2024 16:24:01 EDT (-0400)
  HF* macros issues  
From:
Date: 15 Apr 2002 07:59:28
Message: <c9blbuoc1poptcc2i138sol3hugtf1pd24@4ax.com>
POV 3.5 RC1 Win installation

===========================================
HFComputeNormal()
===========================================
  Not used but still (commented) in include file

===========================================
HFCreate_()
===========================================
1. Unused Type parameter in HFCreate_ macro.
2. Putting comment inside loop can slow down execution I think
3. First loop use two locals but can be realised with only one.
   Here is my version of first loop with speed optimization
   but without annoying #debug

   #if (Smooth)
      // CALCULATION OF NORMAL VECTOR
      // We don't vnormalize the vectors from the current center point
      // to its neightbor points because we want a weighted average
      // where bigger areas contribute more. This also means that the
      // center point can be left out completely of the calculations:
      #local NArr = array[xRes][zRes]
      #local J = 1;
      #while (J<=xRes)
         #local K = 1;
         #while (K<=zRes)
            #local VC =
vcross(vnormalize(PArr[J][K+1]-PArr[J][K-1]),vnormalize(PArr[J+1][K]-PArr[J-1][K]));
            #declare NArr[J-1][K-1] = ( VC.gray=0 ? 333*x : vnormalize(VC) );
            #declare K = K+1;
         #end
         #declare J = J+1;
      #end
   #end

===========================================
HF_Square(), HF_Sphere(), HF_Cylinder(), HF_Torus()
===========================================
I think that content of loop can be optimized. to remove jumping for conditions.
For example content for HS_Square could be:
    CURRENTLY:
         #local UV = <(J-1)/(xRes-1),0,(K-1)/(zRes-1)>;
         #local P  = (UV*Ext*<1,0,1> + MnExt);
         #if (UVmap)
            #local H = Function(UV.x, UV.z, 0);
         #else
            #local H = Function(P.x, P.y, P.z);
         #end
         #declare PArr[J][K] = P + H*Ext*y;
    MY REPLACEMENT:
         #local UV = <(J-1)/(xRes-1),0,(K-1)/(zRes-1)>;
         #local P  = (UV*Ext*<1,0,1> + MnExt);
         #declare PArr[J][K] = P +
Function(UVmap?UV.x:P.x,UVmap?UV.z:P.y,UVmap?0:P.z)*Ext*y;

===========================================
scenes\incdemo\shapes.pov
===========================================

Example shows dark areas on edges of meshes.
It is probably result of low resolution (and direction of normals).

ABX


Post a reply to this message

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