POV-Ray : Newsgroups : povray.newusers : Pigment colour from RGB functions : Re: Pigment colour from RGB functions Server Time
2 Jun 2024 10:17:54 EDT (-0400)
  Re: Pigment colour from RGB functions  
From: waggy
Date: 20 May 2013 14:15:01
Message: <web.519a67c283779f7f21be1230@news.povray.org>
scott wrote:
> I started by writing 3 functions to calculate the R G and B components,
> but then I got stuck trying to combine them in the pigment part of an
> object. What's the best way to do this?
>
> I want to write this:
>
> pigment{color rgb <functionR,functionG,functionB>}

I don't know if this is the best way, but this is what I do.

#local P_R=pigment{
  function{functionR(x,y,z)}
  color_map{[0,rgb<0,0,0>][1,rgb<5,0,0>]}
};
#local P_R=pigment{
  function{functionG(x,y,z)}
  color_map{[0,rgb<0,0,0>][1,rgb<0,5,0>]}
};
#local P_R=pigment{
  function{functionB(x,y,z)}
  color_map{[0,rgb<0,0,0>][1,rgb<0,0,5>]}
};
#local P_F=pigment{
  function{functionF(x,y,z)}
  color_map{[0,rgbf<0,0,0,0>][1,rgbf<0,0,0,5>]}
};
#local P_T=pigment{
  function{functionT(x,y,z)}
  color_map{[0,rgbt<0,0,0,0>][1,rgbt<0,0,0,5>]}
};
pigment{
  average
  pigment_map{[1,P_R][1,P_G][1,P_B][1,P_F][1,P_T]}
}

If you eliminate both the filter and transmit parts, change the 5s to 3s.

I hope this helps.


Post a reply to this message

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