POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
30 Apr 2024 15:36:54 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: Kenneth
Date: 14 Feb 2023 11:00:00
Message: <web.63ebab6243a1dd889b4924336e066e29@news.povray.org>
"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.
>

Ah, that's simple too:

By default, a height_field is only 1X1 units square (x and z). That's the way
POV-ray creates it, regardless of the resolution that you give to the function.

So, you would need to simply scale-up the entire height_field afterward-- say,
10X10. BUT, that also requires that you change two other things, to keep the
height_field looking nice and detailed:

1) increase the given resolution of the function. That is, instead of
        function 50,50{...}
it should now be  function 50*10,50*10 {...}. Or 500,500. Of course, this higher
resolution takes longer to process, because there are now more triangles that
have to be created. By the way, the resolution is not the square size of the
height_field, but its 'detail'... the number of triangles.

2) (optional)  If you want the granite pattern to look 'the same size'
as in your original 1X1 render-- but spread over the larger area-- you
will need to either scale-down the original pattern by 1/10, OR use a
function trick to do it afterward:
     #declare HF00 = height_field {
     function 500, 500 { Fn02(x*10,y*10,z*10) }

(Actually, the z does not need this when making a height_field; z is
ignored.)

The interesting thing to notice is that a function's 'scaling' is the opposite
of what would seem normal-- 10 instead of 1/10.


Post a reply to this message

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