POV-Ray : Newsgroups : povray.text.scene-files : Castle Bricks Server Time
26 Jun 2024 04:40:06 EDT (-0400)
  Castle Bricks (Message 1 to 2 of 2)  
From: MacJohn
Subject: Castle Bricks
Date: 4 Jul 2003 11:08:39
Message: <3f059877$1@news.povray.org>
Brick for some of my posts in the binaries newsgroup.  It could easily be
put in one single macro and tidied up a bit, but that's for another
day......

John



#local f_rounded_box = function { internal(60) }
#local rndm = seed(1450977);


/////

#declare Dull =
 finish {
  ambient 0.1
  diffuse 0.8
  specular 0.1
  roughness 0.005
  }

/////

#macro aBrick(Seed,xX,yY,zZ,Round,Gray)
#local nX = xX/2;
#local nY = yY/2;
#local nZ = zZ/2;

#local LightStone =
 texture {
     pigment {
        granite
        colour_map {
            [0 rgb 0.5+(rand(rndm)*0.5)]
               [1 rgb 0.25+(rand(rndm)*0.75)]
                }
    scale <10,2,10>
               }
  finish { Dull }
        }

#local W1 = function { pigment {wrinkles scale 0.5 translate
<Seed,-Seed,Seed> } }
        isosurface {
        function { f_rounded_box(x,y,z,Round,nX,nY,nZ) -
W1(x,y,z).gray*Gray }
        threshold 0
        max_gradient 1.5
        accuracy 0.01
        contained_by { box
{<-nX-0.125,-nY-0.125,-nZ-0.125>,<nX+0.125,nY+0.125,nZ+0.125>} }
        translate <nX,nY,nZ>
        texture { LightStone translate <-Seed,Seed,-Seed> }
        }
#end

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

#local stdGray = 0.125;
#local yOffs = 0;
#local xOffs = 0;
#local stdRound = 0.065;
#local BricksHigh = 5;
#local WallWidth = 20;
#local MinWidth = 0.5;
#local MaxWidth = 4;
#local BrickHeight = 1;

union {
#while(yOffs < BricksHigh*BrickHeight)
#local Flag = 1;
#local xOffs = 0;
#while(Flag)
    #local xScale = MinWidth+(rand(rndm)*(MaxWidth-MinWidth));
    object { aBrick(rand(rndm)*999999,xScale,BrickHeight,1,stdRound,stdGray)
translate <xOffs,yOffs,0>}
 #local xOffs = xOffs + xScale;
     #if(xOffs + xScale > WallWidth-MinWidth)
      object {
aBrick(rand(rndm)*999999,WallWidth-xOffs,BrickHeight,1,stdRound,stdGray)
translate <xOffs,yOffs,0> }
         #local Flag = 0;
     #end
    #end
    #local yOffs = yOffs + BrickHeight;
#end
    }

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

light_source { <-50, 25, -55>  rgb 1 }

camera {
  location  <10, 3, -40>
  angle 40
  right     x*image_width/image_height
  look_at   <10,2,0>
 }

background { rgb 0 }


Post a reply to this message

From: Peter Warren
Subject: Re: Castle Bricks
Date: 17 Jul 2003 05:25:01
Message: <web.3f166a5e361b074ef547d63e0@news.povray.org>
John

I absolutely love this code. Well, the results, at least. Just beautiful.
I was wondering if you could put it in a more flexible form, for those of
us who are macro-challenged.

Thanks for the nice work, and hoping for another day...

Peter

MacJohn wrote:
>Brick for some of my posts in the binaries newsgroup.  It could easily be
>put in one single macro and tidied up a bit, but that's for another
>day......
>
>John


Post a reply to this message

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