POV-Ray : Newsgroups : povray.general : using eval_pigment--some questions before starting : Re: using eval_pigment--some questions before starting Server Time
30 Jul 2024 02:28:52 EDT (-0400)
  Re: using eval_pigment--some questions before starting  
From: Anthony D  Baye
Date: 1 Feb 2010 18:40:01
Message: <web.4b67650980570be678de8d60@news.povray.org>
eval_pigment returns a color-vector.

the following is an excerpt from my LED macros:
#macro Display(mS, tS, mD, Image)
#declare mI =
pigment {
 image_map {
  jpeg Image
  map_type 0
  interpolate 4
  once
  }
  translate <-0.5, -0.5, 0.0>
  scale <mS.u, mS.v, 1>
  rotate 90.0*x
 }
#local a = mS.u / tS.u;
#local b = mS.v / tS.v;
#local bO = cylinder { -0.125*y, 0.015625*y, 1.875*ft }

#local rC = 0.0*b;
#while(rC <= 1.0*b)
 #local tC = 0.0*a;
 #while(tC <= 1.0*a)
//#if(inside(bO, <(-mS.u/2)+(tS.u*tC), 0.0, (-mS.v/2)+(tS.v*rC)>) != 0.0)

#local Color = eval_pigment(mI, <(-mS.u/2)+(tS.u*tC), 0.0,
(-mS.v/2)+(tS.v*rC)>);
#local Shade = (
 Color.red +
 Color.green +
 Color.blue ) / 3 ;

#local rS = Color.red ;
#local gS = Color.green ;
#local bS = Color.blue ;
 ColorBlock(rS, gS, bS, transform { translate <(-mS.u/2)+(tS.u*tC), mD,
(-mS.v/2)+(tS.v*rC)> })

// Diode(0, Red, Shade, transform { translate <(-mS.u/2)+(tS.u*tC), -mD,
(-mS.v/2)+(tS.v*rC)> })
//#end
 #local tC = tC + 1;
 #end
#local rC = rC + 1;
#end
#end

The macro turns an image into a mosaic of tiles containing three colored LEDs
and sets the Diode shades to the value of the rgb components.

I assume the vector is three values, I haven't seen any indication that
eval_pigment takes an alpha channel into account.

A.D.B.
"Kenneth" <kdw### [at] earthlinknet> wrote:
> OK, my curiosity has finally reached the point where I want to start playing
> around with eval_pigment.  But a few questions first (perhaps naive ones) so
> that I don't end up guessing at the results:
>
> 1) Does it return specifically a COLOR vector (i.e., does POV-ray treat the
> result as such internally, as another pigment); or just a 'generic' vector, with
> no color information implied? (The manner in which it is returned has
> consequences if I want to pull just one component out of the vector later, using
> dot notation--see 3.2.1.5.5 "common color pitfalls" in the docs.)
> 2) How many components are in the returned vector--3 or 5?
>
> Thanks!
>
> Ken


Post a reply to this message

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