|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
1) How can I know the pigment/color of a given object ?
2) What is the format of a pigment variable ? How can I extract each
component ?
Regards
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
<use### [at] domaininvalid> wrote in message news:49aa8650$1@news.povray.org...
> Hi,
> 1) How can I know the pigment/color of a given object ?
Hi,
Objects can be multicoloured. POV-Ray pigments can define complex colour
patterns. The colour of an object is determined by the pigment assigned to
that object at the particular location on the object you're interested in.
The eval_pigment function can used to 'read' that colour from any pigment
that you've assigned to an identifier.
> 2) What is the format of a pigment variable ? How can I extract each
> component ?
Pigments can be assigned to identifiers in the standard way. You can use
eval_pigment to determine the colour at a specific location in the pigment.
The color value returned by the eval_pigment function is a standard rgb
colour value. You can index individual RGB colour components using the
identifier suffixes red, green and blue. So something like:
#declare MyPigment = pigment {rgb <0.1,0.2,0.3>}
#declare MyLocation = <1,2,3>;
#declare MyColour = eval_pigment(MyPigment,MyLocation);
#debug concat("Red: ",str(MyColour.red,3,3),"Green:
",str(MyColour.green,3,3),"Blue: ",str(MyColour.blue,3,3),"\n")
Note, I didn't try running this, so keep your eyes open for syntax errors.
The colour you'll actually get in the rendered image can clearly be very
different due to many factors, including the colours of any lights and other
factors controlling the texture applied to the object.
Regards,
Chris B.
ps. It's more usual to see this sort of question on povray.newusers than on
povray.advanced-users.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 1) How can I know the pigment/color of a given object ?
By remembering what you set it to ;)
> 2) What is the format of a pigment variable ? How can I extract each
> component ?
You cannot access the components of a pigment variable (as it may be a pattern)
[*]; however, you can access the r, g and b components of a color variable as
MyColor.x, MyColor.y and MyColor.z, respectively. Similarly, the filter
component can be retrieved as MyColor.t (sic!), while the transmit component
is, to my knowledge, not accessible.
The background behind this is that colors are treated as 5D-vectors, and that
the .x, .y and .z operators work not only on 3D vectors, but on vectors of any
(sufficiently high) dimension; the same goes for the .t operator which was
designed to access the 4th component of a 4D vector, probably originally
intended to represent time (hence the t; ironically, the 4th dimension in a
color vector is the filter component, not the transmit component).
(There are two more such operators, .u and .v, which can be used instead of .x
and .y if desired.)
[* okay, this is not exactly true; in fact you can use a pigment variable in a
pigment function, allowing you to retrieve the color at a given point...]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <nom### [at] nomailcom> wrote:
> The eval_pigment function can used to 'read' that colour from any pigment
> that you've assigned to an identifier.
Hum... I live and learn...
> > 2) What is the format of a pigment variable ? How can I extract each
> > component ?
>
> Pigments can be assigned to identifiers in the standard way. You can use
> eval_pigment to determine the colour at a specific location in the pigment.
> The color value returned by the eval_pigment function is a standard rgb
> colour value. You can index individual RGB colour components using the
> identifier suffixes red, green and blue. So something like:
.... and this likewise. So I bet there are .transmit and .filter suffixes
likewise?
> ps. It's more usual to see this sort of question on povray.newusers than on
> povray.advanced-users.
Hey, *I* didn't know these, and I wouldn't consider me a newbie these days ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"clipka" <nomail@nomail> wrote in message
news:web.49aaa0122533534f2ddf2a340@news.povray.org...
>> You can index individual RGB colour components using the
>> identifier suffixes red, green and blue. So something like:
>
> .... and this likewise. So I bet there are .transmit and .filter suffixes
> likewise?
Yes. Good guess :-)
The other one of interest is .gray which I guess averages out the rgb values
(I've never used it).
>
>> ps. It's more usual to see this sort of question on povray.newusers than
>> on
>> povray.advanced-users.
>
> Hey, *I* didn't know these, and I wouldn't consider me a newbie these days
> ;)
>
Well I never claimed everyone knew the answer :-)
The general tone of the question led me to think it might be a new user (or
at least someone new to the newsgroups) and povray.newusers quite often
attracts more gentle responses. Maybe I'm being over sentitive :o)
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"clipka" <nomail@nomail> wrote in message
news:web.49aa9eec2533534f2ddf2a340@news.povray.org...
>
> you can use a pigment variable in a
> pigment function, allowing you to retrieve the color at a given point...]
>
In fact I think that's how the eval_pigment macro works. If you have a lot
of points that you need to check it's probably more efficient to define your
own function once, because calling eval_pigment would redefine the function
each time.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hi,
> 1) How can I know the pigment/color of a given object ?
> 2) What is the format of a pigment variable ? How can I extract each
> component ?
>
> Regards
thanks you all for all your answers.
I might have been more precise in my question.
Given an object, how can I know its color at a given point ?
I was thinking of a function getColor(obj,position), something like
min_extent(obj), for example.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
<use### [at] domaininvalid> wrote in message news:49aaae1a$1@news.povray.org...
>> Hi,
>> 1) How can I know the pigment/color of a given object ?
>> 2) What is the format of a pigment variable ? How can I extract each
>> component ?
>>
>> Regards
> thanks you all for all your answers.
> I might have been more precise in my question.
> Given an object, how can I know its color at a given point ?
> I was thinking of a function getColor(obj,position), something like
> min_extent(obj), for example.
>
You can assign the pigment to an identifier. Use the identifier to assign
the pigment to the object and use the same pigment identifier with the
eval_pigment macro to establish the color at a position of your choosing.
You can certainly use the min_extent function to retrieve a location if
that's the position that you want to evaluate.
You should make sure you don't transform the object after assigning the
declared pigment to it.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
use### [at] domaininvalid wrote:
> I might have been more precise in my question.
> Given an object, how can I know its color at a given point ?
> I was thinking of a function getColor(obj,position), something like
> min_extent(obj), for example.
As far as I know you can't. You can, however, remember the pigment you assigned
to the object, and use that eval_pigment() macro Chris mentioned.
The *apparent* color of an object as seen from point P, however, is yet another
story: You simply cannot do that, as it depends on lighting conditions and - if
the object has a reflective or refractive material - other objects nearby. You'd
need to set up a complete scene, trace it, and use the resulting image in a
pattern function to retrieve individual pixels from it for your main shot.
Is there something specific you intend to do? Maybe there's a different way to
achieve the desired results.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
>> Hi,
>> 1) How can I know the pigment/color of a given object ?
>> 2) What is the format of a pigment variable ? How can I extract each
>> component ?
>>
>> Regards
>
> thanks you all for all your answers.
> I might have been more precise in my question.
> Given an object, how can I know its color at a given point ?
> I was thinking of a function getColor(obj,position), something like
> min_extent(obj), for example.
>
>
the problem, is that, as the object is passed as an argument to a macro,
I have no a priori idea of its color...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|