POV-Ray : Newsgroups : povray.newusers : bicubic patch editor Server Time
13 Apr 2025 08:21:44 EDT (-0400)
  bicubic patch editor (Message 19 to 28 of 38)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

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

> but I have a error in
> Grass (x, y,z)*GrassHeight}
>
> "Expected '.', * found instead"

Yeah - inbuilt pigment functions return a full rgbft vector, so you have to
specify which vector component you want to use in the crippled user-defined
scalar function you're writing.

So, just do:
Grass (x, y,z).red*GrassHeight

- BW


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 14:45:00
Message: <web.67ec336341fe044264ac0beab67afd2@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "gulino" <nomail@nomail> wrote:
>
> > but I have a error in
> > Grass (x, y,z)*GrassHeight}
> >
> > "Expected '.', * found instead"
>
> Yeah - inbuilt pigment functions return a full rgbft vector, so you have to
> specify which vector component you want to use in the crippled user-defined
> scalar function you're writing.
>
> So, just do:
> Grass (x, y,z).red*GrassHeight
>
> - BW


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

"Invalid number of parameters 9 supplied, 3 required"


Post a reply to this message

From: Bald Eagle
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 15:00:00
Message: <web.67ec36cc41fe044a911b6e125979125@news.povray.org>
{sigh}
Since you're supplying the other 6 parameters as numeric values in your function
declaration, you don't need to supply them as actual parameters when you call
the function.

try:
#declare PlainAndGrass = function {Plain (x, y, z) +
Grass (x, y,z).red*GrassHeight}

If you want to keep it like it is in the final function, rewrite Plain using
(x, y, z, P0, P1, P2, P3, P4, P5) in both parentheses and curly braces.

But just try x,y, z for now.

- BW


Post a reply to this message

From: gulino
Subject: Re: bicubic patch editor
Date: 1 Apr 2025 15:25:00
Message: <web.67ec3c8c41fe044264ac0beab67afd2@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> {sigh}
> Since you're supplying the other 6 parameters as numeric values in your function
> declaration, you don't need to supply them as actual parameters when you call
> the function.
>
> try:
> #declare PlainAndGrass = function {Plain (x, y, z) +
> Grass (x, y,z).red*GrassHeight}
>
> If you want to keep it like it is in the final function, rewrite Plain using
> (x, y, z, P0, P1, P2, P3, P4, P5) in both parentheses and curly braces.
>
> But just try x,y, z for now.
>
> - BW

#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).red*GrassHeight}

"Invalid number of parameters, 3 suplied, 8 required"
what


Post a reply to this message

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

> #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).red*GrassHeight}
>
> "Invalid number of parameters, 3 suplied, 8 required"

Then like I said, try:

#declare Plain = function {f_ridged_mf(x,y,z, P0, P1, P2, P3, P4, P5) }
#declare Grass = function {pigment {bumps}} // <--- you need a closing curly
brace
#declare GrassHeight = 10;
#declare PlainAndGrass = function {Plain (x, y, z, 2.3, 7.0, 5.0, -2, 1, 3.0) +
Grass (x, y,z).red*GrassHeight}


Then declare Pattern = pigment {function {PlainAndGrass (x, y, z, P0, P1, P2,
P3, P4, P5)}}
(Thanks for your patience. ;) This is easier when I'm home and can provide
functional, tested code that I can run through the parser.)

- BW


Post a reply to this message

From: Bald Eagle
Subject: Re: bicubic patch editor
Date: 2 Apr 2025 06:45:00
Message: <web.67ed14ac41fe0441f9dae3025979125@news.povray.org>
I got derailed last night, but did not forget.

Tested, working code:


#version 3.8;
global_settings {
 assumed_gamma 1.0
}

#include "functions.inc"

#declare E = 0.00001;


#declare Location = <0, 500, -1000>;
camera {
 location Location
 right x*image_width/image_height
 up y
 look_at <0, 0, 0>
}


sky_sphere {pigment {rgb 1}}

light_source {<3000, 2000, -2000> rgb 1}
sky_sphere {pigment {rgb 1}}

#declare Line = 0.01;

#declare E = 0.0000001;

#declare Plain = function (x, y, z, P0, P1, P2, P3, P4, P5) {f_ridged_mf (x,y,z,
P0, P1, P2, P3, P4, P5) }
#declare Grass = function {pigment {bumps}}
#declare GrassHeight = 10;
#declare PlainAndGrass = function (x, y, z, P0, P1, P2, P3, P4, P5) {Plain (x,
y, z, P0, P1, P2, P3, P4, P5) +
Grass (x, y,z).red*GrassHeight}


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


Post a reply to this message


Attachments:
Download 'landscape.png' (258 KB)

Preview of image 'landscape.png'
landscape.png


 

From: gulino
Subject: Re: bicubic patch editor
Date: 2 Apr 2025 09:40:00
Message: <web.67ed3dd841fe044264ac0beab67afd2@news.povray.org>
Thanks for the help but what exactly is this? I was aiming to make a grass
texture like this


Post a reply to this message


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

Preview of image 'plainpov.png'
plainpov.png


 

From: jr
Subject: Re: bicubic patch editor
Date: 2 Apr 2025 09:50:00
Message: <web.67ed403941fe044721a48e56cde94f1@news.povray.org>
hi,

"gulino" <nomail@nomail> wrote:
> Thanks for the help but what exactly is this? I was aiming to make a grass
> texture like this

individual grass blades (meshes) "planted" is one option, if you search for
"grass macro" or variations on this site, there'll be plenty of "hits", some
going back _years_ :-).  see for instance this thread:
<https://news.povray.org/povray.binaries.images/thread/%3C46972e23%40news.povray.org%3E/>.
 hth.


regards, jr.


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.