POV-Ray : Newsgroups : povray.advanced-users : Pigment functions... : Re: Pigment functions... Server Time
6 Oct 2024 13:38:40 EDT (-0400)
  Re: Pigment functions...  
From: Samuel Benge
Date: 9 Sep 2006 16:39:41
Message: <4503268d@news.povray.org>
Orchid XP v3 wrote:
> Fact: POV-Ray can use an image as a pigment.
> Fact: POV-Ray can use a pigment as a function.
> Fact: POV-Ray can use a function as a pigment.
> 
> In spite of the above, I can't seem to get POV-Ray to load an image as a 
> pigment, turn the pigment into a function, and then turn the function 
> back into a pigment again. (I want to **** around with the coordinates.)
> 
> Any hints?

Does this help? It's approximated using the default assumed_gamma, and 
may not be perfect, but it's a start:

#declare img =
  pigment{
   image_map{
    png"povmap.png"
   }
   scale<320,200,1>/320
  }

#declare f_img =
function{
  pigment{ img }
}

#declare option_1 = // no color
  pigment{
   function{ f_img(x,y,z).grey }
  }

#declare option_2 = // approximated colors
  pigment{
   average
   pigment_map{
    [1 function{ f_img(x,y,z).x } color_map{[0 rgb 0][1 rgb x*1.55]} ]
    [1 function{ f_img(x,y,z).y } color_map{[0 rgb 0][1 rgb y*1.55]} ]
    [1 function{ f_img(x,y,z).z } color_map{[0 rgb 0][1 rgb z*1.55]} ]
   }
  }

plane{z,0
  pigment{option_2}
  finish{ambient 1}
}


Post a reply to this message

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