 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"gulino" <nomail@nomail> wrote:
> Thanks for the help but what exactly is this? I was aiming to make a grass
> texture like this
I'm just getting the functions to work without any errors.
Scale the functions so that they make something along the lines of what you
want.
Do that by multiplying or dividing the x, y, and z in the function call.
You may find Mike Williams' isosurface tutorial helpful with regard to working
with functions in POV-Ray.
https://wiki.povray.org/content/User:BillW
Also, as jr said, if you can't get the function or the normal method to work,
then you can use a set of macros to model actual blades of grass to better give
you what you're looking for.
Also, like jr said, you have 30 years of people writing and posting scenes here.
Search for "grass", "landscape", "heightfield", etc and see what pops up.
Use the website search feature, but also use a search engine to see what people
have done and have posted elsewhere.
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
What you think? Looks grass?
Post a reply to this message
Attachments:
Download 'plainpov (2).png' (108 KB)
Preview of image 'plainpov (2).png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |