POV-Ray : Newsgroups : povray.binaries.images : Suggestions needed : Re: Suggestions needed Server Time
31 Jul 2024 10:28:23 EDT (-0400)
  Re: Suggestions needed  
From: Dave Blandston
Date: 28 Apr 2010 08:55:00
Message: <web.4bd82f705bb1be65cba3fb0f0@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> That's a nicely interesting idea; I get the gist of it. Worth experimenting with
> at my end.  Thanks!
>
> Ken

Here's all the code, in case you're interested...

   #local ThreadWidth = .18;
   #local EdgeWidth = .16;
   #local HorizontalScale = 1/1; //MUST be 1/N, to make the HF tileable.
   #local RowOffset = 1/3;
   #local DeltaTheta = 1; //MUST be a factor of 90.
   #local HFResolution = 512;

   #local D = EdgeWidth / HorizontalScale;

   #local NPigments = 90 / DeltaTheta + 1;

   #local BallisticNylonPigment = array [NPigments]

   #local Theta1 = 0;
   #local I = 0;
   #while (I < NPigments)
      #local CurWhite = color White * pow (sin (radians (Theta1)), .5);
      #local BallisticNylonPigment [I] = pigment {
         gradient x
         color_map {
            #local Theta2 = 0;
            #while (Theta2 <= 90)
               #local CurPos = D * (Theta2 / 90); //0 .. D
               [CurPos color CurWhite * pow (sin (radians (Theta2)), .5)]
               #local Theta2 = Theta2 + DeltaTheta;
            #end //#while
            #local Theta2 = 90;
            #while (Theta2 >= 0)
               #local CurPos = 1 - D * (Theta2 / 90); //D .. 0
               [CurPos color CurWhite * pow (sin (radians (Theta2)), .5)]
               #local Theta2 = Theta2 - DeltaTheta;
            #end //#while
         } //color_map
         scale <HorizontalScale, 1, 1>
      } //pigment
      #local Theta1 = Theta1 + DeltaTheta;
      #local I = I + 1;
   #end //#while

   #local BallisticNylon = pigment {
      gradient y
      pigment_map {
         #local P1 = .5 - ThreadWidth / 2 - EdgeWidth;
         #local P2 = .5 - ThreadWidth / 2;
         #local D = P2 - P1;
         [0 color Black]
         #local I = 0;
         #while (I < NPigments)
            [P1 + D * (I / NPigments) BallisticNylonPigment [I]]
            #local I = I + 1;
         #end //#while
         #local P1 = .5 + ThreadWidth / 2;
         #local P2 = .5 + ThreadWidth / 2 + EdgeWidth;
         #local D = P2 - P1;
         #local I = 0;
         #while (I < NPigments)
            [P1 + D * (I / NPigments) BallisticNylonPigment [NPigments - I - 1]]
            #local I = I + 1;
         #end //#while
         [1 color Black]
      } //pigment_map
   } //pigment

   #local BallisticNylon = pigment {
      average
      pigment_map {
         [1 BallisticNylon]
         [1 BallisticNylon translate <RowOffset * HorizontalScale, .5, 0>]
      } //pigment_map
      scale BallisticNylonScale
   } //pigment

   #local BallisticNylon = height_field {
      function HFResolution, HFResolution {pigment {BallisticNylon}}
      smooth
      rotate -90 * x
      scale <1, 1, .08>
   } //height_field


Post a reply to this message

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