POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes : Re: Mapping Textures on irregular shapes Server Time
3 May 2024 02:47:53 EDT (-0400)
  Re: Mapping Textures on irregular shapes  
From: Bald Eagle
Date: 6 May 2020 18:50:01
Message: <web.5eb33ef672e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> isosurface
> {
>   function
>   {
>     BASE_SHAPE(x + rand(Rnd_1), y, z)
>   }
> }
>
> The exact statement minus the + rand(Rnd_1) works fine.
>
> Here is the error:
>
> File 'asteroid.pov' line 216: Parse Error: Expected 'function identifier', }
>  found instead
>
> Josh

You need to precompute the random number before passing it into your function.

#declare RN = rand(Rnd_1);

> isosurface
> {
>   function
>   {
>     BASE_SHAPE(x + RN, y, z)
>   }
> }

Will work.
But it will then stay the same number selected from the pseudo-random stream,
and so apply the SAME number to ALL of the x's.   You may as well just input
your own "randomly" determined number between 0 and 1.

If you want to just add some amount of noise to x - meaning a different amount
of noise depending on the x value, then you need to modify x with one of the
precomputed noise _functions_.

x + f_noise3D (x,y,z) or something like that

you might also try selecting out the x component of the noise like this:

BASE_SHAPE(f_noise3D (x,0,0), y, z)


Functions are tricky, and the syntax is fussy, and there are only certain things
you can use in functions, and only certain things that will work the way you
initially think they will - the rest are more complicated.


With regard to "changing the seed" for the noise function, I think that maybe
you can change the noise generator.
http://wiki.povray.org/content/Reference:Global_Settings#Noise_generator

But I don't really know how to change what it starts off calculating the noise
with.   I'd just use translate and rotate to change the existing noise function,
because that's largely the same thing.


Post a reply to this message

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