POV-Ray : Newsgroups : povray.general : Function based patterns ... value returned from function ... : Re: Function based patterns ... value returned from function ... Server Time
2 Aug 2024 04:17:38 EDT (-0400)
  Re: Function based patterns ... value returned from function ...  
From: Mike Williams
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

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