POV-Ray : Newsgroups : povray.general : Function based patterns ... value returned from function ... Server Time
5 Nov 2024 16:40:28 EST (-0500)
  Function based patterns ... value returned from function ... (Message 1 to 6 of 6)  
From: Neil Kolban
Subject: Function based patterns ... value returned from function ...
Date: 18 Jan 2005 23:21:15
Message: <41ede03b$1@news.povray.org>
Folks,
I was having a go at updating our wiki on an area I am studying ... function 
based patterns ...

http://www.wikipov.org/ow.asp?FunctionBasedPatterns

As I started writing what I thought I knew, a question struck me that I 
think I need some help with.

If I declare a function foo(x,y,z) ... then this function is going to return 
a float calculated from x, y and z.

And this is where I get confused ...

If the value returned is between 0 and 1 .... 0.0 <= value <= 1.0 then I see 
how that can be applied to a color map to generate an appropriate color. 
But what about values outside of the color map range ... what of values < 
0.0 and > 1.0 ... how do they get mapped to a color value?

I am going to guess that the integer portion is thrown away ... but that is 
a guess ...

so

2.73   -> 0.73
199.2 -> 0.2
-56.6 -> 0.6

But this is a guess ...

Neil


Post a reply to this message

From: Slime
Subject: Re: Function based patterns ... value returned from function ...
Date: 18 Jan 2005 23:52:42
Message: <41ede79a$1@news.povray.org>
> I am going to guess that the integer portion is thrown away ... but that
is
> a guess ...

Pretty much. One of your examples was wrong:

> -56.6 -> 0.6

-56.6 -> 0.4

Use the equation x - floor(x).

(Although I think 1.0 maps to 1.0, so x - floor(x) might not be exactly
accurate.)

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


Post a reply to this message

From: Warp
Subject: Re: Function based patterns ... value returned from function ...
Date: 19 Jan 2005 05:54:31
Message: <41ee3c67@news.povray.org>
Neil Kolban <kol### [at] kolbancom> wrote:
> But what about values outside of the color map range ... what of values < 
> 0.0 and > 1.0 ... how do they get mapped to a color value?

  Why don't you simply test it?

  AFAIK pattern values beyond those limits get clipped. That is, everything
larger than 1 is converted to 1 and everything smaller than 0 is converted
to 0.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Alain
Subject: Re: Function based patterns ... value returned from function ...
Date: 19 Jan 2005 06:00:59
Message: <41ee3deb$1@news.povray.org>
Neil Kolban nous apporta ses lumieres en ce 2005-01-18 23:21:
> Folks,
> I was having a go at updating our wiki on an area I am studying ... function 
> based patterns ...
> 
> http://www.wikipov.org/ow.asp?FunctionBasedPatterns
> 
> As I started writing what I thought I knew, a question struck me that I 
> think I need some help with.
> 
> If I declare a function foo(x,y,z) ... then this function is going to return 
> a float calculated from x, y and z.
> 
> And this is where I get confused ...
> 
> If the value returned is between 0 and 1 .... 0.0 <= value <= 1.0 then I see 
> how that can be applied to a color map to generate an appropriate color. 
> But what about values outside of the color map range ... what of values < 
> 0.0 and > 1.0 ... how do they get mapped to a color value?
> 
> I am going to guess that the integer portion is thrown away ... but that is 
> a guess ...
> 
> so
> 
> 2.73   -> 0.73
> 199.2 -> 0.2
> -56.6 -> 0.6
> 
> But this is a guess ...
> 
> Neil 
> 
> 
I think that you'll have to use some math to reduce it to the 0..1 range. Values over
1 or under 0 
will show as 1 or 0 in a normal scene. The colours <1,234.2,-0,5> and <1,1,0> render
the same. If 
you use radiosity, it can have a big effect on your results.

Alain


Post a reply to this message

From: Mike Williams
Subject: Re: Function based patterns ... value returned from function ...
Date: 19 Jan 2005 08:49:12
Message: <445GyHAJVm7BFwjB@econym.demon.co.uk>
Wasn't it Alain who wrote:
>Neil Kolban nous apporta ses lumieres en ce 2005-01-18 23:21:
>> Folks,
>> I was having a go at updating our wiki on an area I am studying ... function 
>> based patterns ...
>> 
>> http://www.wikipov.org/ow.asp?FunctionBasedPatterns
>> 
>> As I started writing what I thought I knew, a question struck me that I 
>> think I need some help with.
>> 
>> If I declare a function foo(x,y,z) ... then this function is going to return 
>> a float calculated from x, y and z.
>> 
>> And this is where I get confused ...
>> 
>> If the value returned is between 0 and 1 .... 0.0 <= value <= 1.0 then I see 
>> how that can be applied to a color map to generate an appropriate color. 
>> But what about values outside of the color map range ... what of values < 
>> 0.0 and > 1.0 ... how do they get mapped to a color value?
>> 
>> I am going to guess that the integer portion is thrown away ... but that is 
>> a guess ...
>> 
>> so
>> 
>> 2.73   -> 0.73
>> 199.2 -> 0.2
>> -56.6 -> 0.6
>> 
>> But this is a guess ...
>> 
>> Neil 
>> 
>> 
>I think that you'll have to use some math to reduce it to the 0..1 range. Values 
>over 1 or under 0 
>will show as 1 or 0 in a normal scene. The colours <1,234.2,-0,5> and <1,1,0> 
>render the same. If 
>you use radiosity, it can have a big effect on your results.

Colours and pattern values are different things. Pattern values get
reduced into the range 0 - 1 for you before being converted into
colours.

It's easy to test that these two boxes are identical, and remain
identical if you add the same colour_map to them.

box {-1,1 pigment { function {0.4}}}

box {-1,1 pigment { function {-56.6}}
  translate x*2.1
}






-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Function based patterns ... value returned from function ...
Date: 19 Jan 2005 14:49:33
Message: <41eeb9cd@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

http://www.povray.org/documentation/view/3.6.1/404/

	Jerome
- --
******************************
*      Jerome M. Berger      *
* mailto:jbe### [at] ifrancecom *
*  http://jeberger.free.fr/  *
******************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB7rnMqIYJdJhyixIRAv91AJ40CDq+f7ctXchvMh3tiS329XWFhgCgrKTK
d8SiZP8o2ZHFzH1bZ2CPCjU=
=a9VU
-----END PGP SIGNATURE-----


Post a reply to this message

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