POV-Ray : Newsgroups : povray.binaries.images : New Slime-POV feature: function warps Server Time
17 Nov 2024 00:16:17 EST (-0500)
  New Slime-POV feature: function warps (Message 1 to 10 of 10)  
From: Slime
Subject: New Slime-POV feature: function warps
Date: 26 Oct 2002 16:42:03
Message: <3dbafe1b@news.povray.org>
Well, tired as I am of working with this patch, I wanted to add one more
thing: function warps.

A function warp takes the (x,y,z) point where a pattern is currently being
evaluated, and lets you map it to a new point to evaluate the pattern at.
For example, the three images attached are X-Z planes with the following
pigments, respectively:

pigment {
 bozo
 color_map{[0 rgb 0][1 rgb 1]}
 warp { // this warp does nothing. It maps x to x, y to y, and z to z.
  function{x}
  function{y}
  function{z}
 }
}

pigment {
 bozo
 color_map{[0 rgb 0][1 rgb 1]}
 warp { // this warp does a little more. it maps x to x^2, y to y, and z to
e^z.
  function{x*x}
  function{y}
  function{exp(z)}
 }
}

pigment {
 bozo
 color_map{[0 rgb 0][1 rgb 1]}
 warp { // this warp creates a cool effect, since x,y, and z all effect a
random value that becomes the new x coordinate.
  function{f_noise3d(x,y,z)*10}
  function{y}
  function{z}
 }
}

I made this so that I could have more power over where a triangle mesh is
UV-mapped to. By UV-mapping a mesh to the region <0,0,0>,<1,1,0>, and then
warping that area of texture to, say, a sphere in space, the mesh has
effectively been "UV-mapped" to a sphere.

There are other uses, of course. =)

Oh, and I also might implement just *one* more feature... really, just one
more...

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message


Attachments:
Download 'functionwarp0.jpg' (10 KB) Download 'functionwarp1.jpg' (26 KB) Download 'functionwarp2.jpg' (21 KB)

Preview of image 'functionwarp0.jpg'
functionwarp0.jpg

Preview of image 'functionwarp1.jpg'
functionwarp1.jpg

Preview of image 'functionwarp2.jpg'
functionwarp2.jpg


 

From: Christoph Hormann
Subject: Re: New Slime-POV feature: function warps
Date: 26 Oct 2002 17:20:01
Message: <3DBB06CA.46F20232@gmx.de>
Slime wrote:
> 
> Well, tired as I am of working with this patch, I wanted to add one more
> thing: function warps.
> 
> [...]

IMO a function warp should have a somewhat different functionality, it
should work like a (type 0) displace warp in megapov.  This means it would
displace the pattern in the direction defined by the function(s).  See the
displace warp samples on my website: 

http://www-public.tu-bs.de:8080/~y0013390/pov/warp_b.html

for how this works.  While your version might be quite intuitive for
mapping purposes it's quite a bit more difficult to handle for random
functions like in your last sample.  

I remember such a feature has been discussed somewhere else before. 
Megapov had the very useful feature of displace warps and in 3.5 it would
be logical to use functions but instead of three float functions i would
rather use one vector function.  Why? - This could supply the
functionality of both the type 0 and type 1 displace warp if there is also
a new vector function calculating the gradient of a float function. 
Syntax could be something like:

function {
  gradient { fn_whatever(x, y, z) }
}

Another possible feature that would round up the whole thing is a warp
function of course.

Christoph

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


Post a reply to this message

From: Christopher James Huff
Subject: Re: New Slime-POV feature: function warps
Date: 26 Oct 2002 18:18:54
Message: <chrishuff-EDD180.18121126102002@netplex.aussie.org>
In article <3DBB06CA.46F20232@gmx.de>,
 Christoph Hormann <chr### [at] gmxde> wrote:

> I remember such a feature has been discussed somewhere else before. 
> Megapov had the very useful feature of displace warps and in 3.5 it would
> be logical to use functions but instead of three float functions i would
> rather use one vector function.  Why? - This could supply the
> functionality of both the type 0 and type 1 displace warp if there is also
> a new vector function calculating the gradient of a float function. 

Have you done much with POV functions? They only handle scalars. That's 
one big reason for my work on G.

If I understand it correctly, the outputs of the functions are the new 
coordinates of the point. It could very easily do both types of displace 
warps...it makes my displace patch obsolete. This is really what I 
wanted for a displace warp, but I couldn't figure out the old function 
code, pigments were the best I could do...

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: New Slime-POV feature: function warps
Date: 26 Oct 2002 18:19:59
Message: <chrishuff-D1E860.18131626102002@netplex.aussie.org>
In article <3dbafe1b@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> A function warp takes the (x,y,z) point where a pattern is currently being
> evaluated, and lets you map it to a new point to evaluate the pattern at.
> For example, the three images attached are X-Z planes with the following
> pigments, respectively:

