POV-Ray : Newsgroups : povray.text.scene-files : Brick Wall macro : Brick Wall macro Server Time
21 Dec 2024 21:54:37 EST (-0500)
  Brick Wall macro  
From: Nekar Xenos
Date: 28 Mar 2011 13:20:50
Message: <op.vs2c4uofufxv4h@xena>
My Brick Wall macro. I haven't had time to clean it up yet, so I'm putting  
it up as is for the time being.

-- 
-Nekar Xenos-

//// Begin Code//////////////////////////////////


//#version 3.7;
/*
#include "colors.inc"


global_settings {
//  assumed_gamma 1.0
}



// ----------------------------------------

camera {
   location  <-.5, .5, -1>
   //direction 1.5*z
   right     x*image_width/image_height
   look_at   <0, .2,  0>
}

sky_sphere {
   pigment {
     gradient y
     color_map {
       [0.0 rgb <0.6,0.8,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

light_source {
   <0, 0, 0>            // light's position (translated below)
   color rgb <1, 1, 1>  // light's color
   translate <-30, 30, -30>
}

// ----------------------------------------

plane {
   y, 0
   pigment { color rgb .01}
}
    */
  ///////////////////////////////



  #include "functions.inc"
  /*#include"BrickMesh.inc"
  #include"BrickMesh2.inc"
  #include"BrickMesh3.inc"
  #include"BrickMesh4.inc"
  #include"BrickMesh5.inc"
  #include"BrickMesh6.inc"
  #include"BrickMesh7.inc"
  #include"BrickMeshLo.inc"*/
#declare Rand=seed(197531);

#declare Ymem=0;
#declare BrickMem=0;

///////////////////////////////////////////////////////

#macro  
Brick(BrickType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol,BrickColA,BrickColB,BrickColG,Rnd)

#local BrickSize=<BrickSizeX,BrickSizeY,BrickSizeZ>;

#if (BrickType=1)
box{<-1,0,0>,<1,1,1>
  scale <BrickSize.x/2,BrickSize.y,BrickSize.z>


pigment{crackle form <1,0,0> scale .0015 translate  
<0,BrickSize.y/2,BrickSize.z/2> pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 spherical scale  
<.1,.0351,1>/.0015
                                                    pigment_map{
                                                          [0 agate scale  
.0015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.99  rgb BrickCol*.8][1 rgb BrickColG+.01]}   //  
<.15,.05,.03>
                                                         ]
                                                         [.1 agate scale  
.015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.5  rgb BrickCol][.99 rgb BrickColB][1 rgb BrickColG]}   //  
<.15,.05,.03>
                                                         ]
                                                         }
                                                 ]
                                                 }
         }
normal {crackle 3  scale .0015 form <1,.7,0> }
}
#end // BrickType 1

//////////////////////////////////////////////////

#if (BrickType=2)
//box{<-1,0,0>,<1,1,1>
superellipsoid { <.2,.2>
  scale <BrickSize.x/2,BrickSize.y/2,BrickSize.z/2>



pigment{crackle scale .0015  form <1,0,0> pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 spherical scale  
<.1,.0351,1>/.0015
                                                    pigment_map{
                                                          [0 agate scale  
.0015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.99  rgb BrickCol*.8][1 rgb BrickColG+.01]}   //  
<.15,.05,.03>
                                                         ]
                                                         [.1 agate scale  
.015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.5  rgb BrickCol][.99 rgb BrickColB][1 rgb BrickColG]}   //  
<.15,.05,.03>
                                                         ]
                                                         }
                                                 ]
                                                 }
         }
normal {agate   scale .1 translate  
<10*rand(Rand),10*rand(Rand),10*rand(Rand)>}
}
  translate <0,BrickSize.y/2,BrickSize.z/2>
#end // BrickType 2


////////////////////////////////////////////////
#if (BrickType=3)

#declare BrickNr=1+int(4*rand(Rand));
#while (BrickNr=BrickMem)
  #declare BrickNr=1+int(7*rand(Rand));
#end

#declare BrickMem=BrickNr;




object{BrickMeshLo
  scale <BrickSize.x/2,BrickSize.y,BrickSize.z>



pigment{crackle  scale .0015  form <1,0,0>  translate  
<0,BrickSize.y/2,BrickSize.z/2>
                                 pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 spherical scale  
<.1,.0351,1>/.0015
                                                    pigment_map{
                                                          [0 agate scale  
.0015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.99  rgb BrickCol*.8][1 rgb BrickColG+.01]}   //  
<.15,.05,.03>
                                                         ]
                                                         [.1 agate scale  
.015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.5  rgb BrickCol][.99 rgb BrickColB][1 rgb BrickColG]}   //  
<.15,.05,.03>
                                                         ]
                                                         }
                                                 ]
                                                 }
         }
normal {agate   scale .1 translate  
<10*rand(Rand),10*rand(Rand),10*rand(Rand)>}

translate z*.01
}

