POV-Ray : Newsgroups : povray.newusers : bicubic patch editor Server Time
12 Apr 2025 17:40:16 EDT (-0400)
  bicubic patch editor (Message 11 to 20 of 38)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: kurtz le pirate
Subject: Re: bicubic patch editor
Date: 31 Mar 2025 12:48:03
Message: <67eac743$1@news.povray.org>
On 31/03/2025 18:00, Alain Martel wrote:
> Le 2025-03-31 à 10:17, gulino a écrit :
> 
>> I want to make a plain like this image, I think heightfields will not 
>> work
>> because it's for mountains. I am not sure how many patches but for 
>> sure more
>> than one. It would be nice if there is a program that for example can 
>> make these
>> and give me the value of the points because it seems very hard doing 
>> by hand
> Heightfields can be used for mountains, but, that's just one of the many 
> way they can be used.
> What you show here can perfectly be done using a heightfield.


Yes, heightfield is a good candidate.

I also think that an isosurface using one of pov's internal functions 
should also do the trick.


#declare plain = height_field {
  function Res,Res {
    <<function here>>
    }
   smooth
   translate <-0.50, 0, -0.50>
   }


All that's left is to find the right function and parameters ;)
<https://www.povray.org/documentation/view/3.60/449/>
<https://www.povray.org/documentation/view/3.60/448/>


Simple combinaison of trigonometrics functions and/or f_ridged_mf() can 
be used as a base.





-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 31 Mar 2025 13:45:00
Message: <web.67ead44f41fe044264ac0beab67afd2@news.povray.org>
Sorry but I am really struggling with this, I have no idea how to put a function
in a heightfield because I only find examples with images, can someone make a
simple example for me to see?
I tried this just to test:

height_field {
   function {
    sin(x * 0.1) * 5
  }
  smooth
  scale <100, 100, 100>

}
but it give me a error in "funcion {"
error:
expected numeric expression, { found instead


Post a reply to this message

From: Bald Eagle
Subject: Re: bicubic patch editor
Date: 31 Mar 2025 14:15:00
Message: <web.67eadad441fe044d97b426e25979125@news.povray.org>
"gulino" <nomail@nomail> wrote:
>  can someone make a
> simple example for me to see?

There were several examples in the thread I posted:
https://news.povray.org/povray.general/thread/%3Cweb.63ea928499ce13121f9dae3025979125%40news.povray.org%3E/?ttop=444970
&toff=150&mtop=439826

  height_field {
    function 500,500 { pattern { bozo scale 0.08 } }
    smooth
    pigment {rgb z}
    scale <1,0.4,1>
    }


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 10:55:00
Message: <web.67ebfdbe41fe044264ac0beab67afd2@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "gulino" <nomail@nomail> wrote:
> >  can someone make a
> > simple example for me to see?
>
> There were several examples in the thread I posted:
>
https://news.povray.org/povray.general/thread/%3Cweb.63ea928499ce13121f9dae3025979125%40news.povray.org%3E/?ttop=4449
70
> &toff=150&mtop=439826
>
>   height_field {
>     function 500,500 { pattern { bozo scale 0.08 } }
>     smooth
>     pigment {rgb z}
>     scale <1,0.4,1>
>     }

height_field {
  function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
  smooth
  scale <400, 100, 400>
   pigment { checker rgb 0.05 rgb 1 scale <20, 20, 20>}
   translate <-200, -120, -200>
}

error in: function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }

"Expected 'operator', ( found instead"

What is wrong?


Post a reply to this message

From: MichaelJF
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 11:05:09
Message: <67ec00a5$1@news.povray.org>
Am 01.04.2025 um 16:52 schrieb gulino:

> height_field {
>    function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
>    smooth
>    scale <400, 100, 400>
>     pigment { checker rgb 0.05 rgb 1 scale <20, 20, 20>}
>     translate <-200, -120, -200>
> }

You should include "functions.inc" first to define the function 
f_ridged_mf. In addition, you should specify a higher resolution and 
shorten your parameter list one parameter. Soemthing like:

#include "functions.inc"

height_field {
   function 100, 200 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0) }
   smooth
   scale <400, 100, 400>
    pigment { checker rgb 0.05 rgb 1 scale <20, 20, 20>}
    translate <-200, -120, -200>
}

Best regards
Michael


Post a reply to this message

From: Bald Eagle
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 12:15:00
Message: <web.67ec104041fe044a911b6e125979125@news.povray.org>
"gulino" <nomail@nomail> wrote:

> error in: function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
>
> "Expected 'operator', ( found instead"
>
> What is wrong?

Like MichaelJF pointed out, you need to put
#include "functions.inc" in a line preceding your use of the function.

Why?
Because all functions.inc does is give a more human-readable and memorable name
to internal function #59:
#declare f_ridged_mf = function { internal(59) }

So, alternatively, you could just get right down to it and use
#declare f_ridged_mf = function { internal(59) }
in your scene _instead of_
#include "functions.inc"

You can't do BOTH, unless you
#undef _ridged_mf
since you can't declare a function twice.

With regard to the number of arguments in your function call, when I'm using a
new language, syntax, or function with a large number of anonymous/magic
arguments, I tend to copy/paste the documentation for the function into my
scene, and then I have some identification/explanation/meaning for each of the
arguments, as well as a proper count.

So I would
#declare P0 = 0.5;  // explanatory comment
.....
#declare P5 = 3; // noise generator

And then you can easily use and edit your function call as you experiment with
your scene:

f_ridged_mf(x,y,z, P0, P1, P2, P3, P4, P5):

I also tend to just copy the documentation into a comment block at the end of my
scene so I don't have to constantly be switching editor windows to go look up
what the heck the 7th argument in my function controls (in case I read it wrong
or misunderstood the first time)...

