POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
20 Apr 2024 06:22:54 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: William F Pokorny
Date: 14 Feb 2023 05:25:57
Message: <63eb61b5$1@news.povray.org>
On 2/13/23 19:45, Cousin Ricky wrote:
> #declare MyFunction = function (x, y)
> { (2 - cos (x * 2*pi) - cos (y * 2*pi)) / 4
> }
> 
> height_field
> { function 20, 20 { MyFunction (x, y) }
>    smooth

Good example. I always get tripped up when I come back to height_fields 
because the function variables used are x and y (to match image based 
height_fields I guess) while the generated height field sits atop the 
x,z plane with y being the height. I too often first code my function 
using x and z!

Bill P.

---
Another quick example.

#declare Fn02 = function { pattern { granite scale 0.5 } }
#declare Orange = srgb <1,0.50196,0>;
#declare HF00 = height_field {
     function 800, 800 { Fn02(x,y,z) }
     smooth
     pigment { color Orange }
     translate <-0.5,0,-0.5>
     scale <2,0.05,2>
}


Post a reply to this message

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