POV-Ray : Newsgroups : povray.general : Translate by turbulence Server Time
14 Oct 2026 22:20:43 EDT (-0400)
  Translate by turbulence (Message 1 to 16 of 16)  
From: TinCanMan
Subject: Translate by turbulence
Date: 12 Jul 2002 10:12:53
Message: <3d2ee3e5$1@news.povray.org>
I don't think this is possible in 3.5 but I'll ask anyways (perhaps it'll
give someone an idea for a patch ;) )
This is a bit difficult to explain but:  I want to be able to translate an
object according to the turbulence value at its location.  Let's say we have
a plane with a checker pattern on it and we place a little ball at the
origin.  If we apply turbulence to the checker pattern, the point that was
originally at <0,0,0> is now somewhere else defined by the turbulence
parameters.  I would like to be able to move the sphere to this new
location, something along the lines of:

plane{y 0
     pigment{
       checker rgb 1 rgb 0
       turbulence 0.5
       octaves 5
       lambda 1.2
       omega .25
     }
}
#declare newpt =

sphere{0 0.1
   pigment{rgb <1,0,0>}
   translate turb_translate(
      <0,0,0> //point to read turbulence value from
      turbulence 0.5
      octaves 5
      lambda 1.2
      omega .25
   )
}

Does anyone have any idea on how this can be done in 3.5?

-tgq


Post a reply to this message

From:
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:19:44
Message: <q2ptiucj8s1rouqpnt4td2ej9mufa0j41m@4ax.com>
On Fri, 12 Jul 2002 10:12:32 -0400, "TinCanMan" <Tin### [at] hotmailcom>
wrote:
> This is a bit difficult to explain but:  I want to be able to translate an
> object according to the turbulence value at its location.  Let's say we have
> a plane with a checker pattern on it and we place a little ball at the
> origin.  If we apply turbulence to the checker pattern, the point that was
> originally at <0,0,0> is now somewhere else defined by the turbulence
> parameters.  I would like to be able to move the sphere to this new
> location, something along the lines of:

Can you use user defined functions to recreate turbulence behaviour ?
If yes, that's could be solution (using some noise functions additionaly).

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:22:46
Message: <3D2EE636.107D3BD6@gmx.de>
TinCanMan wrote:
> 
> [...]
> Does anyone have any idea on how this can be done in 3.5?

Have a look at the 'vturbulence()' function.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 30 Jun. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: TinCanMan
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:23:32
Message: <3d2ee664$1@news.povray.org>
>
> Can you use user defined functions to recreate turbulence behaviour ?
> If yes, that's could be solution (using some noise functions additionaly).
>

Possibly.
How would you get the translation value from the noise function?

-tgq


Post a reply to this message

From:
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:35:50
Message: <q5qtiucq5q9a7dnt2pthadd6g9sbk4r7t3@4ax.com>
On Fri, 12 Jul 2002 16:22:46 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
> > Does anyone have any idea on how this can be done in 3.5?
>
> Have a look at the 'vturbulence()' function.

It can be wrong solution when you want displace geometry instead of vector as
for displacement in isosurfaces.

ABX


Post a reply to this message

From: TinCanMan
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:36:37
Message: <3d2ee975$1@news.povray.org>
>
> Have a look at the 'vturbulence()' function.
>
> Christoph
>

Thanks, but it appears to be the opposite of what I want (if I understand
turbulence properly).  The vector returned by vturbulence() for pt A is the
original vector of the point that is essentially now located at A rather
than where the point that was originally at A is now.

-tgq


Post a reply to this message

From:
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:37:50
Message: <i8qtiusukna1bkaftjqee1nekhildarvqe@4ax.com>
On Fri, 12 Jul 2002 10:23:11 -0400, "TinCanMan" <Tin### [at] hotmailcom>
wrote:
> > Can you use user defined functions to recreate turbulence behaviour ?
> > If yes, that's could be solution (using some noise functions additionaly).
>
> Possibly.
> How would you get the translation value from the noise function?

<f_noise(x,y,z),f_noise(y,z,x),f_noise(y,z,x)> ?

ABX


Post a reply to this message

