POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes Server Time
15 Jul 2024 06:50:45 EDT (-0400)
  Mapping Textures on irregular shapes (Message 38 to 47 of 47)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Alain Martel
Subject: Re: Mapping Textures on irregular shapes
Date: 1 May 2020 21:03:35
Message: <5eacc6e7$1@news.povray.org>
Le 2020-05-01 à 12:53, Josh a écrit :
> Alain Martel <kua### [at] videotronca> wrote:
>> Le 2020-04-30 à 20:10, Josh a écrit :
>>> "Josh" <nomail@nomail> wrote:
>>>> I've found a way to create and use a df3 file as an isosurface. Works well. I'm
>>>> trying now to add noise to it and it makes the shape disappear. Any ideas? The
>>>> shape shows up fine without the +f_noise3d(x,y,z)*2 statement... Does anyone
>>>> know what is happening?
>>>>
>>>> #include "functions.inc"
>>>> #declare Fnct00 = function {
>>>>       pattern { density_file df3 "aster1.df3" interpolate 0
>>>>       }
>>>> }
>>>> #declare Fnct01 = function (x,y,z) {
>>>>       0.025-Fnct00(x,y,z)
>>>> }
>>>> #declare BaryteGreen = srgb <0.6157,0.7686,0.3725>;
>>>> #declare Iso00 = isosurface {
>>>>       function { Fnct01(x,y,z) + f_noise3d(x,y,z)*2}
>>>>       contained_by { box { -5,5 } }
>>>>       threshold 0
>>>>       accuracy 0.0005
>>>>       max_gradient 6
>>>>       all_intersections
>>>>       texture {
>>>>         pigment { color BaryteGreen }
>>>>         finish { ambient <0.03,0.02,0.0> diffuse 0.8,0.4 phong 0.7 }
>>>>       }
>>>> }
>>>>
>>>> Josh
>>>
>>> Just to clarify, I've tried adding f_noise3d, subtracting it, nothing seems to
>>> allow me to perturb the surface of my df3 shape like I can if my function is
>>> just a simple sphere...
>>>
>>> Josh
>>>
>>>
>>
>> Play with the coordinates passed to the function and see what happen.
>>
>> A starting point :
>> function { Fnct01(x+sin(y*2+z*3),y-cos(x*7),z+cos(y*5)) }
> 
> That produced interesting results. It split the shape up and duplicated it a
> bunch of times. I'll have to think about it.
> 
> In the meantime, does anyone know what the isosurface function would be for a
> rounded box?
> 
> Thanks!
> 
> Josh
> 
> 
You can reduce the intensity of the effect as follow :

function { Fnct01(x+sin(y*2+z*3)/2,y-cos(x*7)/5,z+cos(y*5)/10) }

You can sear the object :
function { Fnct01(x+y/2,y,z) }

Or progressively scale it :
function { Fnct01(x*sin(y*2)*cos(z*3)/2,y*cos(x*7)/5,z*cos(y*5)/10) }


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 1 May 2020 23:00:01
Message: <web.5eace1ec72e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> Beautiful! Thanks so much, that works great!

Now here's a neat trick to help you puzzle out some things as well.
Plug your function into a pigment statement, and you can plot a 2D slice in
order to see all the isolines in that plane.
It's also a LOT faster than repeatedly rendering the [developmental] isosurface
until you get the equations right, and you can see a BIG area in case your
isosurface pieces are somehow outside of the contained_by shape.

#declare Map = pigment {function {YourFunction (x,y,z)}}
#declare S2 = 10;
#declare Square2 = union {
 triangle {<-1, 0, -1>*S2, <-1, 0, 1>*S2, <1, 0, -1>*S2}
 triangle {<1, 0, -1>*S2, <-1, 0, 1>*S2, <1, 0, 1>*S2 }
 texture {Map}
}
object {Square2 translate -y*4}

.... or just use a whole plane {}


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 3 May 2020 20:00:00
Message: <web.5eaf5ad572e01857dc1270cd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Josh" <nomail@nomail> wrote:
>
> > Beautiful! Thanks so much, that works great!
>
> Now here's a neat trick to help you puzzle out some things as well.
> Plug your function into a pigment statement, and you can plot a 2D slice in
> order to see all the isolines in that plane.
> It's also a LOT faster than repeatedly rendering the [developmental] isosurface
> until you get the equations right, and you can see a BIG area in case your
> isosurface pieces are somehow outside of the contained_by shape.
>
> #declare Map = pigment {function {YourFunction (x,y,z)}}
> #declare S2 = 10;
> #declare Square2 = union {
>  triangle {<-1, 0, -1>*S2, <-1, 0, 1>*S2, <1, 0, -1>*S2}
>  triangle {<1, 0, -1>*S2, <-1, 0, 1>*S2, <1, 0, 1>*S2 }
>  texture {Map}
> }
> object {Square2 translate -y*4}
>
> .... or just use a whole plane {}

