POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
23 Jun 2024 14:51:10 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: kurtz le pirate
Date: 18 Feb 2023 10:39:38
Message: <63f0f13a$1@news.povray.org>
On 13/02/2023 20:41, Bald Eagle wrote:
> 
> According to:
> https://wiki.povray.org/content/Reference:Height_Field
> 
> (At the very bottom)
> 
> "The height field object also allows for substituting a user defined function
> instead of specifying an image. That function can either be in it's literal
> form, or it can be a call to a function that you have predeclared. The user
> supplied parameters FieldResolution_X and FieldResolution_Y are integer values
> that affect the resolution of the color/index values, not size of the unscaled
> height field."
> 
> There is, of course, no code snippet supplied, so I'm just casting about trying
> to get this to work.
> 
> Has anyone used this method before?

Yes, but this dates back to ... 2003

Gilles Tran used this in his macro examples of "Cloud Generator"
(<http://www.oyonale.com/modeles.php?lang=en&page=36>).


#declare SeaBase = height_field {
 function Resolution,Resolution {
  (sin(y*pi*5)+1)/3+f_ridged_mf(x*14, y*30,z, 1.2,3,6,1.18,5,1)*0.55/3
// (sin(y*pi*5)*0.5+sin(x*pi*4)*0.5+1)*0.4+f_ridged_mf(x*7, y*15,z,
1.2,3,6,1.18,5,1)*0.54*0.2
  }
  #if (SeaSmoothOK = 1) smooth #end
  }

#declare TerrainBase=height_field{
 function Resolution,Resolution {
  f_ridged_mf( x*2, y*2, z,0.6, 3, 6, -1, 3,3 )*0.2
  }
 #if (TerrainSmoothOK=1)
  smooth
 #end
 translate -x*0.5
 }





old man's words ;)

-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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