/*
P0 : H is the negative of the exponent of the basic noise frequencies used in
building these functions (each frequency f's amplitude is weighted by the factor
fE- H ). When H is 1, the fractalization is relatively smooth. As H nears 0, the
high frequencies contribute equally with low frequencies
P1 : Lacunarity is the multiplier used to get from one octave to the next in the
fractalization. This parameter affects the size of the frequency gaps in the
pattern. (Use values greater than 1.0)
P2 : Octaves is the number of different frequencies added to the fractal. Each
octave frequency is the previous one multiplied by Lacunarity. So, using a large
number of octaves can get into very high frequencies very quickly
P3 : Offset gives a fractal whose fractal dimension changes from altitude to
altitude. The high frequencies at low altitudes are more damped than at higher
altitudes, so that lower altitudes are smoother than higher areas
P4 : Gain weights the successive contributions to the accumulated fractal result
to make creases stick up as ridges
P5 : Generator type used to generate the noise3d. 0, 1, 2 and 3 are legal
values.
*/

- Hang in there - you'll get it.  :)

- BE


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 12:50:00
Message: <web.67ec190b41fe044264ac0beab67afd2@news.povray.org>
Thanks for the help, I managed to get this result with these values:

height_field {
   function 100, 200 { f_ridged_mf(x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
   smooth
   scale <1000, 100, 1300>
    pigment {
       color rgb <0.3, 0.5, 0.0>
    }
    normal {
        bumps 0.3 scale 0.4
    }
    translate <-500, -120, -1000>
}

It can be better but looks like a plain at least. Also I put normal bumps to
make it more like grass but it didn't work so well, do you guys have some idea
how to it?


Post a reply to this message


Attachments:
Download 'plainpov.png' (120 KB)

Preview of image 'plainpov.png'
plainpov.png


 

From: Bald Eagle
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 13:10:00
Message: <web.67ec1d6941fe044a911b6e125979125@news.povray.org>
"gulino" <nomail@nomail> wrote:
> Thanks for the help, I managed to get this result with these values:
>
> height_field {
>    function 100, 200 { f_ridged_mf(x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
>    smooth
>    scale <1000, 100, 1300>
>     pigment {
>        color rgb <0.3, 0.5, 0.0>
>     }
>     normal {
>         bumps 0.3 scale 0.4
>     }
>     translate <-500, -120, -1000>
> }
>
> It can be better but looks like a plain at least. Also I put normal bumps to
> make it more like grass but it didn't work so well, do you guys have some idea
> how to it?

https://wiki.povray.org/content/Reference:Bump_Map

The relative bump size can be scaled using the bump_size modifier. The bump size
number can be any number other than 0 but typical values are from about 0.1 to
as high as 4.0 or 5.0.

normal {
  bump_map {
    gif "stuff.gif"
    bump_size 5.0
    }
  }

Originally bump_size could only be used inside a bump map but it can now be used
with any normal.

You can also move the camera back a bit, and perhaps move your light source to
give a more raking angle to make some more shadows and give a more defined
texture/normal.

The other thing you could do is add/subtract a scaled bumps/spotted pigment as
part of your heightfield function to get an actual physical displacement.

#declare Plain = function {f_ridged_mf(x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
#declare Grass = function {pigment {bumps}
#declare GrassHeight = 10;
#declare PlainAndGrass = function {Plain (x, y, z, ....) + Grass (x, y,
z)*GrassHeight}

height_field {function 100, 200 { PlainAndGrass (....)} ....

Hope that makes sense.

- BW


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 13:45:00
Message: <web.67ec25f641fe044264ac0beab67afd2@news.povray.org>
> The other thing you could do is add/subtract a scaled bumps/spotted pigment as
> part of your heightfield function to get an actual physical displacement.
>
> #declare Plain = function {f_ridged_mf(x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
> #declare Grass = function {pigment {bumps}
> #declare GrassHeight = 10;
> #declare PlainAndGrass = function {Plain (x, y, z, ....) + Grass (x, y,
> z)*GrassHeight}
>
> height_field {function 100, 200 { PlainAndGrass (....)} ....
>
> Hope that makes sense.
>
> - BW

I tried to do this,

#declare Plain = function {f_ridged_mf(x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
#declare Grass = function {pigment {bumps}
#declare GrassHeight = 10;
#declare PlainAndGrass = function {Plain (x, y, z, 2.3, 7.0, 5.0, -2, 1, 3.0) +
Grass (x, y,z)*GrassHeight}


height_field {
   function 100, 200 {PlainAndGrass (x,y,z, 2.3, 7.0, 5.0, -2, 1, 3.0) }
   smooth
   scale <1000, 100, 1300>
    pigment {
       color rgb <0.3, 0.5, 0.0>
    }
    translate <-500, -120, -1000>
}

but I have a error in
Grass (x, y,z)*GrassHeight}

"Expected '.', * found instead"


Post a reply to this message

From: Alain Martel
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 14:05:18
Message: <67ec2ade$1@news.povray.org>
Le 2025-04-01 à 10:52, gulino a écrit :

> height_field {
>    function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
>    smooth
>    scale <400, 100, 400>
>     pigment { checker rgb 0.05 rgb 1 scale <20, 20, 20>}
>     translate <-200, -120, -200>
> }
> 
> error in: function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
> 
> "Expected 'operator', ( found instead"
> 
> What is wrong?
> 
> 
1) You need to #include functions.inc before.

2) The numbers after function are the U and V resolution, or number of 
samples, used to evaluate the function when creating the height field.
Values of 1,2 mean 1 sample in the U axis and 2 samples in the V axis, 
or a line single between two points. You won't even see that in a scene. 
You need a strict minimum of 2,2.

In order to have something acceptable, a reasonable starting point would 
be something like 100,100.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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