Thanks so everyone for the advice and hints, I am well on my way now. I have a
couple of questions not directly related to the questions that started this
thread...

1) (How) can I overlay pigment textures? I am envisoning something like the
following where I overlay a bozo pigment on top of an agate pigment, with
transparency on the bozo color map... Ideally, where the bozo map is not
transparent it would replace the pigment of the agate color map, not add to
it...

pigment
{
  agate
  color_map
  {
    [0 Gold]
    [1 Brown]
  }
  bozo
  color_map
  {
    [0 Transparent]
    [1 Red]
  }
}

2) How can I change the seed for builtin functions that use random like agate,
granite, bozo, f_noise3d so that they produce different results?

3) If I have 15 asteroids defined like #declare aster1 = isosurface { ...
transform { Axis_Rotate_Trans( <1, .2, 0>, 360*clock) }}, how would I setup
povray to iterate through them and render a seperate animation for each
asteroid? I'm fine just writing an external program to iterate on them if
needed, but if it's easy I'd like to see the povray way...

Thanks so much!

Josh


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 3 May 2020 20:15:00
Message: <web.5eaf5d7972e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> 1) (How) can I overlay pigment textures? I am envisoning something like the
> following where I overlay a bozo pigment on top of an agate pigment, with
> transparency on the bozo color map... Ideally, where the bozo map is not
> transparent it would replace the pigment of the agate color map, not add to
> it...
>
> pigment
> {
>   agate
>   color_map
>   {
>     [0 Gold]
>     [1 Brown]
>   }
>   bozo
>   color_map
>   {
>     [0 Transparent]
>     [1 Red]
>   }
> }
>
Close.  Define 2 textures, each with a single pigment pattern.

Then just do
object {Object texture {texture1} texture {texture2}}
The second will overlap the first.

> 2) How can I change the seed for builtin functions that use random like agate,
> granite, bozo, f_noise3d so that they produce different results?

You don't really change the seed ---  if you envision the bozo as a volume of
swirling color values - like poorly mixed paints, or drops of dye only beginning
to diffuse in water and frozen in time, then what you do is just move your
object, or move the texture, and they overlap differently.

so just do
object {texture {OverallTexture translate <x_amt, y_amt, z_amt>}}
obviously you can rotate, scale, and apply transforms as well.

> 3) If I have 15 asteroids defined like #declare aster1 = isosurface { ...
> transform { Axis_Rotate_Trans( <1, .2, 0>, 360*clock) }}, how would I setup
> povray to iterate through them and render a seperate animation for each
> asteroid? I'm fine just writing an external program to iterate on them if
> needed, but if it's easy I'd like to see the povray way...

Pretty good question - I do believe it's possible, but I've never done it
myself.
Others surely will know.
Hopefully you get that worked out and post the process.
I'm sure it's different for M$ Win vs Linux


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 3 May 2020 20:25:00
Message: <web.5eaf60a872e01857dc1270cd0@news.povray.org>
> Thanks so everyone for the advice and hints, I am well on my way now. I have a
> couple of questions not directly related to the questions that started this
> thread...
>
> 1) (How) can I overlay pigment textures? I am envisoning something like the
> following where I overlay a bozo pigment on top of an agate pigment, with
> transparency on the bozo color map... Ideally, where the bozo map is not
> transparent it would replace the pigment of the agate color map, not add to
> it...
>
> pigment
> {
>   agate
>   color_map
>   {
>     [0 Gold]
>     [1 Brown]
>   }
>   bozo
>   color_map
>   {
>     [0 Transparent]
>     [1 Red]
>   }
> }
>
> 2) How can I change the seed for builtin functions that use random like agate,
> granite, bozo, f_noise3d so that they produce different results?
>
> 3) If I have 15 asteroids defined like #declare aster1 = isosurface { ...
> transform { Axis_Rotate_Trans( <1, .2, 0>, 360*clock) }}, how would I setup
> povray to iterate through them and render a seperate animation for each
> asteroid? I'm fine just writing an external program to iterate on them if
> needed, but if it's easy I'd like to see the povray way...
>
> Thanks so much!
>
> Josh

Also,

4) I can't seem to get random numbers working. I've included #include
"functions.inc", #include "rand.inc". I have #declare Rnd_1 = seed (1153); but
when I put rand(Rnd_1) somewhere that you could put a float constant, povray
just complains that it expects something else.

Josh


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 3 May 2020 20:55:00
Message: <web.5eaf673272e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> Also,
>
> 4) I can't seem to get random numbers working. I've included #include
> "functions.inc", #include "rand.inc". I have #declare Rnd_1 = seed (1153); but
> when I put rand(Rnd_1) somewhere that you could put a float constant, povray
> just complains that it expects something else.

I'd need to see the actual statement that gets flagged and the actual error
message.  I don't know what that "something else" is.

I will guess that is complains that it found a ")" when it expected another
numerical argument.


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 6 May 2020 15:55:01
Message: <web.5eb3155b72e01857dc1270cd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Josh" <nomail@nomail> wrote:
>
> > Also,
> >
> > 4) I can't seem to get random numbers working. I've included #include
> > "functions.inc", #include "rand.inc". I have #declare Rnd_1 = seed (1153); but
> > when I put rand(Rnd_1) somewhere that you could put a float constant, povray
> > just complains that it expects something else.
>
> I'd need to see the actual statement that gets flagged and the actual error
> message.  I don't know what that "something else" is.
>
> I will guess that is complains that it found a ")" when it expected another
> numerical argument.

So here is the relevant part of my .pov file.

#declare Rnd_1 = seed (1153);

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


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 6 May 2020 16:00:01
Message: <web.5eb3165a72e01857dc1270cd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Close.  Define 2 textures, each with a single pigment pattern.
>
> Then just do
> object {Object texture {texture1} texture {texture2}}
> The second will overlap the first.
>

Great, that worked!

> > 2) How can I change the seed for builtin functions that use random like agate,
> > granite, bozo, f_noise3d so that they produce different results?
>
> You don't really change the seed ---  if you envision the bozo as a volume of
> swirling color values - like poorly mixed paints, or drops of dye only beginning
> to diffuse in water and frozen in time, then what you do is just move your
> object, or move the texture, and they overlap differently.
>
> so just do
> object {texture {OverallTexture translate <x_amt, y_amt, z_amt>}}
> obviously you can rotate, scale, and apply transforms as well.

Certainly there must be a way to change the seed for f_noise3d at least to get a
different noise shape, right?

>
> > 3) If I have 15 asteroids defined like #declare aster1 = isosurface { ...
> > transform { Axis_Rotate_Trans( <1, .2, 0>, 360*clock) }}, how would I setup
> > povray to iterate through them and render a seperate animation for each
> > asteroid? I'm fine just writing an external program to iterate on them if
> > needed, but if it's easy I'd like to see the povray way...
>
> Pretty good question - I do believe it's possible, but I've never done it
> myself.
> Others surely will know.
> Hopefully you get that worked out and post the process.
> I'm sure it's different for M$ Win vs Linux

Is there a simple way to pass (commandline) parameters into Povray? If I could
pass in a single number, then I could do an if in Povray based on it and then
call Povray multiple times with different numbers to render the different
asteroids?...

Josh


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 6 May 2020 16:15:01
Message: <web.5eb31a1e72e01857dc1270cd0@news.povray.org>
"Josh" <nomail@nomail> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > Close.  Define 2 textures, each with a single pigment pattern.
> >
> > Then just do
> > object {Object texture {texture1} texture {texture2}}
> > The second will overlap the first.
> >
>
> Great, that worked!
>
> > > 2) How can I change the seed for builtin functions that use random like agate,
> > > granite, bozo, f_noise3d so that they produce different results?
> >
> > You don't really change the seed ---  if you envision the bozo as a volume of
> > swirling color values - like poorly mixed paints, or drops of dye only beginning
> > to diffuse in water and frozen in time, then what you do is just move your
> > object, or move the texture, and they overlap differently.
> >
> > so just do
> > object {texture {OverallTexture translate <x_amt, y_amt, z_amt>}}
> > obviously you can rotate, scale, and apply transforms as well.
>
> Certainly there must be a way to change the seed for f_noise3d at least to get a
> different noise shape, right?
>
> >
> > > 3) If I have 15 asteroids defined like #declare aster1 = isosurface { ...
> > > transform { Axis_Rotate_Trans( <1, .2, 0>, 360*clock) }}, how would I setup
> > > povray to iterate through them and render a seperate animation for each
> > > asteroid? I'm fine just writing an external program to iterate on them if
> > > needed, but if it's easy I'd like to see the povray way...
> >
> > Pretty good question - I do believe it's possible, but I've never done it
> > myself.
> > Others surely will know.
> > Hopefully you get that worked out and post the process.
> > I'm sure it's different for M$ Win vs Linux
>
> Is there a simple way to pass (commandline) parameters into Povray? If I could
> pass in a single number, then I could do an if in Povray based on it and then
> call Povray multiple times with different numbers to render the different
> asteroids?...

I figured out this last part. Simply put Declare=ASTEROIDNUM=2 on the
commandline to declare an identifier...

Josh


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
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

<<< Previous 10 Messages Goto Initial 10 Messages

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