POV-Ray : Newsgroups : povray.binaries.images : Tinkering with textures : Re: Tinkering with textures Server Time
1 Jun 2024 12:45:05 EDT (-0400)
  Re: Tinkering with textures  
From: architype
Date: 9 Aug 2016 12:40:00
Message: <web.57aa06c568edbca0a67331460@news.povray.org>
>In that case you should look at the PovRay Object collection.
>http://lib.povray.org/searchcollection/index.php

>You will need to register. Then look at the buildings category. You
>could always use that for your collection.

That would have been a possibility, but unfortunately registration has been
disabled due to spammers/bots...
Also, I think one problem that is hard to get around is that the code is
interlinked, at some point one simply has to reuse code and keep track of
search paths.
I put up some of my code on a webpage, by extracting all the files from the
library and it turned out to require 50 files or so...its ok if it is only
..inc or .pov but I tend to use image textures and then it starts adding up.

>BTW Bald Eagle mentioned a vine macro. I have used it and it is quite
>adaptable. I grew one around a Poser model for modesty. ^ ^
>http://graphics.uni-konstanz.de/~luft/ivy_generator/

That looks amazing! :)

> I grew one around a Poser model for modesty. ^ ^

lol ;)

-

About the mesh stone component; I made a demo that shows the main params;
-length, width, height
-a vector to determine how many triangles to split it into
-a value that determines the depth of the cracks
-a value that determines the the amount of cracks

See attached image...
I have pasted the macro code. Best wishes, /A



#macro MeshStoneImpMac (p_W, p_H, p_T,
           p_x0, p_y0, p_z0,
           p_Txt, p_DoTxt,
           p_Num, p_dFactor, p_CracFactor, p_Rnd)

// see below for param explanaition

//-----------------------------------------
// Var

#local BlockW = p_W;
#local BlockH = p_H*p_Num.x/(p_Num.x+p_dFactor);
#local BlockT = p_T;
#local BlockV = <BlockW, BlockH, BlockT>;

#local NumW = p_Num.x; //8*4;
#local NumH = p_Num.y; //6*4;
#local NumT = p_Num.z; //4*4;

#local SecW = BlockW/(NumW-1);
#local SecH = BlockH/(NumH-1);
#local SecT = BlockT/(NumT-1);

#local Front  = array[NumW][NumH];
#local Back   = array[NumW][NumH];

#local Top    = array[NumW][NumT];
#local Bottom = array[NumW][NumT];

#local Left   = array[NumT][NumH];
#local Right  = array[NumT][NumH];

#local dFactor = p_dFactor; //SecW/4;
#local CracFactor = p_CracFactor; //.66;

//-----------------------------------------
// Main

