 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
{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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |