/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : Sandstone_mcr2.pov Version : 3.6.1c / MegaPOV 1.21 Description : A macro for a realistic sandstone texture, combining those by PM 2Ring. Date : May 2006 Author : PM 2Ring (Thomas A.M. de Groot for the macro shell and additional textures) E-mail : see p.b.i. Copyright (C) 2006. All rights reserved. Use and/or modification of this scene is free, except for commercial purposes. Commercial distribution is not allowed without written permission from the author. **********************************************************************************/ #include "rand.inc" #include "functions.inc" #include "transforms.inc" #macro Sandstone2() //Default parameter values: #ifndef(RandNr) #local RandNr = 2; #end #ifndef(Transmit) #local Transmit = 0.8; #end //transparency of the staining texture #ifndef(Norm) #local Norm = false; #end //normal use #ifndef(Ndepth) #local Ndepth = 0.5; #end //normal bump depth #ifndef(Pattern) #local Pattern = 2; #end //(1-5) patterns for the staining texture #ifndef(Turb) #local Turb = 0.2; #end //turbulence for the staining texture #ifndef(Tscale) #local Tscale = 0.8; #end //transform for the staining texture #ifndef(Trot) #local Trot = <1, 7.5, 2.5>; #end //idem #ifndef(Ttrans) #local Ttrans = <1, 2, 1>; #end //idem #ifndef(Base) #local Base = 1; #end //(1-3) choice of the base texture #ifndef(Btuner) #local Btuner = 1; #end //lightens or darkens the base texture colour #ifndef(BScale) #local BScale = 1; #end //transform for the base texture #ifndef(BRot) #local BRot = <0,0,0>; #end //idem #ifndef(BTrans) #local BTrans = <0,0,0>; #end //idem #local Seed = seed(RandNr); //---The textures---------------------------------------------- // Base texture 1: #local Sandy = color rgb<1, .9, RRand(0.5,0.7,Seed)>; // Base texture 2: #local OldRedLayered = colour_map { [0.0 rgb <0.6, 0.1, 0.1>*(Btuner*0.9)] [0.2 rgb <0.4, 0.05, 0.0>*Btuner] [0.8 rgb <0.75, 0.25, 0.1>*(Btuner*0.9)] [1.0 rgb <0.6, 0.1, 0.1>*Btuner] } // Base texture 3: #local LightBandedSandstone = colour_map { [0.0 rgb <1.0, 0.8854, 0.604167>] [0.6 rgb <0.98, 0.781, 0.438>*Btuner] [0.7 rgb <0.906, 0.656, 0.336>*Btuner] [0.8 rgb <0.824, 0.531, 0.234>*Btuner] [1.0 rgb <0.824, 0.531, 0.234>*Btuner] } // Colour_map for the staining texture: #local CM_Sandstone = colour_map{ #if (Base = 1) [0.3 rgbt <1, 1, 1, 1.2*Transmit>] [0.41 rgbt <0.5, 0.3, 0.1, 0.5*Transmit>] [0.4 rgbt <1, 0, 0, Transmit>] [0.42 rgbt <1, 0, 0, 0.75*Transmit>] [0.6 rgbt <1, 0.5, 0, Transmit>] [0.7 rgbt <1, 1, 1, 0.5*Transmit>] #else [0.3 rgbt <1, 1, 1, 1>] [0.41 rgbt <0.5, 0.3, 0.1, Transmit>] [0.4 rgbt <0.6, 0.3, 0, Transmit>] [0.42 rgbt <0.6, 0.3, 0, 0.9*Transmit>] [0.6 rgbt <0.5, 0.3, 0, Transmit>] [0.7 rgbt <1, 1, 1, 1>] #end } // A normal: #local NSand = #if (Base = 1) normal{granite 0.125 scale 1.5E-3} #else normal {granite 0.125 scale <5, 0.5, 5>} #end // A finish: #local FSandstone = finish { ambient 0.05 diffuse RRand(0.75, 0.85, Seed) specular 0.1 roughness 1e-3 //brilliance .5 } // The base texture: #local TSandstone_base = texture{ #switch (Base) #case (1) pigment {Sandy} #break #case (2) pigment { granite colour_map {OldRedLayered} scale <5, 0.1, 5> } #break #case (3) pigment { granite colour_map {LightBandedSandstone} scale <5, 0.1, 5> } #end #if (Norm) normal{NSand Ndepth} #end finish{FSandstone} #if (Base >1) scale BScale Axis_Rotate_Trans(x, BRot.x) Axis_Rotate_Trans(z, BRot.z) Axis_Rotate_Trans(y, BRot.y) translate BTrans #end } //------------------------------------------------------------- // The stain texture: #local TStain = texture{ pigment{ #switch (Pattern) #case (1) agate //maybe try something derived from f_Height #break #case (2) wrinkles //good! #break #case (3) wood #break #case (4) marble #break #case (5) gradient <.3, 2, .1> #end turbulence RRand(Turb-0.1,Turb+0.1,Seed) colour_map{CM_Sandstone} //scallop_wave scale Tscale rotate Trot translate Ttrans } #if (Norm) #if (Base = 1) normal {NSand 0.5} #else normal {NSand 0.1} #end #end finish{FSandstone} #if (Base >1) scale BScale Axis_Rotate_Trans(x, BRot.x) Axis_Rotate_Trans(z, BRot.z) Axis_Rotate_Trans(y, BRot.y) translate BTrans #end } //------------------------------------------------------------- //Final (layered) texture: #declare TSandstone = texture{TSandstone_base} texture{TStain} #end //of macro //============================================================= //---The objects----------------------------------------------- #declare f_Height = function{0.5*f_wrinkles(x*.4, y*.4, z*.4)} #declare H = 0.6; #declare Ground = isosurface { function {(y - f_Height(x, 0, z))/H} max_gradient 2.0 contained_by {box {<-5,-2,-3>, < 4, 1, 10>}} accuracy 1e-3 } #declare H = 0.6; #declare Sphere = isosurface { function {(pow(x,2) + pow(y,2) + pow(z,2) - pow(0.8,2)) + f_Height(x, y, z)/H} max_gradient 2.0 contained_by {box {<-1,-1,-1>, < 1, 1, 1>}} accuracy 1e-3 } //------------------------------------------------------------- //Block dimensions etc #declare W = 1.5; #declare D = 1.5; #declare H = 0.75*1.25; #declare ROUGH = 0.30*.75; //Bump height //0.45, 0.22 #declare BUSY = 0.40; //Bump period #declare f_Sandstone = function{f_wrinkles(x*BUSY, y*BUSY, z*BUSY)} #declare TScale = 3.75; //Texture scale adjustment //Stone Block #macro IsoBlock(cx,cy,cz) //run the Sandstone macro: Sandstone2() isosurface{ function { max( abs(x-cx)-(W-ROUGH*f_Sandstone(x, y, z)), abs(y-cy)-(H-ROUGH*f_Sandstone(x, y, z)), abs(z-cz)-(D-ROUGH*f_Sandstone(x, y, z)) ) } contained_by{box{, }} max_gradient 1.2 // 1.1 // 1.25 // 1 1.4 accuracy 1e-3 texture{TSandstone translate *TScale} translate y*(H-0.5*ROUGH) } #end //============================================================= #version 3.6; global_settings { assumed_gamma 1.0 } //------------------------------------------------------------- camera { location <0.0, 0.5, -4.0> direction 1.5*z right x*image_width/image_height look_at <0.0, 0.0, 0.0> } sky_sphere { pigment { gradient y color_map { [0.0 rgb <0.6,0.7,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> } light_source { <0, 0, 0> // light's position (translated below) color rgb <1, 1, 1>*0.1 // light's color translate <30, 30, -30> shadowless } //------------------------------------------------------------- plane { y, -1 pigment { color rgb <0.7,0.5,0.3> } } //Macro parameters (defaults are inside the macro): #declare RandNr = 2; #declare Transmit = 0.8; #declare Norm = false; #declare Ndepth = 0.5; #declare Pattern = 2; #declare Turb = 0.2; #declare Tscale = 0.8; #declare Trot = <1, 7.5, 2.5>; #declare Ttrans = <1, 2, 1>; #declare Base = 3; #declare Tscale = 0.5; #declare Btuner = 0.6; Sandstone2() object {Sphere texture{TSandstone} translate <-0.8, 0.3, 1> } #declare Base = 2; #declare Btuner = 1.5; Sandstone2() object {Sphere texture{TSandstone} rotate 90*y translate <0.8, -0.5, 0> } #declare RandNr = 439; #declare Transmit = 0.9; #declare Pattern = 1; #declare Tscale = 5; #declare Base = 1; Sandstone2() object {Ground texture{TSandstone translate 15} translate -1*y } #declare M = 0.975; //1.0075; //Mortar space adjustment #declare U = W*M; #declare V = D*M; #declare HH = H*2; #declare HH = (HH-ROUGH); //Number of levels in pyramid: #declare LEVELS = 6; #declare Random = 323; #declare Seed2 = seed(Random); //Stack blocks into a hollow pyramid. #declare Pyramid = union{ #declare mk=2; #declare k=LEVELS-1; #while(k>=mk) #declare j=-k; #while(j<=k) #declare i=-k; #while(i<=k) #if(abs(i)=k | abs(j)=k | k=mk) //parameters for Sandstone() inside the IsoBlock macro: #declare Base =2; #declare Tscale = 3; #declare Pattern = 2; #declare Norm = true; #declare Ndepth = 0.01; #declare Transmit = RRand(0.5,0.99,Seed2); #declare Btuner = 1.8; #declare BRot = <0, RRand(-180,180,Seed2), 10>; IsoBlock(i*U, (LEVELS-k-1)*HH, j*V) #end #declare i=i+2; #end #declare j=j+2; #end #declare k=k-1; #end } object{Pyramid rotate 3*y translate <0, -1, 20>} //-------------------------------------------------------------