POV-Ray : Newsgroups : povray.newusers : declared patterns without pigments ( rvalue ) Server Time
22 Dec 2024 00:47:35 EST (-0500)
  declared patterns without pigments ( rvalue ) (Message 1 to 6 of 6)  
From: Mr
Subject: declared patterns without pigments ( rvalue )
Date: 1 Jan 2014 14:35:00
Message: <web.52c46d118bb7cd1d56a4f3390@news.povray.org>
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?


Post a reply to this message

From: clipka
Subject: Re: declared patterns without pigments ( rvalue )
Date: 1 Jan 2014 15:58:19
Message: <52c4816b@news.povray.org>
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".


Post a reply to this message

From: Mr
Subject: Re: declared patterns without pigments ( rvalue )
Date: 4 Jan 2014 16:05:00
Message: <web.52c8769f84c18776a63b69b00@news.povray.org>
clipka <ano### [at] anonymousorg> 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.


Post a reply to this message

From: clipka
Subject: Re: declared patterns without pigments ( rvalue )
Date: 4 Jan 2014 16:17:47
Message: <52c87a7b$1@news.povray.org>
Am 04.01.2014 22:01, schrieb Mr:
> clipka <ano### [at] anonymousorg> 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

From: Thorsten Froehlich
Subject: Re: declared patterns without pigments ( rvalue )
Date: 4 Jan 2014 16:45:01
Message: <web.52c8807784c187767f6553270@news.povray.org>
"Mr" <nomail@nomail> wrote:
> 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?

You can use a pattern function, i.e.:

#declare foo = function {
   pattern {
     checker
   }
 }

 #declare MyNormal = normal {
     function { foo(x,y,z) }
}

You find it at the end of section "2.2.1.6.3 Declaring User-Defined Float
Functions" in http://www.povray.org/documentation/view/3.6.1/231/ .


Post a reply to this message

From: Mr
Subject: Re: declared patterns without pigments ( rvalue )
Date: 5 Jan 2014 16:20:01
Message: <web.52c9cc4584c18776416484130@news.povray.org>
"Thorsten Froehlich" <nomail@nomail> wrote:
> "Mr" <nomail@nomail> wrote:
> > 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?
>
> You can use a pattern function, i.e.:
>
> #declare foo = function {
>    pattern {
>      checker
>    }
>  }
>
>  #declare MyNormal = normal {
>      function { foo(x,y,z) }
> }
>
> You find it at the end of section "2.2.1.6.3 Declaring User-Defined Float
> Functions" in http://www.povray.org/documentation/view/3.6.1/231/ .

Thanks to both of you. it works.


Post a reply to this message

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