POV-Ray : Newsgroups : povray.advanced-users : Finding Pigment / color of an object Server Time
3 Jul 2024 05:38:59 EDT (-0400)
  Finding Pigment / color of an object (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
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 10 Messages Goto Initial 10 Messages

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