//union{
mesh{

// - - - - - - - - -
// Assign Points

// Front & Back

#local r1 = seed(3446+p_Rnd);
#local r2 = seed(2543+p_Rnd);
#local r3 = seed(4753+p_Rnd);

#local CountJ = NumH-1;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumW-1;
 #local I = 0;
 #while ( I <= CountI )

              #if( rand(r1) < CracFactor )
                 #local dpF = <dFactor*rand(r1), dFactor*rand(r2),
-dFactor*rand(r3)>;
                 #local dpB = <dFactor*rand(r3), dFactor*rand(r1),
dFactor*rand(r2)>;
              #else
                 #local dpF = <dFactor*rand(r1), dFactor*rand(r2),
-dFactor*rand(r3)>/3;
                 #local dpB = <dFactor*rand(r3), dFactor*rand(r1),
dFactor*rand(r2)>/3;
              #end
              #local Front[I][J] = <-BlockW/2+I*SecW, J*SecH,  BlockT/2>+dpF;
              #local Back[I][J]  = <-BlockW/2+I*SecW, J*SecH, -BlockT/2>+dpB;

 #local I = I + 1;
 #end

#local J = J + 1;
#end


// Top & Bottom

#local r4 = seed(1736+p_Rnd);
#local r5 = seed(5543+p_Rnd);
#local r6 = seed(4713+p_Rnd);

#local CountJ = NumT-1;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumW-1;
 #local I = 0;
 #while ( I <= CountI )

              #if( rand(r4) < CracFactor )
                #local dpT = <dFactor*rand(r4), -dFactor*rand(r5),
dFactor*rand(r6)>;
                #local dpB = <dFactor*rand(r6), dFactor*rand(r4),
dFactor*rand(r5)>;
              #else
                #local dpT = <dFactor*rand(r4), -dFactor*rand(r5),
dFactor*rand(r6)>/3;
                #local dpB = <dFactor*rand(r6), dFactor*rand(r4),
dFactor*rand(r5)>/3;
              #end
              #local Top[I][J] = <-BlockW/2+I*SecW, BlockH+dFactor,
-BlockT/2+SecT*J>+dpT;
              #local Bottom[I][J] = <-BlockW/2+I*SecW, 0, -BlockT/2+SecT*J>+dpB;

 #local I = I + 1;
 #end

#local J = J + 1;
#end

#local Count = NumW-1;
#local I = 0;
#while ( I <= Count )

      #local Top[I][0] = Back[I][NumH-1];
      #local Top[I][NumT-1] = Front[I][NumH-1];

      #local Bottom[I][0] = Back[I][0];
      #local Bottom[I][NumT-1] = Front[I][0];

#local I = I + 1;
#end


// Left & Right

#local r7 = seed(2057+p_Rnd);
#local r8 = seed(3963+p_Rnd);
#local r9 = seed(3788+p_Rnd);

#local CountJ = NumH-1;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumT-1;
 #local I = 0;
 #while ( I <= CountI )

              #if( rand(r1) < CracFactor )
                #local dpR = <-dFactor*rand(r7), dFactor*rand(r8),
dFactor*rand(r9)>;
                #local dpL = <dFactor*rand(r9), dFactor*rand(r7),
dFactor*rand(r8)>;
              #else
                #local dpR = <-dFactor*rand(r7), dFactor*rand(r8),
dFactor*rand(r9)>/3;
                #local dpL = <dFactor*rand(r9), dFactor*rand(r7),
dFactor*rand(r8)>/3;
              #end
              #local Right[I][J] = <BlockW/2+dFactor, SecH*J,
-BlockT/2+SecT*I>+dpR;
              #local Left[I][J] = <-BlockW/2, SecH*J, -BlockT/2+SecT*I>+dpL;

 #local I = I + 1;
 #end

#local J = J + 1;
#end

#local Count = NumT-1;
#local I = 0;
#while ( I <= Count )

      #local Right[I][0] = Bottom[NumW-1][I];
      #local Right[I][NumH-1] = Top[NumW-1][I];

      #local Left[I][0] = Bottom[0][I];
      #local Left[I][NumH-1] = Top[0][I];

#local I = I + 1;
#end

#local CountI = NumH-1;
#local I = 0;
#while ( I <= CountI )

      #local Right[0][I] = Back[NumW-1][I];
      #local Right[NumT-1][I] = Front[NumW-1][I];

      #local Left[0][I] = Back[0][I];
      #local Left[NumT-1][I] = Front[0][I];

#local I = I + 1;
#end

// - - - - - - - - -
// Draw

// Front & Back
#local CountJ = NumH-2;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumW-2;
 #local I = 0;
 #while ( I <= CountI )

              triangle{Front[I][J], Front[I+1][J], Front[I+1][J+1]  }
              triangle{Front[I][J], Front[I][J+1], Front[I+1][J+1]  }

              triangle{Back[I][J], Back[I+1][J], Back[I+1][J+1]  }
              triangle{Back[I][J], Back[I][J+1], Back[I+1][J+1]  }

 #local I = I + 1;
 #end

#local J = J + 1;
#end


// Top & Bottom
#local CountJ = NumT-2;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumW-2;
 #local I = 0;
 #while ( I <= CountI )

              triangle{Top[I][J], Top[I+1][J], Top[I+1][J+1]  }
              triangle{Top[I][J], Top[I][J+1], Top[I+1][J+1]  }

              triangle{Bottom[I][J], Bottom[I+1][J], Bottom[I+1][J+1]  }
              triangle{Bottom[I][J], Bottom[I][J+1], Bottom[I+1][J+1]  }

 #local I = I + 1;
 #end

#local J = J + 1;
#end


// Right & Left
#local CountJ = NumH-2;
#local J = 0;
#while ( J <= CountJ )

 #local CountI = NumT-2;
 #local I = 0;
 #while ( I <= CountI )

              triangle{Right[I][J], Right[I+1][J], Right[I+1][J+1]  }
              triangle{Right[I][J], Right[I][J+1], Right[I+1][J+1]  }

              triangle{Left[I][J], Left[I+1][J], Left[I+1][J+1]  }
              triangle{Left[I][J], Left[I][J+1], Left[I+1][J+1]  }

 #local I = I + 1;
 #end

#local J = J + 1;
#end




      #if (p_DoTxt)
           texture{ p_Txt }
      #end

      translate<p_x0, p_y0, p_z0>
 }


#end


#local l_W = 6; // width along x axis
#local l_H = 3; // height along y axis
#local l_T = 4; // length along z axis

#local l_Txt = texture{ pigment{rgb 1} }
#local l_DoTxt = 1;

#local l_Num = <8, 8, 8>*4;  // number of triangles to use
#local l_dFactor = l_W/l_Num.x*.25;   // depth of cracks
#local l_CracFactor = .125;           // amount of cracks
#local l_Rnd = 3268;             // alter seed value for gen multiple stones

#local MeshStoneImpObj =
MeshStoneImpMac
      (l_W, l_H, l_T,
       0, 0, 0,
       l_Txt, l_DoTxt,
       l_Num, l_dFactor, l_CracFactor, l_Rnd)

object{ MeshStoneImpObj }


Post a reply to this message


Attachments:
Download 'stonemeshdemo.jpg' (376 KB)

Preview of image 'stonemeshdemo.jpg'
stonemeshdemo.jpg


 

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