From: TinCanMan
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:40:34
Message: <3d2eea62$1@news.povray.org>
"W³odzimierz ABX Skiba" <abx### [at] babilonorg> wrote in message
news:i8qtiusukna1bkaftjqee1nekhildarvqe@4ax.com...
> On Fri, 12 Jul 2002 10:23:11 -0400, "TinCanMan"
<Tin### [at] hotmailcom>
> wrote:
> > > Can you use user defined functions to recreate turbulence behaviour ?
> > > If yes, that's could be solution (using some noise functions
additionaly).
> >
> > Possibly.
> > How would you get the translation value from the noise function?
>
> <f_noise(x,y,z),f_noise(y,z,x),f_noise(y,z,x)> ?
>
> ABX

Hmm, I'll try this out.

After reading more into how turbulence works I don't think there is a simple
solution to this.  Turbulence works by grabbing a value *from* the
turbulated location rather than moving the point *to* a turbulated location.

-tgq


Post a reply to this message

From:
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:43:47
Message: <ejqtiu85qkheglkr0pucrpsj3p4jdvi3gd@4ax.com>
On Fri, 12 Jul 2002 10:36:16 -0400, "TinCanMan" <Tin### [at] hotmailcom>
wrote:
>
> Thanks, but it appears to be the opposite of what I want (if I understand
> turbulence properly).  The vector returned by vturbulence() for pt A is the
> original vector of the point that is essentially now located at A rather
> than where the point that was originally at A is now.

I'm affraid it will be the same in my solution. What you are looking for is
bidirectional (reversable) turbulence (noise). I have looked for this kind if
noise at the time when I was working on deform patch. I passed but perhaps you
will find it.

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:50:11
Message: <3D2EECA2.BFD1426@gmx.de>
"Włodzimierz ABX Skiba" wrote:
> 
> It can be wrong solution when you want displace geometry instead of vector as
> for displacement in isosurfaces.

I think TinCanMan only wanted to translate a sphere.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 30 Jun. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christoph Hormann
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 10:50:57
Message: <3D2EECCD.B8486BA8@gmx.de>
TinCanMan wrote:
> 
> > Have a look at the 'vturbulence()' function.
> 
> Thanks, but it appears to be the opposite of what I want (if I understand
> turbulence properly).  The vector returned by vturbulence() for pt A is the
> original vector of the point that is essentially now located at A rather
> than where the point that was originally at A is now.

Have you tried it?

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 30 Jun. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Rune
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 11:20:26
Message: <3d2ef3ba@news.povray.org>
Christoph Hormann wrote:
> TinCanMan wrote:
>>
>>> Have a look at the 'vturbulence()' function.
>>
>> Thanks, but it appears to be the opposite of what I want (if I
>> understand turbulence properly).  The vector returned by
>> vturbulence() for pt A is the original vector of the point that is
>> essentially now located at A rather than where the point that was
>> originally at A is now.
>
> Have you tried it?

Well, it's pointless.

Turbulence in textures work backwards, so a turbulated texture can have
the same point turbulated to two or more locations. The vturbulence
function works forward and thus is incompatible with turbulence in
textures, and naturally a function can not return more than one result.

However, for very small amounts of turbulence, the results for forward
and backwards turbulence may be close enough that they won't be spotted
(because turbulence directions change gradually).

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com (updated July 12)
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From:
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 11:28:40
Message: <64ttius804jeuqbge1mk749nddg8ekrbte@4ax.com>
On Fri, 12 Jul 2002 16:50:53 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
>
> Have you tried it?

If I would everything fine then tehere should be crossection at the center of
square.

#local Amount  = 0.5;
#local Lambda  = 1.5;
#local Omega   = 0.8;
#local Octaves = 5.0;
#local Frequency = 3;
#local P=<0,0,0>;
#local P=P+Amount*vturbulence(Lambda,Omega,Octaves,P*Frequency);
box{
  P-<.1,.1,0> P+<.1.1.1>
  pigment{
    checker color blue 1 color red 1
    turbulence Amount
    lambda Lambda
    omega Omega
    octaves Octaves
    frequency Frequency
  }
  finish{ambient 1 diffuse 0}
  translate -P
  translate z
}

ABX


Post a reply to this message