#if (BrickNr=1)
rotate z*180  translate y*BrickSize.y
#end
#if (BrickNr=2)
rotate x*180   translate <0,BrickSize.y ,BrickSize.z>
#end
#if ((BrickNr=3))
scale -x
#end
#if ((BrickNr=4))
scale -y   translate <0,BrickSize.y ,0>
#end
#if ((BrickNr=5))
scale -z   translate <0,0,BrickSize.z >
#end

#end // BrickType 3

/////////////////////////

#if (BrickType=4)


#local rnd=rand(Rand);
#local rnd1=.1*rand(Rand);
#local rnd10=.01*rand(Rand);
#local rnd100=.001*rand(Rand);
#local rnd1000=.0001*rand(Rand);

#local rndX=rand(Rand);
#local rndY=rand(Rand);
#local rndZ=rand(Rand);

isosurface {
   function {f_rounded_box  
(x,y,z,0.0025,BrickSizeX/2,BrickSizeY/2,BrickSizeZ/2)
            +f_agate(x*.5+rndX,y*.5+rndY,z*(10))*(.0035)
            //+f_crackle(x*300,y*300,z*300)*.001
            -f_granite(x*(5+rnd*10),y*(5+rnd*10),z*(5+rnd*10))*(.0025+rnd100)


             }        // function (can also contain declared functions
   //function { fn_X(x, y, z) }        // alternative declared function
   contained_by { box { -BrickSize*.6, BrickSize*.6 } }  // container shape
   //accuracy 0.001                      // accuracy of calculation [0.001]
   //accuracy .002
    all_intersections

   #if(rand(Rand)>.5)
       rotate z*180
   #end

   #if(rand(Rand)>.5)
       rotate x*180
   #end
   #if(rand(Rand)>.5)
       scale -z
   #end
   #if(rand(Rand)>.5)
       scale -x
   #end
   #if(rand(Rand)>.5)
       scale -y
   #end


//pigment{rgb <.2,.02,.01>}
pigment{crackle scale .0015  form <1,0,0> pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 spherical scale  
<.1,.0351,1>/.0015
                                                    pigment_map{
                                                          [0 agate scale  
.0015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.99  rgb BrickCol*.8][1 rgb BrickColG+.01]}   //  
<.15,.05,.03>
                                                         ]
                                                         [.1 agate scale  
.015  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                             pigment_map{[0  
rgb BrickColA][.5  rgb BrickCol][.99 rgb BrickColB][1 rgb BrickColG]}   //  
<.15,.05,.03>
                                                         ]
                                                         }
                                                 ]
                                                 }
         }
translate <0,BrickSizeY/2,BrickSizeZ/2>
}

#end//Bricktype 4


#end// macro Brick(BrickType,BrickSize,BrickCol)


//Brick(<.15,.05,.03>)

#macro  
BrickWall(WallType,WallWidth,WallHeight,WallDeapth,StartBrick,GrimeType)

  #if(WallDeapth<0)
     #declare WallBottom=-WallDeapth;
     #declare WallDeapth=1;
  #else
    #declare WallBottom=0;

  #end


#include"BrickMeshLo.inc"




        #declare Ymem=0;

       #local BrickWalltype=WallType;

       #local BrickCol1=<.2,.07,.06>;
       #local BrickCol=BrickCol1;

       #local BrickColA1=<.15,.07,.06>*.7;
       #local BrickColA=BrickCol1;

       #local BrickColB1=<.045,.035,.055>;
       #local BrickColB=BrickColB1;

       #local BrickColG1=<.0325,.03,.035>;//<.11,.1,.12>*.5;
       #local BrickColG=BrickColG1;

       #local BrickSizeX=.195;
       #local BrickSizeY=.07;
       #local BrickSizeZ=.095;
       #local BrickSize=<.195,.07,.0975>;

       #local BrickX=.0975;
       #local BrickY=WallBottom;
       #local XCount=0;
       #local YCount=0;

       #if(StartBrick)
            #local BrickX=0;
            #local YCount=1;
       #end

       #local XBrickCount=-.5+int(WallWidth/BrickSize.x);
       #local YBrickCount=int(WallHeight/BrickSize.y) ;



       #local MortarX=(WallWidth-(XBrickCount*BrickSizeX))/XBrickCount;
       #local MortarY= (WallHeight-(YBrickCount*BrickSizeY))/YBrickCount;

       #local MortarWall=  
<WallWidth-MortarX,WallHeight-WallBottom-2*MortarY,(BrickSizeZ*WallDeapth)-MortarX>;


        #while(MortarX<.012)
           //#local BrickSize=BrickSize-x*.002;
           #local XBrickCount=XBrickCount-1;
           #local  
MortarX=(WallWidth-(XBrickCount*BrickSize.x))/int(XBrickCount);

       #end

       #while(MortarY<.012)
           //#local BrickSize=BrickSize-y*.002;
           #local YBrickCount=YBrickCount-1;
           #local MortarY=  
(WallHeight-(YBrickCount*BrickSize.y))/YBrickCount;

       #end

       #local BrickX=BrickX+MortarX/2;

       ///////////////////////////////////////

       //#declare  