If you make a version that uses a single vector function, like a pigment 
or transform function, it should work fine with the vector functions 
from my G patch...

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Slime
Subject: Re: New Slime-POV feature: function warps
Date: 26 Oct 2002 20:01:30
Message: <3dbb2cda@news.povray.org>
> IMO a function warp should have a somewhat different functionality, it
> should work like a (type 0) displace warp in megapov.  This means it would
> displace the pattern in the direction defined by the function(s).

> While your version might be quite intuitive for
> mapping purposes it's quite a bit more difficult to handle for random
> functions like in your last sample.

Well, that was the original intent: mapping. However, it could be used for
displacement as follows:

#declare displacementmap = pigment {
...
}
#declare displacementamount = 3;
warp {
    function{x+displacementmap(x,y,z).red*displacementamount }
    function{y+displacementmap(x,y,z).green*displacementamount }
    function{z+displacementmap(x,y,z).blue*displacementamount }
}

Unless I'm misunderstanding how the displacement maps work.

> Megapov had the very useful feature of displace warps and in 3.5 it would
> be logical to use functions but instead of three float functions i would
> rather use one vector function.

As the other Chris pointed out, POV-Ray doesn't support user defined vector
functions. If it did, that'd be great and I'd use them... but I'm not really
in the mood for implementing them right now =)

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Slime
Subject: Re: New Slime-POV feature: function warps
Date: 26 Oct 2002 20:03:19
Message: <3dbb2d47$1@news.povray.org>
> If you make a version that uses a single vector function, like a pigment
> or transform function, it should work fine with the vector functions
> from my G patch...


Hmm... it could possibly be done for pigments, I suppose. I'm not sure I'm
going to do it though.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Christoph Hormann
Subject: Re: New Slime-POV feature: function warps
Date: 27 Oct 2002 02:58:30
Message: <3DBB9CA6.EB63EC87@gmx.de>
Christopher James Huff wrote:
> 
> Have you done much with POV functions? They only handle scalars.

That's not a big problem, you can use the average pigment trick with a
pigment function to define a custom vector value function.

> If I understand it correctly, the outputs of the functions are the new
> coordinates of the point. It could very easily do both types of displace
> warps...it makes my displace patch obsolete. This is really what I
> wanted for a displace warp, but I couldn't figure out the old function
> code, pigments were the best I could do...

As i said i think using the function value(s) to define the amount and
direction of displacement seems way more intuitive than thinking in old
coordinates and new coordinates when it comes to random variation of
functions.  If everyone thinks the other functionality is better i can
live with that but i really don't think it would be easier for the
beginner.

With my proposal the type 1 displace warp would look like:

warp {
  function{
    gradient {
      fn_whatever(x, y, z)*multiplier
    }
  }
}

With Slime's current implementation you would have to use:

#declare fn_gradient = 
function {
  gradient {
    fn_whatever(x, y, z)*multiplier
  }
}

warp {
  function{x+fn_gradient(x,y,z).x }
  function{y+fn_gradient(x,y,z).y }
  function{z+fn_gradient(x,y,z).z }
}

And as you said you would need a vector function based version for your
special patch anyway.  

Christoph

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


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: New Slime-POV feature: function warps
Date: 27 Oct 2002 03:22:47
Message: <3dbba257@news.povray.org>
HI Slime

I've been watching your work with interest and I'm particularly excited
about the possiblities of this patch. Keep up the good work.

Mick


Post a reply to this message

From: ABX
Subject: Re: New Slime-POV feature: function warps
Date: 28 Oct 2002 04:30:46
Message: <kl0qru09eojkn20qvgj8strsotde35qrjm@4ax.com>
On Sat, 26 Oct 2002 18:12:11 -0400, Christopher James Huff <chr### [at] maccom>
wrote:
> Have you done much with POV functions? They only handle scalars.

You can be interested in last paragraph in
http://news.povray.org/3d6fb2ff%40news.povray.org

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: New Slime-POV feature: function warps
Date: 28 Oct 2002 09:02:58
Message: <chrishuff-7F6C34.08561928102002@netplex.aussie.org>
In article <kl0qru09eojkn20qvgj8strsotde35qrjm@4ax.com>,
 ABX <abx### [at] abxartpl> wrote:

> You can be interested in last paragraph in
> http://news.povray.org/3d6fb2ff%40news.povray.org

That doesn't change the fact that the current VM only handles float 
values for user-defined functions. That message doesn't apply to this 
patch at all, you can't write a patch using stuff that hasn't been 
written yet.
It does look like I misunderstood the original message though, it was 
talking about a gradient vector function that used a float function as 
input.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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