From: TinCanMan
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 11:33:55
Message: <3d2ef6e3@news.povray.org>
> TinCanMan wrote:
> >
> > > Have a look at the 'vturbulence()' function.
> >
> > Thanks, but it appears to be the opposite of what I want (if I
understand
> > turbulence properly).  The vector returned by vturbulence() for pt A is
the
> > original vector of the point that is essentially now located at A rather
> > than where the point that was originally at A is now.
>
> Have you tried it?
>
> Christoph

Yes, and it didn't work.
I couldn't get the function method to work either so I think I'm S.O.L.
As Rune pointed out, the problem with turbulence and vturbulence is that, by
the nature of the way they work, a single point can be turbulated to more
than one point. Turbulence doesn't move pt A by x,y,z but rather uses the
point x,y,z away at the location of A.

-tgq


Post a reply to this message

From: Christoph Hormann
Subject: Re: Translate by turbulence
Date: 12 Jul 2002 12:14:25
Message: <3D2F0061.4D884FD0@gmx.de>
TinCanMan wrote:
> 
> [...]
> 
> Yes, and it didn't work.
> I couldn't get the function method to work either so I think I'm S.O.L.
> As Rune pointed out, the problem with turbulence and vturbulence is that, by
> the nature of the way they work, a single point can be turbulated to more
> than one point. Turbulence doesn't move pt A by x,y,z but rather uses the
> point x,y,z away at the location of A.

I know it isn't a precise solution of your problem, but as ABX pointed out
it can't be solved easily because you can't reverse turbulence.  You can
try to iteratively approximate the solution and thereby gain better
results.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 30 Jun. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: TinCanMan
Subject: Re: Translate by turbulence (Yay! I've done it!)
Date: 12 Jul 2002 21:10:14
Message: <3d2f7df6$1@news.povray.org>
Hooray! I macroed myself a method to translate by turbulence!
I don't guarantee how well this works, especially for large turbulence
values, but it will work for what I want to do.  Thanks to Christoph for
pointing me to vturbulence() which was the key to making it work.

-tgq

Have a try at the following scene and play with the numbers if you want to
see it in action.  The translated sphere is raised off the plane a bit
because of y direction turbulence.
//start
camera{
  up y
  right x*image_width/image_height
  angle 45
  location <30,30,-30>
  look_at 0
}

light_source{y*1000 rgb 1}

#declare tTurb=0.50;
#declare tLamb=1.2;
#declare tOcta=5;
#declare tOmeg=0.25;

plane{y 0
  pigment{checker rgb 1 rgb 0
    translate -y/2
    warp{
      turbulence tTurb
      octaves tOcta
      lambda tLamb
      omega tOmeg
    }
    scale 20
  }
}

//P0 = Point to translate
//Acc = Accuracy
#macro turb_translate (tTurb,tOcta,tLamb,tOmeg,P0,Acc)
  #local PC=P0;
  #local Dir=<0,0,0>;
  #local V0=vlength(vturbulence(tLamb, tOmeg, tOcta, P0)*tTurb);
  #local Step=V0/2;
  #macro AB(PC,Step,d,Dir,V0)
    #local P1=PC+Step*d;
    #local V1=vlength(P1+vturbulence(tLamb, tOmeg, tOcta, P1)*tTurb-P0);
    #if (V1<V0 | d.x=1)
      #local Dir=d;
      #local V0=V1;
    #end
  #end
  #while (V0>Acc)
    #local DrP=Dir;
    AB(PC,Step, x,Dir,V0)
    AB(PC,Step,-x,Dir,V0)
    AB(PC,Step, y,Dir,V0)
    AB(PC,Step,-y,Dir,V0)
    AB(PC,Step, z,Dir,V0)
    AB(PC,Step,-z,Dir,V0)
    #if (vlength(DrP+Dir)=0)
      #local Step=Step/2;
    #else
      #local Step=V0/2;
    #end
    #local PC=PC+Step*Dir;
  #end
  PC
#end

#declare TPt=<0,0,0>;
sphere{TPt 1 pigment{rgb <1,0,0>}}
sphere{0 1 pigment{rgb <1,0,0>} translate
turb_translate(tTurb,tOcta,tLamb,tOmeg,TPt,0.001)*20}
//end


Post a reply to this message

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