Brick1=Brick(WallType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))

      
////////////////////////////////////////////////////////////////////////////////////////////////
       #if (WallType)

               union{
                       /////////////////////////////////////////Mortar////////////
                      #if(WallType>0)

                       isosurface {  // mortar
                                   function {f_rounded_box  
(x,y,z,.1,(WallWidth/2)-MortarX*2,((WallHeight-WallBottom)/2)-2*MortarY,(BrickSizeZ/2)-(MortarX*1.1))
                                            -f_agate(x*30,y*30,z*30)*.01
                                            //+f_crackle(x*300,y*300,z*300)*.001

                                             }        // function (can also  
contain declared functions
                                   //function { fn_X(x, y, z) }        //  
alternative declared function
                                   contained_by { box {  
-MortarWall*<.6,.6,1>, MortarWall*<.6,.6,1> } }  // container shape
                                   accuracy 0.0001                      //  
accuracy of calculation [0.001]
                                   translate (MortarWall/2)+z*MortarX
                                 //pigment{rgb <.2,.02,.01>}
                                 pigment{spherical scale 1.5 translate  
<1,.8,1> warp{turbulence <0,.1,0>}   scale MortarWall /2
                                                 pigment_map{
                                                             [0 agate   
rotate <0,0,90> scale <.3,1,.3>/(MortarWall) colour_map{[0 rgb  
<.09,.08,.07>*.3][1 rgb .05*.3]}]   // dark
                                                             [1 agate  
rotate <0,0,90> scale <.3,1,.3>/(MortarWall) colour_map{[0 rgb  
<.7,.5,.3>*.5*.5][1 rgb <0.45,0.4,0.35>*.2]}] // light
                                                             }

                                                 }
                                 translate y*WallBottom
                                 }
                       #else

                            box{ (MortarX-MortarWall)/2,  
(MortarWall-MortarX)/2
                                 translate (MortarWall/2)+z*MortarX
                                pigment{boxed translate 1 scale MortarWall/2
                                         pigment_map{
                                                     [0 agate scale  
<.5,3,10> colour_map{[0 rgb <.3,.29,.25>*2][1 rgb .2]}]
                                                     [1 agate scale  
<.5,3,10> colour_map{[0 rgb .3][1 rgb .1]}]
                                                     }

                                         }
                                 }

                       #end


                        //////////////////

                       #while (BrickX<WallWidth+1)

                             #if  
((WallType>4)*((BrickX>(BrickSizeX+MortarX))*(BrickX<(WallWidth-BrickSizeX))))
                                 #local BrickWalltype=2+int(3*rand(Rand));
                             #else
                                 #if (WallType>4)
                                     #local BrickWalltype=4;
                                  #end
                             #end


                             #switch (GrimeType)
                                   #case (1)   // normal grime
                                     #declare  
BrickCol=(BrickCol1*2)-(BrickCol1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(WallHeight/2))/WallHeight)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColB=(BrickColB1*2)-(BrickColB1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(WallHeight/2))/WallHeight)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColG=(BrickColG1*2)-(BrickColG1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(BrickY-(WallHeight/2))/WallHeight)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColA=(BrickColA1*2)-(BrickColA1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(WallHeight/2))/WallHeight)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                   #break
                                   #case (2) // Position according to floors
                                     #declare  
