POV-Ray : Newsgroups : povray.advanced-users : Finding Pigment / color of an object : Re: Finding Pigment / color of an object Server Time
3 Jul 2024 05:25:33 EDT (-0400)
  Re: Finding Pigment / color of an object  
From: clipka
Date: 1 Mar 2009 09:45:00
Message: <web.49aa9eec2533534f2ddf2a340@news.povray.org>
> 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

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