POV-Ray : Newsgroups : povray.binaries.images : A Question : Re: A Question Server Time
30 Jul 2024 20:20:47 EDT (-0400)
  Re: A Question  
From: Samuel Benge
Date: 17 Jan 2011 18:00:01
Message: <web.4d34c923a5aa5444a6fdb2bc0@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> I'm working on a concept for a shoreline backed by Basalt columns. I'm using a
> randomly tiled hexagonal pattern function with a height field and multiplying it
> by f_ridged_mf
>
> The problem I'm having is that the tops of the columns should be flat, not
> slanted, so that the base offset follows the contour of f_ridged_mf, but their
> height does not.
>
> Any advice would be appreciated.

Hi Anthony,

You can use an array of cones to produce the needed topology for your basalt. It
will need to be rendered as a height map beforehand. Here's a quick idea that
might help you on your quest:

/*

  basalt.pov

  2011 Samuel Benge

  A quick basalt height map generator. Render with +rng or hf_gray_16

*/

#include "functions.inc"
#include "math.inc"


// user variables

#declare N_Rows = 20;          // this determines the number of columns
#declare N_Extra_Columns = 0; // how many columns to randomly add
#declare Jitter    = 0.2;    // makes everything a bit more natural

#declare Height_Function = // your height function here
  function{
    f_ridged_mf(x*3,y*3,z*3, 0.6, 3, 7, 0.7, 0.7, 2)
  }

// ~user variables


#default{ finish{ ambient 1 } }

camera{
 orthographic
 right x*2 up y*2
 location -z*10
}

union{
  #declare R = seed(1001);
  #declare Z = -int(N_Rows*1.4/2);
  #while(Z<=int(N_Rows*1.4/2))
    #declare X = -int(N_Rows/2);
    #while(X<=int(N_Rows/2))
      cone{0,0,-y,2/N_Rows
        #local Vec =
          <
            X+odd(Z)/2+rand(R)*Jitter,
            0,
            Z+rand(R)*Jitter
          >/N_Rows*<1,1,sin(pi*2/3)>*2;
        #declare XV = Vec.x;
        #declare ZV = Vec.z;
        translate Vec
        pigment{rgb Height_Function(XV,0,ZV).x}
      }
      #declare X=X+1;
    #end
    #declare Z=Z+1;
  #end

  // extra columns
  #declare V=0;
  #while(V<N_Extra_Columns)
    cone{0,0,z,1/N_Rows
      #local Vec = <-1+rand(R)*2, -1+rand(R)*2, 0>;
      #declare XV = Vec.x;
      #declare YV = Vec.y;
      translate Vec
      pigment{rgb Height_Function(XV,YV,0).x}
    }
    #declare V=V+1;
  #end
  rotate x*270
}

// ~basalt.pov

The edges of each column will still produce artifacts, but you can overcome this
to some degree by blurring the 16-bit gray scale image. I've provided a scene
file for blurring an image. It's over at p.t.scene-files and is called
"blurResample.pov."

http://news.povray.org/povray.text.scene-files/thread/%3C4d34c72d%40news.povray.org%3E/

I hope that helps!

Sam


Post a reply to this message

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