| 
  | 
Am 04.01.2014 22:01, schrieb Mr:
> clipka <ano### [at] anonymous org> wrote:
>> Am 01.01.2014 20:32, schrieb Mr:
>>> Hi, is there anyway to predeclare a pattern (preferably with its
>>> transformations) so that it can later be used equally within various normals or
>>> pigments?
>>>
>>> Up to now I only managed to declare it as the one or the other.
>>>
>>> or maybe there is a way to fit a declared pigment inside a normal{} block?
>>
>> You can use a so-called "pigment function" (a function that gets its
>> values from a pigment), and then use this function in a so-called
>> "function pattern".
>
> excuse me, but would you mind to post an example?  Didn't you rather mean use a
> pattern function inside a pigment instead of the opposite?
>
> the tricky thing is that a colormap is currently defined along with the pigment,
> I expected it to just get ignored if it's irrelevent to the normal statement or
> automatically converted to a grey scale.
You'll have to define the pigment with a linear greyscale color map, i.e.:
   #declare MyPigment = pigment {
     ...
     colour_map {
       [0 rgb 0]
       [1 rgb 1]
     }
   }
You then need to define a function based on that pigment (a so-called 
"pigment function"):
   #declare MyFn = function { pigment { MyPigment } }
Finally, you need to define a normal statement using this function as 
the pattern (a so-called "function pattern"):
   #declare MyNormal = normal {
     function { MyFn(x,y,z).gray }
     ...
   }
(Note that pigment functions are special in that they return a colour 
rather than a scalar value.)
 
 Post a reply to this message 
 | 
  |