POV-Ray : Newsgroups : povray.advanced-users : Finding Pigment / color of an object Server Time
3 Jul 2024 05:58:38 EDT (-0400)
  Finding Pigment / color of an object (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: user
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 10:47:38
Message: <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.


Post a reply to this message

From: Chris B
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 11:11:12
Message: <49aab3a0$1@news.povray.org>
<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

From: clipka
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 11:25:00
Message: <web.49aab6602533534f2ddf2a340@news.povray.org>
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

From: user
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 12:07:40
Message: <49aac0dc@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.
> 
>     
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

From: clipka
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 12:30:00
Message: <web.49aac5ff2533534f2ddf2a340@news.povray.org>
use### [at] domaininvalid wrote:
> the problem, is that, as the object is passed as an argument to a macro,
> I have no a priori idea of its color...

Then, unfortunately, you are lost. Unless you can convince the user to pass the
pigment as a separate parameter.


Post a reply to this message

From: Alain
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 17:15:57
Message: <49ab091d$1@news.povray.org>
use### [at] domaininvalid nous illumina en ce 2009-03-01 10:47 -->
> use### [at] domaininvalid a écrit :
>> 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 use the trace function to find a point at the surface of an object. If 
you have a texture identifier associated to that object, you can then use 
eval_pigment to get the pigment at that location.

Be wary that if you translate, rotate or scale the object after you assign it 
the texture, the texture will get transformed with the object, but the texture 
evaluated by eval_pigment wont. So, it's best to evaluate the pigment before any 
transformations. The other way, is to trace to an invert transformed point.

-- 
Alain
-------------------------------------------------
When you can't tell the difference between satire and what your opposition 
actually believes, its about time to have a good laugh at it all


Post a reply to this message

From: Kenneth
Subject: Re: Finding Pigment / color of an object
Date: 1 Mar 2009 20:50:01
Message: <web.49ab3a082533534ff50167bc0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:

>
> The other one of interest is .gray which I guess averages out the rgb values
> (I've never used it).
>

The .gray 'averaging' scheme seems to be full of black magic and voodoo. I've
lately been trying to figure out just *how* it produces its values (armed with
the only formula found in the docs, at "HF_Gray_16"...which offers no real hint
of the underlying computations.) But I'll leave that question for a later post
of its own. All in all, very mysterious!

KW


Post a reply to this message

From: Thomas de Groot
Subject: Re: Finding Pigment / color of an object
Date: 2 Mar 2009 03:03:19
Message: <49ab92c7$1@news.povray.org>
"clipka" <nomail@nomail> schreef in bericht 
news:web.49aaa0122533534f2ddf2a340@news.povray.org...
> "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...
>

It is great to place objects on a surface using a pre-defined image_map to 
determine where you want to put what. For instance, you can write a macro 
like this one:

#macro EvalPig3x(Map,Pos,Object1,Object2,Object3)
  #local Shade = eval_pigment(Map,<Pos.x,0,Pos.z>);
  #if (Shade.red  = 1)
    object {
      Object1
      translate Pos
    }
  #end
  #if (Shade.green = 1)
    object {
      Object2
      translate Pos
    }
  #end
  #if (Shade.blue = )
    object {
      Object3
      translate Pos
    }
  #end
#end


Thomas


Post a reply to this message

From: Bill Pragnell
Subject: Re: Finding Pigment / color of an object
Date: 2 Mar 2009 05:20:01
Message: <web.49abb2852533534f6dd25f0b0@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> > The other one of interest is .gray which I guess averages out the rgb values
> > (I've never used it).
>
> The .gray 'averaging' scheme seems to be full of black magic and voodoo. I've
> lately been trying to figure out just *how* it produces its values (armed with
> the only formula found in the docs, at "HF_Gray_16"...which offers no real hint
> of the underlying computations.) But I'll leave that question for a later post
> of its own. All in all, very mysterious!

The isosurface tutorial page mentions it:

gray value = Red*29.7% + Green*58.9% + Blue*11.4%

and gives a more thorough run-down on colour dot operators. Look here:

http://www.povray.org/documentation/view/3.6.1/73/

and scroll down to 1.3.3.3.7 - "Pigment and noise functions".

Bill


Post a reply to this message

From: Kenneth
Subject: Re: Finding Pigment / color of an object
Date: 3 Mar 2009 09:30:01
Message: <web.49ad3ed52533534ff50167bc0@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:

> The isosurface tutorial page mentions it:
>
> gray value = Red*29.7% + Green*58.9% + Blue*11.4%
>
> and gives a more thorough run-down on colour dot operators. Look here:
>
> http://www.povray.org/documentation/view/3.6.1/73/
>
> and scroll down to 1.3.3.3.7 - "Pigment and noise functions".
>


Thanks, didn't remember seeing it there.  The .hf operator is intriguing.
Hmm....

KW


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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