POV-Ray : Newsgroups : povray.text.scene-files : Cliff study Server Time
17 May 2024 04:03:17 EDT (-0400)
  Cliff study (Message 1 to 1 of 1)  
From: Thomas de Groot
Subject: Cliff study
Date: 28 Dec 2005 03:35:06
Message: <43b24e3a@news.povray.org>
This is the complete cliff code:

//=================== code starts here ==========================
// Zeger Knaepen's originally:
#declare Rough =
function {
  pigment {
    granite
    color_map {
      [0.0 rgb 1.0]
      [0.1 rgb 1.0] // position this to change surface roughness somewhat
      [1.0 rgb 0.0]
    }
    //this may be nice but not essential (can also be done within the
isosurface function):
    scale <1, 1, 1>
    warp {
      turbulence <1, 1, 1>
    }
  }
};

//--------------------------------------
#declare MinBox = <-10, -2, -15>;
#declare MaxBox = <20, 5, 15>;
#declare RotBox = 35;
#declare SeeBox = 0;

// The following functions define the basic shape of the cliff:
#declare F_inter = function { max((y-5),(x-1)) }           //
intersection; - sign shifts plane in positive direction, and vice versa
#declare F_ground = function { y }                  // the hardground at the
base of the cliff
#declare F_slope = function { (x-1)+y - f_noise3d(x,y,z) }     // the slope
transition between the cliff and the hardground, with some noise added
// This is an alternative (slow!) using the blob function:
#declare F_mult = function {F_inter(x,y,z) * F_ground(x,y,z) - 0.5} // A
very small constant makes a cavern in the cliff; >=0.5 rounded outwards

#declare Cliff =
  isosurface {
    function {
      min(F_inter(x,y,z), F_ground(x,y,z), F_slope(x,y,z))  // merging of
intersection,  y plane, and x-y plane.
      // Or use:
      //F_mult(x,y,z)                     // blob-like combination
intersection and y plane; Cliff shape will be changed!
      +
      max((Rough(x/100, y/150, z/100).red),(f_ridged_mf(x/200, y/300, z/100,
1, 4, 4, 1, 2, 2)))
    }
    contained_by {box {MinBox, MaxBox} }

    threshold 0
    accuracy 0.01              // default=0.001; higher=faster/less
accurate; lower is slower/more accurate
    evaluate 12, 3, 0.7             // evaluates the max_gradient
    all_intersections
    //open
    texture {
      <your own texture>
    }
    //final transformations:
    scale <1, 1, 1>
    rotate <0, RotBox, 0>
    translate <0, 0, 0>
  } // end isosurface

object {Cliff}

//outline of the container box:
#if (SeeBox)
box {MinBox, MaxBox pigment {color rgbt <0.7, 0.0, 0.0, 0.8>} rotate
y*RotBox}
#end

//=================== code ends here ==========================


Post a reply to this message

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