BrickCol=(BrickCol1*2)-(BrickCol1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColB=(BrickColB1*2)-(BrickColB1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColG=(BrickColG1*2)-(BrickColG1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(BrickY-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColA=(BrickColA1*2)-(BrickColA1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(3*(BrickY-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;

                                   #break
                                    #case (3) // dark
                                     #declare  
BrickCol=(BrickCol1*2)-(BrickCol1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(3-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColB=(BrickColB1*2)-(BrickColB1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(3-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColG=(BrickColG1*2)-(BrickColG1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(3-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;
                                     #declare  
BrickColA=(BrickColA1*2)-(BrickColA1*(abs((BrickX-(WallWidth/2))/WallWidth)+abs(2*(3-(3/2))/3)))+<-.005*rand(Rand),-.01*rand(Rand),-.01*rand(Rand)>;

                                   #break
                             #end

                            
object{Brick(BrickWalltype,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol,BrickColA,BrickColB,BrickColG,rand(Rand))
 
rotate 5*(.5-<rand(Rand),rand(Rand),rand(Rand)>) translate  
<BrickX,BrickY,0>}
                             //object{Brick1 rotate  
5*(BrickWalltype>1)*(.5-<rand(Rand),rand(Rand),rand(Rand)>) translate  
<BrickX,BrickY,0>}

                             #if(WallDeapth>1)
                                
object{Brick(BrickWalltype,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))
 
rotate 5*(.5-<rand(Rand),rand(Rand),rand(Rand)>) translate  
<BrickX,BrickY,BrickSizeX-BrickSizeZ>}
                             #end
                             #if (WallType>4)
                                     #local BrickWalltype=4;
                                  #end

                             #if (BrickX>=WallWidth-.1950-.0975)


                                  #declare Ymem=BrickY;


                                  #if((BrickX<WallWidth-.1950)*(WallDeapth>1))
                                 
object{Brick(BrickWalltype,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol,BrickColA,BrickColB,BrickColG,rand(Rand))
 
rotate y*90 translate <BrickX+BrickSizeZ+MortarX/2,BrickY,.0975>}
                                  #end

                                  #local BrickY=BrickY+.07+MortarY; //.01;
                                  #local YCount=YCount+1;

                                  #if (BrickY>=WallHeight-.04)
                                      #local BrickX=WallWidth+10;
                                  #end

                                  #if(YCount/2=int(YCount/2))
                                       #local BrickX=-.0975-.01;
                                  #else
                                       #local BrickX=0;
                                       #if  
((BrickY<WallHeight-.04)*(WallDeapth>1))
                                          
object{Brick(BrickWalltype,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol,BrickColA,BrickColB,BrickColG,rand(Rand))
 
rotate y*90 translate <BrickX+MortarX/2,BrickY,.0975>}
                                       #end
                                  #end

                                  //#local BrickX=BrickX-WallWidth;

                                  #if (BrickY>=WallHeight-.04)
                                      #local BrickX=WallWidth+2;
                                  #end
                             #end
                             #local BrickX=BrickX+BrickSizeX+MortarX;//.2;
                             #local XCount=XCount+1;
                       #end


                       } // Union
         #else
             box { -MortarWall*.5, MortarWall*.5 translate  
(MortarWall/2)+z*MortarX/4+y*WallBottom
                 pigment{
                         // solid pattern for use in  
texture/pigment/normal(/density)
                           // brick pattern generates a brick wall like  
structure
                           brick
                           pigment{boxed translate 1 scale MortarWall/2
                                         pigment_map{
                                                     [0 agate scale  
<.5,3,10> colour_map{[0 rgb .051][1 rgb .01]}]
                                                     [1 agate scale  
<.5,3,10> colour_map{[0 rgb <.3,.29,.25>*.3][1 rgb .05]}]
                                                     }

                                         }
                           ,          // color of mortar
                           pigment{crackle scale .0015 form <1,0,0>  
pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 granite scale 1  rotate  
x*90  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                         pigment_map{[0 rgb  
BrickColA*.1][.5  rgb BrickCol*.1][.99 rgb BrickColB*.1][1 rgb  
BrickColG*.1]}   // <.15,.05,.03>
                                                 ]

                                                 }
         }           // color of brick
                           brick_size <BrickSizeX,BrickSizeY,BrickSizeZ>    
// size of brick    (optional)
                           mortar    MortarY       // width of mortar   
(optional)

                         }
                 normal{brick brick_size  
<BrickSizeX,BrickSizeY,BrickSizeZ>  mortar    MortarY  }
                 }
         #end
#end//#macro  
BrickWall(WallType,WallWidth,WallHeight,WallDeapth,StartBrick,GrimeType)

///////////////////////////////////////////////////////////////////////////////////

//--------------------------------------------------------------//

////////////////////Pillar////////////////////////////////////////


#macro BrickPillar(PillarType,PillarWidth,PillarHeight)
       #local BrickCol1=<.2,.07,.06>;
       #local BrickCol=BrickCol1;

       #local BrickColA1=<.15,.07,.06>*.7;
       #local BrickColA=BrickCol1;

       #local BrickColB1=<.045,.035,.055>;
       #local BrickColB=BrickColB1;

       #local BrickColG1=<.0325,.03,.035>;//<.11,.1,.12>*.5;
       #local BrickColG=BrickColG1;

       #local BrickSizeX=.195;
       #local BrickSizeY=.07;
       #local BrickSizeZ=.095;
       #local BrickSize=<.195,.07,.0975>;

       #local BrickX=.0975;
       #local BrickY=0;
       #local XCount=0;
       #local YCount=0;



       #local XBrickCount=-.5+int(PillarWidth/BrickSize.x);
       #local YBrickCount=int(PillarHeight/BrickSize.y) ;



       #local MortarX=(PillarWidth-(XBrickCount*BrickSizeX))/XBrickCount;
       #local MortarY= (PillarHeight-(YBrickCount*BrickSizeY))/YBrickCount;

       #local MortarPillar=  
<PillarWidth-MortarX,PillarHeight-2*MortarY,PillarWidth-MortarX>;

       #local PillarSize=<PillarWidth,PillarHeight,PillarWidth>;


       /* #while(MortarX<.01)
           //#local BrickSize=BrickSize-x*.002;
           #local XBrickCount=XBrickCount-1;
           #local  
MortarX=(PillarWidth-(XBrickCount*BrickSize.x))/int(XBrickCount);

       #end */

       #while(MortarY<.008)
           //#local BrickSize=BrickSize-y*.002;
           #local YBrickCount=YBrickCount-1;
           #local MortarY=  
(PillarHeight-(YBrickCount*BrickSize.y))/YBrickCount;

       #end

       //#local BrickX=BrickX;

      
////////////////////////////////////////////////////////////////////////////////////////////////
       #if (PillarType)
               union{
                       /////////////////////////////////////////Mortar////////////
                       isosurface {  // mortar
                                   function {f_rounded_box  
(x,y,z,0,(PillarWidth-MortarX*.1)/2,(PillarHeight/2),(PillarWidth-MortarX*.1)/2)
                                            -f_agate(x*30,y*30,z*30)*.01
                                            //+f_crackle(x*300,y*300,z*300)*.001

                                             }        // function (can also  
contain declared functions
                                   //function { fn_X(x, y, z) }        //  
alternative declared function
                                   contained_by { box { -PillarSize*.7,  
PillarSize*.7} }  // container shape
                                   accuracy 0.001                      //  
accuracy of calculation [0.001]
                                   translate (PillarSize/2)
                                 //pigment{rgb <.2,.02,.01>}
                                 pigment{boxed translate 1 scale  
MortarPillar/2
                                         pigment_map{
                                                     [0 agate scale .5  
colour_map{[0 rgb .051][1 rgb .01]}]
                                                     [1 agate scale .5  
colour_map{[0 rgb <.3,.29,.25>*.3][1 rgb .05]}]
                                                     }

                                         }

                                 }

                        //////////////////

                       //#while (BrickX<PillarWidth+1)
                       #while (BrickY<PillarHeight-.04)

                             #declare  
BrickCol=(BrickCol1*2)-(BrickCol1*(abs(2*(BrickY-(PillarHeight/2))/PillarHeight)));
                             #declare  
BrickColB=(BrickColB1*2)-(BrickColB1*(abs(2*(BrickY-(PillarHeight/2))/PillarHeight)));
                             #declare  
BrickColG=(BrickColG1*2)-(BrickColG1*(abs(2*(BrickY-(PillarHeight/2))/PillarHeight)));
                             #declare  
BrickColA=(BrickColA1*2)-(BrickColA1*(abs(2*(BrickY-(PillarHeight/2))/PillarHeight)));

                            
object{Brick(PillarType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))
 
rotate 5*(PillarType>1)*(.5-<rand(Rand),rand(Rand),rand(Rand)>) translate  
<BrickX,BrickY,0>}
                            
object{Brick(PillarType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))
 
rotate 5*(PillarType>1)*(.5-<rand(Rand),rand(Rand),rand(Rand)>) translate  
<PillarWidth-BrickX,BrickY,PillarWidth-BrickSizeZ>}
                            
object{Brick(PillarType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))
 
rotate 5*(PillarType>1)*(.5-<rand(Rand),rand(Rand),rand(Rand)>) rotate  
y*90 translate <0,BrickY,PillarWidth-BrickX>}
                            
object{Brick(PillarType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol+<.02*rand(Rand),.01*rand(Rand),0>,BrickColA+<.02*rand(Rand),.01*rand(Rand),0>,BrickColB+<.02*rand(Rand),.01*rand(Rand),0>,BrickColG+<.02*rand(Rand),.01*rand(Rand),0>,rand(Rand))
 
rotate 5*(PillarType>1)*(.5-<rand(Rand),rand(Rand),rand(Rand)>) rotate  
y*90 translate <PillarWidth-BrickSizeZ,BrickY,BrickX>}


                             //#if (BrickX>=PillarWidth-.1950-.0975)

                                  /*#if((BrickX<PillarWidth-.1950)*(PillarDeapth>1))
                                 
object{Brick(PillarType,BrickSizeX,BrickSizeY,BrickSizeZ,BrickCol,BrickColA,BrickColB,BrickColG,rand(Rand))
 
rotate y*90 translate <BrickX+BrickSizeZ+MortarX/2,BrickY,.0975>}
                                  #end */

                                  #local BrickY=BrickY+.07+MortarY; //.01;
                                  #local YCount=YCount+1;

                                  /*#if (BrickY>=PillarHeight-.04)
                                      #local BrickX=PillarWidth+10;
                                  #end */



                                  #if(YCount/2=int(YCount/2))
                                       #local BrickX=BrickSizeX/2;
                                  #else
                                       #local  
BrickX=PillarWidth-(BrickSizeX/2);

                                  #end

                                  //#local BrickX=BrickX-PillarWidth;

                                  /*#if (BrickY>=PillarHeight-.04)
                                      #local BrickX=PillarWidth+20;
                                  #end */
                             //#end
                             //#local BrickX=BrickX+BrickSizeX+MortarX;//.2;
                             //#local XCount=XCount+1;
                       #end


                       } // Union
         #else
             box { -PillarSize*.5, PillarSize*.5 translate (PillarSize/2)
                 pigment{
                         // solid pattern for use in  
texture/pigment/normal(/density)
                           // brick pattern generates a brick pillar like  
structure
                           brick
                           pigment{boxed translate 1 scale MortarPillar/2
                                         pigment_map{
                                                     [0 agate scale  
<.5,3,10> colour_map{[0 rgb .051][1 rgb .01]}]
                                                     [1 agate scale  
<.5,3,10> colour_map{[0 rgb <.3,.29,.25>*.3][1 rgb .05]}]
                                                     }

                                         }
                           ,          // color of mortar
                           pigment{crackle scale .0015 form <1,0,0>  
pigment_map{
                                                 [.1 rgb <.01,.001,0>]
                                                 [1 granite scale 1  rotate  
x*90  translate <rand(Rand),rand(Rand),rand(Rand)> rotate  
360*<rand(Rand),rand(Rand),rand(Rand)> scale 400 //<5,20,5>*10
                                                         pigment_map{[0 rgb  
BrickColA][.5  rgb BrickCol][.99 rgb BrickColB][1 rgb BrickColG]}   //  
<.15,.05,.03>
                                                 ]

                                                 }
         }           // color of brick
                           brick_size <BrickSizeX,BrickSizeY,BrickSizeZ>    
// size of brick    (optional)
                           mortar    MortarY       // width of mortar   
(optional)

                         }
                 normal{brick brick_size  
<BrickSizeX,BrickSizeY,BrickSizeZ>  mortar    MortarY  }
                 }
         #end
#end//#macro  
BrickPillar(PillarType,PillarWidth,PillarHeight,PillarDeapth,StartBrick)




///////////////////////////////////////////////////////////////


//union{BrickWall(0,5,3,1,0,1) rotate y*90  translate <0,0,5 > }

//union{BrickWall(0,30,3,1,0,1) rotate y*180  translate <30,0,-3>  }

#macro BrickBox(BrickType,Corner,OpCorner)
       union{
       #local  
MinCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x<OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y<OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z<OpCorner.z))>;
       #local  
MaxCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x>=OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y>=OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z>=OpCorner.z))>;
       #local BoxSize=MaxCorner-MinCorner;

       #if (!BrickType)
             union{BrickWall(0,BoxSize.x,BoxSize.y,BoxSize.z/.095,0,1)  
translate MinCorner}


       #else
               /// X  ///////////////////
               object{BrickWall(BrickType,BoxSize.x,BoxSize.y,1,0.1)  
translate MinCorner}
               object{BrickWall(BrickType,BoxSize.x,BoxSize.y,1,0,1) rotate  
y*180 translate <MaxCorner.x,MinCorner.y,MaxCorner.z>}

               /// Z  ///////////////////
               object{BrickWall(BrickType,BoxSize.z,BoxSize.y,1,0,1) rotate  
y*90 translate <MinCorner.x,MinCorner.y,MaxCorner.z>}
               object{BrickWall(BrickType,BoxSize.z,BoxSize.y,1,0,1) rotate  
y*-90 translate <MaxCorner.x,MinCorner.y,MinCorner.z>}
       #end
       }
#end



//------------------------------------------------------//
//////////////////////////////////////////////////////////
// Concrete Slab   /////////////////
//////////////////////////////////////////////////////////////////////////

#macro ConcreteSlab(WallType,WallWidth,WallHeight,WallDeapth)



       // #declare Ymem=0;

       #local ConcreteWalltype=WallType;

       #local ConcreteCol1=<.2,.07,.06>;
       #local ConcreteCol=ConcreteCol1;

       #local ConcreteColA1=<.15,.07,.06>*.7;
       #local ConcreteColA=ConcreteCol1;

       #local ConcreteColB1=<.045,.035,.055>;
       #local ConcreteColB=ConcreteColB1;

       #local ConcreteColG1=<.0325,.03,.035>;//<.11,.1,.12>*.5;
       #local ConcreteColG=ConcreteColG1;

       #local ConcreteSizeX=.195;
       #local ConcreteSizeY=.07;
       #local ConcreteSizeZ=.095;
       #local ConcreteSize=<.195,.07,.0975>;

       #local ConcreteX=.0975;
       #local ConcreteY=0;
       #local XCount=0;
       #local YCount=0;



       #local XConcreteCount=-.5+int(WallWidth/ConcreteSize.x);
       #local YConcreteCount=int(WallHeight/ConcreteSize.y) ;

       #local MortarWall=<WallWidth,WallHeight,WallDeapth> ;


                       /////////////////////////////////////////Mortar////////////
                      #if(WallType>0)
                               #if(WallType=1)
                               isosurface {  // mortar
                                           function {f_rounded_box  
(x,y,z,.012,(WallWidth/2),(WallHeight/2),(WallDeapth/2))
                                                    //-f_agate(x*30,y*30,z*30)*.003
                                                    -f_granite(x,y,z)*.003
                                                   
//+f_crackle(x*300,y*300,z*300)*.001

                                                     }        // function  
(can also contain declared functions
                                           //function { fn_X(x, y, z)  
}        // alternative declared function
                                           contained_by { box {  
-MortarWall*<.6,.6,1>, MortarWall*<.6,.6,1> } }  // container shape
                                           accuracy  
0.0001                      // accuracy of calculation [0.001]
                                           translate (MortarWall/2)
                                         //pigment{rgb <.2,.02,.01>}
                                         pigment{spherical scale 1.5  
translate <1,.8,1> warp{turbulence <0,.1,0>}   scale MortarWall *.5
                                                 pigment_map{
                                                             [0 agate   
rotate <0,0,90> scale <.3,1,.3>/(MortarWall) pigment_map{[0 rgb  
<.09,.08,.07>*.3][1 agate scale .1 pigment_map{[0 rgb <.06,.04,.03>*.4][1  
rgb .0001]}]}]   // dark
                                                             [1 agate  
rotate <0,0,90> scale <.3,1,.3>/(MortarWall) colour_map{[0 rgb  
<.7,.5,.3>*.5*.5][1 rgb <0.45,0.4,0.35>*.2]}] // light
                                                             }

                                                 }

                                         }
                                 #end

                                 #if(WallType=2)
                               isosurface {  // mortar
                                           function {f_rounded_box  
(x,y,z,.03,(WallWidth/2),(WallHeight/2),(WallDeapth/2))
                                                    -f_agate(x*30,y*30,z*30)*.01
                                                    //-f_granite(x,y,z)*.003
                                                   
//+f_crackle(x*300,y*300,z*300)*.001

                                                     }        // function  
(can also contain declared functions
                                           //function { fn_X(x, y, z)  
}        // alternative declared function
                                           contained_by { box {  
-MortarWall*<.6,.6,1>, MortarWall*<.6,.6,1> } }  // container shape
                                           accuracy  
0.0001                      // accuracy of calculation [0.001]
                                           translate (MortarWall/2)
                                         //pigment{rgb <.2,.02,.01>}
                                         pigment{spherical scale 1.5  
translate <1,.8,1> scale MortarWall *.5    warp{turbulence <0,.1,0>}
                                                 pigment_map{
                                                             [0 agate  
translate 10*<rand(Rand),rand(Rand),rand(Rand)>  rotate <0,0,90> scale  
.3/(MortarWall) pigment_map{[0 rgb <.06,.04,.03>][1 agate scale .1  
pigment_map{[0 rgb <.06,.04,.03>*.4][1 rgb .0001]}]}]   // dark
                                                             [1 agate  
translate 10*<rand(Rand),rand(Rand),rand(Rand)> rotate <0,0,90> scale  
.3/(MortarWall) colour_map{[0 rgb <.07,.05,.03>][1 rgb <.069,.049,.03>]}]  
// light
                                                             }

                                                 }

                                         }
                                 #end

                       #else

                            box{ (-MortarWall)/2, (MortarWall)/2
                                 translate (MortarWall/2)
                                pigment{spherical scale 1.5 translate  
<1,.8,1> scale MortarWall /2    warp{turbulence <0,.1,0>}
                                         pigment_map{
                                                             [0 agate  
translate <rand(Rand),rand(Rand),rand(Rand)>  rotate <0,0,90> scale  
<.3,1,.3>/(MortarWall) pigment_map{[0 rgb <.09,.08,.07>*.3][1 agate scale  
.1 pigment_map{[0 rgb <.06,.04,.03>*.4][1 rgb .001]}]}]   // dark
                                                             [1 agate  
translate <rand(Rand),rand(Rand),rand(Rand)> rotate <0,0,90> scale  
<.3,1,.3>/(MortarWall) colour_map{[0 rgb <.7,.5,.3>*.5*.5][1 rgb  
<0.45,0.4,0.35>*.2]}] // light
                                                             }

                                         }
                                 }

                       #end


                        //////////////////

#end//#macro ConcreteSlab(WallType,WallWidth,WallHeight,WallDeapth)


// End Concrete Slab   /////////////////
//--------------------------------------//
/////////////////////////////////////////////


//////////////////////BrickDoor///////////////////////////////////////////////

#declare IronTex=texture{
                          pigment{agate scale y*3 pigment_map{[.1  
rgb<.01,.009,.003>*.5][.2 granite scale y/3 pigment_map {[0  
rgb<.05,.01,.001>*.5][1 rgb<.1,.01,.001>*.3]}]}}
                          normal{agate scale y*3 normal_map{[.1 granite 2  
scale y/3 ][.2 agate]}}
                          finish{roughness .1 diffuse .1}
                         }

