POV-Ray : Newsgroups : povray.binaries.images : Meditating on Rocks : Re: Meditating on Rocks Server Time
1 Aug 2024 08:14:38 EDT (-0400)
  Re: Meditating on Rocks  
From: Robert McGregor
Date: 5 Oct 2008 10:45:01
Message: <web.48e8d1db1835ca62bd1b3ad10@news.povray.org>
> A fossilized oyster shell hash, or a coral, or some hydrothermal stuff! This
> is very, very good, Robert. I would be interested to see the formula you
> used to achieve that.
>
> Thomas

Well Thomas, it's mostly textured trickery. Here's the basic code, using image
maps and procedural stone averaged on the isosurfaces (note the boring
no-texture version):

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// pitted stone texture

#declare T_PittedStone = texture {
   average
   texture_map {
      [3
         pigment {
            average
            turbulence 0.15
            scale 0.5
            pigment_map {
               [3 image_map {png "PittedStoneTile2.png" map_type 0 interpolate
2} turbulence 0.15 scale 1.25]
               [1 image_map {png "rock02_tile.png" map_type 0 interpolate 2}
turbulence 0.15  scale 1.66]
               [1 image_map {png "PlantsTile060.png" map_type 0 interpolate 2}
turbulence 0.15  scale 1.37]
            }
         }
         normal {
            average
            turbulence 0.15
            scale 0.5
            normal_map {
               [3 bump_map {png "PittedStoneTile2.png" map_type 0 interpolate 2}
turbulence 0.15 scale 1.25]
               [1 bump_map {png "rock02_tile_bump.png" map_type 0 interpolate 2}
turbulence 0.15 scale 1.66]
            }
         }
      ]
      [1 T_Stone10 finish {phong 0 specular 0}]
   }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// A basic rock pigment function for deforming isosurfaces

#declare fn_Rock = function {
   pigment {
      granite
      turbulence 0.01
      scale 3
      color_map {
         [0 color rgb 0]
         [1 color rgb 1]
      }
   }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Macro: Rock()

#macro Rock(MaxGradient)
   isosurface {
      #local amt = RRand(0.33, 0.9, R_Rock);
      function { f_sphere(x, y, z, 1)-fn_Rock(x/2, y/2, z/2).hf*amt }
      contained_by { sphere { 0, 2 } }
      accuracy 0.001
      max_gradient MaxGradient
      scale 0.5
      rotate 360*RRand(0, 1, R_Rock)
   }
#end

// create a rock
union {
   object { Rock(3.1)
      rotate <RRand(0, 360, R_Rock), RRand(0, 360, R_Rock), RRand(0, 360,
R_Rock)>
      scale <RRand(4, 7, R_Rock), RRand(2, 3, R_Rock), RRand(4, 7, R_Rock)>
      translate <-8, 1, -1>
   }
   object { Rock(4.4)
      rotate <RRand(0, 360, R_Rock), RRand(0, 360, R_Rock), RRand(0, 360,
R_Rock)>
      scale <RRand(4, 7, R_Rock), RRand(2, 3, R_Rock), RRand(4, 7, R_Rock)>
      translate <-8, 1, -1>
   }
   texture { T_PittedStone
      // very rough planar alignment to camera elevation
      // (eliminates most distortion of planar image map on "round" rocks)
      rotate x*15
   }
}


Post a reply to this message


Attachments:
Download 'zenrocksnotex.jpg' (34 KB)

Preview of image 'zenrocksnotex.jpg'
zenrocksnotex.jpg


 

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