POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time17 Apr 2024 18:44:55 EDT (-0400)
 Re: Using a function in a height_field declaration
 From: Kenneth Date: 14 Feb 2023 12:00:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.63ebbdaf43a1dd889b4924336e066e29%40news.povray.org",
"headline": "Re: Using a function in a height_field declaration",
"dateCreated": "2023-02-14T17:00:00+00:00",
"datePublished": "2023-02-14T17:00:00+00:00",
"author": {
"@type": "Person",
"name": "Kenneth"
}
}
"yesbird" <nomail@nomail> wrote:
> Yet another mystery. In following example 50 is resolution, but how to set range
> for x,z ? Only small part of surface is visible.
>
> height_field
> {
>   function 50, 50 { sin (sqrt (x*x + y*y)) / (sqrt (x*x + y*y)) }
>   smooth
>   scale <1, 0.3, 1>
>   pigment { green 0.8 }
> }

That's because the sine waves are too 'large' to see in the 1X1 height_field.

Try this function 'scaling' trick for an interesting-- if odd-looking -- result.
(I changed your light_source position to <10,4,10> to make it easier to see, and
gave the function a higher resolution):

function 200, 200 { sin (sqrt (x*x + y*y)*20) / (sqrt (x*x + y*y)*20)}

As you can see, playing around with function values can be quite fun!
```