#declare IronTexGr=texture{
                          pigment{agate scale y*3 pigment_map{[.1  
rgb<.01,.009,.008>*.5][.2 granite scale y/3 pigment_map {[0  
rgb<.05,.01,.001>*.5][1 rgb<.1,.01,.001>*.3]}]}}
                          normal{agate scale y*3 normal_map{[.1 granite 2  
scale y/3 ][.2 agate]}}
                          finish{roughness .1 diffuse .1}
                         }

#macro BrickDoor(BrickType, DoorType)
       union{
       //#local  
MinCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x<OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y<OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z<OpCorner.z))>;
       //#local  
MaxCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x>=OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y>=OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z>=OpCorner.z))>;
       //#local BoxSize=MaxCorner-MinCorner;


       /// X  ///////////////////
       object{BrickWall(BrickType,1,3,-2,0,2) translate x*-.075 }
       //object{BrickWall(BrickType,BoxSize.x,BoxSize.y,1,0,2) rotate y*180  
translate <MaxCorner.x,MinCorner.y,MaxCorner.z>}

       /// Z  ///////////////////
       object{BrickWall(BrickType,1,2,1,0,2) rotate y*-90 translate x*.1 }
       object{BrickWall(BrickType,1,2,1,0,2) rotate y*90 translate  
<.75,0,1>}
         #if(DoorType)
                 object{ConcreteSlab((BrickType>0),1,.2,1) translate  
<0,2,-.425> }
                 object{ConcreteSlab((BrickType>0),1,.4,1) translate  
<0,0,-.15> }
                 box{<0,0,0>,<.85,2,.035> translate <0,.2,.1>  
texture{IronTex}} // Door
         #else

         box{<0,0,0>,<.85,2,.035> translate <0,.2,0> texture{IronTex}} //  
