/**********************************************************************************/ // Persistence of Vision Ray Tracer Scene Description File // File name : new_wallstucco.mcr // Version : 3.6 // Description : Brick wall & Stucco macros (texture version) // Date : 14-03-2000 (author) // Updated : 26-07-2001 (author) // December 2003 (TdG) // November 2006 (TdG) // February 2007 (TdG) // Author : Ingo Janssen // Macro : Thomas A. M. de Groot // Copyright (C) 2003-2007. All rights reserved. /**********************************************************************************/ // Standard pre-defined include files // #include "colors.inc" #include "textures.inc" #include "rand.inc" //====== Declarations ========== #ifndef (Standalone) #declare Standalone = true; #end //for testing standalone macro. Otherwise change to false in main scene //====== Building the Stucco ====== #macro Stucco(L2,HFres,Tmort,Smort,Tstuc,Sstuc,Stucgrain,HFscale) #ifndef (R) #local R = seed(3221); #end #ifndef (L2) #local L2 = 0.55; #end //Set amount of decay of stucco, higher value is more decay. #ifndef (HFres) #local HFres = 500; #end #ifndef (Tmort) #local Tmort = texture {pigment {White_Marble}} #end #ifndef (Smort) #local Smort = 0.1; #end #ifndef (Tstuc) #local Tstuc = texture {pigment {Brown_Agate}} #end #ifndef (Sstuc) #local Sstuc = 0.5; #end #ifndef (Stucgrain) #local Stucgrain = 0.05; #end #ifndef (HFscale) #local HFscale = <30,30,1>; #end //Mortar: #local PWrink= pigment { wrinkles scale 0.25 colour_map { [0, rgb 0.5] [L2, rgb 0.96] } } //Stucco: #local Pstucco= pigment { //granite is original, but better: crackle solid scale Stucgrain colour_map { [0, rgb 0.96] [1, rgb 1] } } //Stucco & Mortar: #local StuMor= pigment { pigment_pattern{ wrinkles scale 0.25 } pigment_map { [L2, PWrink] [L2, Pstucco] } } // Build the stucco heightfield: #local Trans = RRand(-5,5,R); #declare HF_stucco = height_field { function HFres, HFres {pigment {StuMor translate Trans*x} } translate -0.5 rotate -90*x texture { pigment_pattern { wrinkles scale 0.25 } texture_map { [L2, Tmort scale Smort] [L2, Tstuc scale Sstuc] } warp {planar z, 0} translate <-0.5, -0.5, 0> rotate <180,0,0> translate Trans*x } scale HFscale } #end //of macro //====== Buiding the brick wall ====== //Size : dimension of the brick (vector x, y, z) //Mortar : width of the joint. //HFscale : scale of the final height_field (vector) //HFres : resolution of the height_field function //Turbulence etc : control the stone deformation. #macro BrickWall(Size, Mortar, HFscale, HFres, Turbulence, Octaves, Lambda, Omega) //(1) Building the bricks: #local Brick= pigment { boxed // one single brick ... scale translate warp {repeat x*(Size.x+Mortar)} // ... repeated over and over again. warp {repeat y*(2*(Size.y+Mortar))} } #local FBrickWall= function { pigment { pigment_pattern { gradient y warp {repeat y} scale <1, 2*(Size.y+Mortar), 1> } pigment_map { [0.5, Brick warp { // deforming the bricks ... turbulence Turbulence octaves Octaves lambda Lambda omega Omega } translate <0, -(Mortar/2), 0> ] [0.5, Brick // ... row by row. warp { turbulence Turbulence octaves Octaves lambda Lambda omega Omega } translate <(Size.x/2)+Mortar, Size.y+(Mortar/2), 0> ] } } } //(2) Building the Wall pigment: #local Wall = pigment { function {FBrickWall(x,y,z).red} pigment_map { // give some stucture to the joint ... [0.00, granite scale 0.1 colour_map { [0, rgb 0][1, rgb 0.3] } ] [0.05, crackle // ... and the bricks. scale <1, 1, 1>*0.8 turbulence 0.5 colour_map { [0, rgb 0.34][1, rgb 0.5] } ] } scale 0.04 } //(3) Building the height_field wall: #declare HF_brickwall = height_field { function HFres, HFres {pigment {Wall} } smooth translate -0.5 rotate <-90,0,0> pigment {Wall pigment_map { [0.00, rgb 0.6] [0.05, wrinkles turbulence 0.3 scale <2,0.3,1> colour_map { [0.0, rgb <0.5,0.3,0.25>] [0.15, rgb <0.5,0.3,0.25>/1.3] [0.3, rgb <0.5,0.3,0.25>] [0.6, rgb <0.6,0.3,0.25>/1.6] [0.8, rgb <0.5,0.3,0.25>] [1.0, rgb <0.5,0.3,0.35>/2] } ] } translate <-0.5, -0.5, 0> rotate -90*x warp {planar y, 0} } scale HFscale } #end //of macro /************************************************************************************************************** T E S T I N G ***************************************************************************************************************/ #if (Standalone) global_settings { assumed_gamma 1.0 noise_generator 2 } light_source { < 500, 500,-500> rgb 1 } camera { location <0.0, 15.0, -15.0> right x*image_width/image_height look_at <0.0, 15.0, 0.0> } default { texture { pigment { rgb <1,0,0> } } } //----------------------------------------------------------------------------------------------------- // Used pigments: // White marble with black veins. #declare Alt_White_Marble = pigment { marble turbulence 1 color_map { [0.0 rgb <0.9, 0.9, 0.9>] [0.5 rgb <0.5, 0.5, 0.5>] [1.0 rgb <0.9, 0.9, 0.9>] } } // Brown and white agate -- very pretty. #declare Alt_Brown_Agate = pigment { agate color_map { [0.0 rgb <0.7, 0.4, 0.2>] [0.5 rgb <0.9, 0.7, 0.6>] [0.6 rgb <0.9, 0.7, 0.4>] [1.0 rgb <0.7, 0.4, 0.2>] } } //----------------------------------------------------------------------------------------------------- BrickWall(<1,0.3,0.3>, //Size: dimension of the brick (vector x,y,z). 0.02, //Mortar: width of the joint. <30,30,1>, //HFscale: scale of the final height_field (vector). 500, //HFres: resolution of the height_field function. <0.05,0.1,0>, //Turbulence etc : controls of the stone deformation. 6, //Octave 0.5, //Lambda 0.5) //Omega #declare R = seed(3221); #declare Tmortar = texture {pigment {Alt_White_Marble}} #declare Smortar = 0.5; #declare Tstucco = texture {pigment {Alt_Brown_Agate}} #declare Sstucco = 0.8; Stucco(0.55, //L2: amount of decay of the stucco, higher value = more decay. Randomize this. 500, //HFres: resolution of the HF function. Tmortar, //Pmort: pigment of the mortar Smortar, //Smort: scale of the mortar pigment Tstucco, //Pstuc: pigment of the stucco Sstucco, //Sstuc: scale of the stucco pigment 0.01, //Stucgrain: graininess of the stucco surface. <30,30,1>) //HFscale: scale of the height_field. #declare StuccoedWall = union { object {HF_brickwall translate <0, 15, 0>} object {HF_stucco translate <0, 15, 0.52>} //z determines the "depth" of the mortar+stucco on the brick wall } object {StuccoedWall} #end //of Standalone