POV-Ray : Newsgroups : povray.newusers : pigments <-> functions Server Time
24 Nov 2024 09:00:15 EST (-0500)
  pigments <-> functions (Message 1 to 4 of 4)  
From: William Tracy
Subject: pigments <-> functions
Date: 5 Apr 2009 16:56:21
Message: <49d91af5$1@news.povray.org>
Okay. I'm newly returning to Pov, and this is a stupid simple question, 
so I figure I can post this under "new users". :-P

I can create a user-defined function from a pigment. Is it possible to 
create a pigment from a function? The documentation isn't clear to me, 
but seems to say "no".

-- 
William Tracy
afi### [at] gmailcom -- wtr### [at] calpolyedu

(09:52:19 PM) _markt: well, nobody's ever accused me of being normal
(09:52:28 PM) dkirker: _markt: you are normal
     -- seen on #cplug


Post a reply to this message

From: clipka
Subject: Re: pigments <-> functions
Date: 5 Apr 2009 17:45:00
Message: <web.49d9239ac2ee1ba768105bc50@news.povray.org>
William Tracy <wtr### [at] calpolyedu> wrote:
> Okay. I'm newly returning to Pov, and this is a stupid simple question,
> so I figure I can post this under "new users". :-P
>
> I can create a user-defined function from a pigment. Is it possible to
> create a pigment from a function? The documentation isn't clear to me,
> but seems to say "no".

You can use a function as a pattern (see "3.5.11.15  Function as pattern") and
therefore, in some sense, as a pigment; however, to use a *pigment* function as
a pigment again, preserving all colors, you will probably have to do some
trickery, like:

pigment {
  average
  pigment_map {
    [ 1
      function { myFunc(x,y,z).red }
      color_map {
        [ 0 color red*0 ]
        [ 1 color red*3 ]
      }
    ]
    [ 1
      function { myFunc(x,y,z).green }
      color_map {
        [ 0 color green*0 ]
        [ 1 color green*3 ]
      }
    ]
    [ 1
      function { myFunc(x,y,z).blue }
      color_map {
        [ 0 color blue*0 ]
        [ 1 color blue*3 ]
      }
    ]
  }
}


Post a reply to this message

From: Jim Charter
Subject: Re: pigments <-> functions
Date: 6 Apr 2009 19:29:25
Message: <49da9055@news.povray.org>
William Tracy wrote:
> Okay. I'm newly returning to Pov, and this is a stupid simple question, 
> so I figure I can post this under "new users". :-P
> 
> I can create a user-defined function from a pigment. Is it possible to 
> create a pigment from a function? The documentation isn't clear to me, 
> but seems to say "no".
> 

Just to cover one base ...
http://www.econym.demon.co.uk/isotut/pigfun.htm


Post a reply to this message

From: Alain
Subject: Re: pigments <-> functions
Date: 7 Apr 2009 13:51:16
Message: <49db9294$1@news.povray.org>
Jim Charter nous illumina en ce 2009-04-06 19:29 -->
> William Tracy wrote:
>> Okay. I'm newly returning to Pov, and this is a stupid simple 
>> question, so I figure I can post this under "new users". :-P
>>
>> I can create a user-defined function from a pigment. Is it possible to 
>> create a pigment from a function? The documentation isn't clear to me, 
>> but seems to say "no".
>>
> 
> Just to cover one base ...
> http://www.econym.demon.co.uk/isotut/pigfun.htm
For any function based on a pigment that don't have a colour_map, using .x .y or 
.z is essentialy the same as .gray, but faster as you don't compute the 
ponderated average of the tree colour chanels.

In the sample that use the obion and leopard patterns, using .x (or .red, .y, 
.z, .green, .blue) would render the same.
wood, agate and bozo have an internal colour_map and need .gray.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you invented glasses that can be 
configured to use variable resolution (eg. 320x240, 640x480, etc.), with POV-Ray 
style switches for other effects (eg. anti-aliasing, radiosity, etc.)
Vimal N. Lad / Gautam N. Lad


Post a reply to this message

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