Door
         #end
       }
#end

////////////////////////////////////////////////////////////////////////////

#macro BrickWindow(BrickType, WindowBottom)
       union{
       //#local  
MinCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x<OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y<OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z<OpCorner.z))>;
       //#local  
MaxCorner=<OpCorner.x+((Corner.x-OpCorner.x)*(Corner.x>=OpCorner.x)),OpCorner.y+((Corner.y-OpCorner.y)*(Corner.y>=OpCorner.y)),OpCorner.z+((Corner.z-OpCorner.z)*(Corner.z>=OpCorner.z))>;
       //#local BoxSize=MaxCorner-MinCorner;


       /// X  ///////////////////
       object{BrickWall(BrickType,1,3,-2,0,2)  }
       object{BrickWall(BrickType,1,WindowBottom,1,0,3) }

       /// Z  ///////////////////
       object{BrickWall(BrickType,1,2,-WindowBottom,0,2) rotate y*90  
translate <0,0,.98> }
       object{BrickWall(BrickType,1,2,-WindowBottom,0,2) rotate y*-90  
translate <1,0,-.02>}

         object{ConcreteSlab((BrickType>0),1,.05,.2) rotate x*-15 translate  
<0,WindowBottom,-.02> }
         //object{ConcreteSlab((BrickType>0),1,.1,.2) translate <0,2,-.02> }

       union{
         box{<0,1,.1>,<1,2,.2>
            texture{
                    pigment{spherical warp{turbulence y} translate y  
colour_map{[0 rgb .01][1 rgb .05]}}
                    normal{bozo scale .3}
                    finish{ambient roughness .01 specular .6 brilliance 4  
reflection{0,.1}}
                    }
          }
          box{<0,1,.099>,<1,2,.2>

            texture{
                    pigment{spherical warp{turbulence y} translate y  
pigment_map{[0 crackle scale .5 colour_map{[0 rgb 0][.5 rgbt  
<0,0,0,1>]}][1 rgb .05]}}
                    normal{granite 3 scale .1}
                    finish{roughness .1 brilliance .0 }
                    }
           }
            #if(version>=3.7)
                 no_radiosity
            #else
                 no_reflection
            #end
            }
         union{
                 box{<-.01,0,-.01>,<.01,2,.01> rotate y*45 translate  
<.5,0,.1>}
                 box{<-.01,0,-.01>,<.01,2,.01> rotate y*45 translate  
<.1,0,.1> }
                 box{<-.01,0,-.01>,<.01,2,.01> rotate y*45 translate  
<.9,0,.1> }
                 box{<0,-.01,-.01>,<1,.01,.01> rotate x*45 translate  
<0,(2.13+WindowBottom)/2,.1> }
                 box{<0,-.01,-.01>,<1,.01,.01> rotate x*45 translate  
<0,2,.1> }
                 box{<0,-.01,-.01>,<1,.01,.01> rotate x*45 translate  
<0,WindowBottom+.13,.1>}

                 box{<-.005,0,-.005>,<.005,2,.005> rotate y*45 translate  
<.3,0,.02>}
                 box{<-.005,0,-.005>,<.005,2,.005> rotate y*45 translate  
<.5,0,.02>}
                 box{<-.005,0,-.005>,<.005,2,.005> rotate y*45 translate  
<.7,0,.02>}

                 texture{IronTexGr}
                 }
       }
#end

//////////////////////////////////////////////////////////////////////////////////



//BrickWall(1,5,3,1,0)


//box{<-2,0,-3>,<2,2,3> pigment {rgbt .9}}

//BrickBox(2,<-2,0,-3>,<2,2,3>)


// BrickPillar(PillarType,PillarWidth,PillarHeight)
//box{0,<.38,2,.38> pigment {rgbt .95}}
//BrickPillar(2,.32,2)


Post a reply to this message

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