POV-Ray : Newsgroups : povray.binaries.images : Cliff study : Cliff study Server Time
5 Nov 2024 00:28:37 EST (-0500)
  Cliff study  
From: Thomas de Groot
Date: 28 Dec 2005 03:26:49
Message: <43b24c49@news.povray.org>
As an upbeat to more serious work :-)   I have been experimenting with the
building of a cliff with isosurfaces. This is the latest example. I include
the code here. Really simple but effective.

Enjoy!!

Thomas

//========== code starts here ========================
#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
//============ end of code ====================


Post a reply to this message


Attachments:
Download 'Cliff_05.jpg' (38 KB)

Preview of image 'Cliff_05.jpg'
Cliff_05.jpg


 

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