//################################################## //## ## //## ## //## Gothic Arch Window Macros ## //##----------------------------------------------## //## by Kirk Andrews ## //## ## //## ## //################################################## //Creates stones of various sizes (and color) to surround a window opening // =================================================================================================== #default { texture { pigment {color red 1} finish{ambient 0.2} } } #declare rd = seed(2); //#declare Bottomless = 1; // =================================================================================================== //G_Window: Creates the basic shape for use in as CSG difference with a wall. // Radius: (1/2 the total width of window) // Height: (From bottom to center of circular section) // Depth: z direction #macro G_Window (Radius,Height,Depth) union { cylinder {-Depth*z,Depth*z,Radius} box {<0,0,-Depth>, rotate 45*z} box {<-Radius,-Height,-Depth>,} } #end //G_Window (.5,3,1) // =================================================================================================== //Spiral3: Creates a spiral, used as verticals in the window frames. // BigRad: Large Radius (of the tori) // SmRad: Small Radius (of the tori) // Height: Total height in units #macro Spiral3 (BigRad,SmRad,Height) #macro Half_Torus(BR,SR) //slice torus in half difference { torus { BR, SR } plane { -z,0} } #end #local Num = Height/(2*SmRad); //calculate number of tori to avoid holes #local i = 0; union { #while (i < Num) union { object{Half_Torus (BigRad,SmRad) rotate degrees(asin(SmRad/(BigRad*2)))*z } //rotated to connect with next torus above object{Half_Torus (BigRad,SmRad) rotate degrees(asin(SmRad/(BigRad*2)))*z rotate 180*y translate SmRad*y} translate i*SmRad*2*y } #local i = i+1; #end } #end //Spiral3 (.2,.2,2) //############################################################################################################## //############################################################################################################## #declare Norm = 0; #declare SizeVariance = .5; #macro Sizer(Var,Norm) //returns a random size for the current block based on the variance provided (1-(Var/2))+(rand(rd)*Var); #end #macro Window_Blocks (Radius,Height,BlockSize,BlockDepth,BaseColor,SizeVariance, Bottomless) #declare Norm = 0; #declare BlockShift = BlockSize/10; #declare ColorVariance = .5; //**Sets the amount that the color of blocks may vary. Change if desired.** #macro Block_Line (Length,BaseColor) //Produces a straight line of randomly sized blocks #declare Pos = Length; #while (Pos > 0) #if (Pos > BlockSize*1.2) #declare ThisBlockSize = BlockSize*Sizer(SizeVariance,Norm); //random block size #else #declare ThisBlockSize = Pos; //remainder of specified length #end superellipsoid { <0.3,0.4> translate 1 //move one corner to origen scale .5 //block extends from <0,0,0> to <1,1,1> scale ThisBlockSize*1.1*x //Expands to pre-calculated block size scale BlockSize*((rand(rd)*SizeVariance*2)+.75)*y //The y dimension can be totally random, as it does not affect other blocks scale BlockDepth*z //Depth of window translate (Length-Pos)*x //Move to next spot pigment {rgb BaseColor * ((1-ColorVariance) + rand(rd)*ColorVariance)} //random variation of color based on base color provided normal {granite} } #declare Pos = Pos - ThisBlockSize; //Calculation for placement of next block #end #end //Macro Block_Line #macro Block_Curve (Degrees, Radius, BaseColor) //Creates a curve of blocks #declare Length = ((Degrees/360)*2*pi*Radius); #declare Pos = Degrees; #while (Pos > 0) #if (Pos > ((360*BlockSize*1.2)/(2*pi*Radius))) #declare ThisBlockSize = BlockSize*Sizer(SizeVariance,Norm); #else #declare ThisBlockSize = (Pos/360)*2*pi*Radius; #end superellipsoid { <0.3,0.4> translate 1 scale .5 scale ThisBlockSize*1.1*x scale BlockSize*((rand(rd)*SizeVariance*2)+.75)*y scale BlockDepth*z rotate 90*z rotate -((Pos/(Length/BlockSize))/2)*z translate -(Radius*(1-BlockShift))*x rotate -(Degrees-Pos)*z pigment {rgb BaseColor * ((1-ColorVariance) + rand(rd)*ColorVariance)} normal {granite} } #declare Pos = Pos - ((360*ThisBlockSize)/(2*pi*Radius)); #end #end //Macro Block_Curve union { union{ Block_Line (Height,BaseColor) rotate 90*z translate -Height*y translate -BlockShift*z translate -(Radius*(1-BlockShift))*x } union{ Block_Line (Height,BaseColor) rotate 90*z translate -Height*y translate -BlockShift*z translate -(Radius*(1-BlockShift))*x scale -1*x} union{ Block_Curve (45,Radius,BaseColor) translate -BlockShift*z} union{ Block_Curve (45,Radius,BaseColor) translate -BlockShift*z scale -1*x} union{ Block_Line (Radius*.9,BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z } union{ Block_Line (Radius*.9,BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z scale -1*x} #if (Bottomless = 0) //removes line of blocks at the bottom of the window union{ Block_Line (Radius*2.5,BaseColor) translate -BlockShift*z translate -Radius*1.25*x scale -1*y translate -(Height-.1)*y } #end superellipsoid { //The Keystone <0.3,0.3> translate 1 scale .5 translate -BlockShift*z scale rotate 45*z translate ((Radius*sqrt(2))*.9)*y pigment {rgb BaseColor * ((1-ColorVariance) + rand(rd)*ColorVariance)} normal {granite} } } #end //Window_Blocks //############################################################################################################## //############################################################################################################## //#declare Radius = 4; //#declare Height = 20; //#declare BlockSize = .30001; //#declare BlockDepth = .5; //#declare Distance = 2.5; //#declare UpDist = sqrt(2); //#declare Distance2 = Distance/2; // // // difference { // box {-50,50 scale .01*z translate .5*z} // object {G_Window (Radius,Height,100)} // //object {G_Window (Radius,Height,100) translate -12*x} // object {G_Window (2,Height,100) translate 10*x} // pigment {rgb <.7,.6,.5>} // normal {bumps .01} // translate 4*y // // } //########################### Big Window ################################################################################### #macro BigWindow(Radius, Height, BlockSize,BlockDepth,BaseColor) //Three Spiral Verticles union { union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}}} union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}} scale -z translate 1*z} union{ union{ Block_Curve (45,Radius,<.7,.6,.5>) translate -BlockShift*z translate Radius*x} union{ Block_Line (Radius-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*x} } union{ union{ Block_Curve (45,Radius,<.7,.6,.5>) translate -BlockShift*z translate Radius*x} union{ Block_Line (Radius-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*x } scale -x } union{ union{ Block_Curve (45,Radius,BaseColor) translate -BlockShift*z translate Radius*.5*x} union{ Block_Line ((Radius*(5.5/4))-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*.5*x} } union{ union{ Block_Curve (45,Radius,BaseColor) translate -BlockShift*z translate Radius*.5*x} union{ Block_Line ((Radius*(5.5/4))-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*.5*x} scale -x } union{Block_Curve (40,Radius,<.7,.6,.5>) translate -BlockShift*z translate Radius*1.5*x} union{Block_Curve (40,Radius,<.7,.6,.5>) translate -BlockShift*z translate Radius*1.5*x scale -x} union{ Spiral3(BlockSize/3, BlockSize/3, Height+.2) translate -(Height-.1)*y translate .2*z pigment {rgb BaseColor}normal{granite}} union{ Spiral3(BlockSize/3, BlockSize/3, Height+.2) translate -(Height-.1)*y translate .2*z pigment {rgb BaseColor}normal{granite} translate -Radius*.5*x} union{ Spiral3(BlockSize/3, BlockSize/3, Height+.2) translate -(Height-.1)*y translate .2*z pigment {rgb BaseColor}normal{granite} translate Radius*.5*x} } #end //########################### Small Window ################################################################################### #macro SmallWindow(Radius, Height, BlockSize,BlockDepth,BaseColor) //One Spiral Verticle union { union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}}} union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}} scale -z translate 1*z} union{ union{Block_Curve (45,Radius,BaseColor) translate -BlockShift*z translate Radius*x} union{ Block_Line (Radius-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*x} } union{ union{Block_Curve (45,Radius,BaseColor) translate -BlockShift*z translate Radius*x} union{ Block_Line (Radius-((Radius/2)*sqrt(2)),BaseColor) translate -BlockShift*z rotate 90*z translate -(Radius*(1-BlockShift))*x rotate -45*z translate Radius*x } scale -x } union{Spiral3(BlockSize/3, BlockSize/3, Height+.2) translate -(Height-.1)*y translate .2*z pigment {rgb BaseColor}normal{granite}} } #end //########################### Smaller Window ################################################################################### #macro SmallerWindow(Radius, Height, BlockSize,BlockDepth,BaseColor) //Just the frame union { union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}}} union{ Window_Blocks (Radius,Height,BlockSize,BlockDepth, BaseColor,.5,0) texture {normal{granite}} scale -z translate 1*z} } #end //############################################################################################################## //[Radius, Height, BlockSize, BlockDepth, BaseColor] //**Note: BaseColor provided will be the LIGHTEST color. The blocks will be various degrees darker than the BaseColor.** //object{ SmallerWindow(2,10,.3, .5, <.7,.6,.5>) } //object{ SmallWindow(2,20,.3, .5, <.7,.6,.5>) } //object{ BigWindow(4,20,.3, .5, <.7,.6,.5>) } // // //camera { // location <0.0, 6.0, -8.0> // look_at <0.0, 0, 0.0> // right x*image_width/image_height //} // //light_source { // 0*x // light's position (translated below) // color rgb <1,1,1> // light's color // translate <-20, 40, -20> //}