POV-Ray : Newsgroups : povray.binaries.images : Sandstone blocks : Re: Sandstone blocks Server Time
7 Aug 2024 09:23:42 EDT (-0400)
  Re: Sandstone blocks  
From: PM 2Ring
Date: 27 Apr 2006 13:50:01
Message: <web.445103b51843be3376ba2c900@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: Sandstone.pov
// Vers: 3.6
// Desc: Pyramid of sandstone blocks
// Date: 2006.02.06
// Auth: PM 2Ring
//
//  -d +A0.2 +AM2 +R2
//

#include "functions.inc"

global_settings {
  assumed_gamma 1.0
}

//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 M=0.975; //1.0075;       //Mortar space adjustment
//#declare M=1.05;       //Mortar space adjustment

//Number of levels in pyramid. Also controls floorsize & light & camera
distance, along with H.
#declare LEVELS=12;

//---The functions--------------------------------------------------------

#declare f_Sandstone = function{f_wrinkles(x*BUSY, y*BUSY, z*BUSY)}

#declare f_Ground =
function{
   0.125*f_noise3d(x*1.5, y*1.5, z*1.5)
 + 0.005*f_noise3d(x*70,  y*60,  z*70)
}

//---The textures---------------------------------------------------------
#declare SkyBlue = rgb<.035, .27, .67>+.125;
#declare Sandy = rgb<1, .9, .675>;

#declare FSand1 =
finish{
  diffuse 0.75 ambient 0.125
  specular 1 roughness 1e-3
}

#declare FSandstone =
finish{
  diffuse 0.75 ambient 0.05
}

#declare NSand1 = normal{granite 0.125 scale 1.5E-3}

#declare TSand1 =
texture{
  pigment {Sandy }
  finish{FSand1}
  //normal{NSand1 .15}
}

#declare Transmit = .8;
#declare CM_Sandstone =
colour_map{
  [0.3 rgbt <1, 1, 1, 1.2*Transmit>]
  [0.4 rgbt <1, 0, 0, Transmit>]
  [0.41 rgbt <0.5, 0.2, 0.1, .5*Transmit>]
  [0.42 rgbt <1, 0, 0, .75*Transmit>]
  [0.6 rgbt <1, 0.5, 0, Transmit>]
  [0.7 rgbt <1, 1, 1, .5*Transmit>]
}

#declare TSandstone =
texture{
  pigment {Sandy}
  finish{FSandstone}
}

#declare TStain = texture{
  pigment{
    wrinkles
    turbulence 0.1875
    colour_map{CM_Sandstone}
    //scallop_wave

    translate 0.95*1.1
    rotate <10, 75, 25>
    scale 1.5*W*7
  }
  finish{FSandstone}
}

#declare TSandstone2 =
texture{TSandstone}
texture{TStain}

//---The objects---------------------------------------------------------

#declare TScale = 3.75;    //Texture scale adjustment
//#declare TScale = 2.345;    //Texture scale adjustment

//Plain block
#macro Block(cx,cy,cz)
box{
  -1,1
  scale <W, H, D>
  translate <cx, cy, cz>

  texture{
    TSandstone2
    normal{granite .25 scale 3e-2}
    translate <cx,cy,cz>*TScale
  }
  translate y*(H-0*.5*ROUGH)
}
#end

//Stone Block
#macro IsoBlock(cx,cy,cz)
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{<cx-W, cy-H, cz-D>, <cx+W, cy+H, cz+D>}}
  max_gradient 1.2 // 1.1 // 1.25 // 1 1.4
  accuracy 1e-3

  texture{TSandstone2 translate <cx,cy,cz>*TScale}
  translate y*(H-0.5*ROUGH)
}
#end

#declare U=W*M;
#declare V=D*M;
#declare HH=H*2;
#declare HH=(HH-ROUGH);

//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)
          //Block(i*U, (LEVELS-k-1)*HH, j*V)
          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
}

#declare BB=6 * LEVELS;

#declare Ground =
isosurface{
  function{y - f_Ground(x/6, y/6, z/6)}

  max_gradient 1.1
  contained_by { box{ <-BB,-1,-BB>, <BB,1,BB>} }
  accuracy 5e-3

  texture{TSand1 scale 4}
}

//---The scene---------------------------------------------------------

#if(1)
  sky_sphere{
    pigment{
      function{y}
      color_map{
        [0.0 SkyBlue]
        [0.19 rgb <0.0,0.1,0.8>*.60]
      }
      translate -y * .275
      scale 0.85
    }
  }
#else
  background{SkyBlue}
#end

object{Ground}
object{Pyramid rotate -25*y}

//#declare CamPos = <0, 4.875, -7.75> * 1.25 * LEVELS*H;

#declare CamPos = <0, 1.875*H, -1.875*W> * 1.2 * LEVELS;
camera {
  location CamPos
  direction z
  right     x*image_width/image_height up y
  look_at   1.0*LEVELS*H*y
  angle 30
}

light_source {
  <-0.5, 1, -1> * 8 * LEVELS*H
  rgb 1.25
  //area_light .2*x,.2*z, 3,3 jitter adaptive 1 orient circular
}

//---The end---------------------------------------------------------


Post a reply to this message


Attachments:
Download 'sandstoneeg1s.jpg' (115 KB)

Preview of image 'sandstoneeg1s.jpg'
sandstoneeg1s.jpg


 

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