POV-Ray : Newsgroups : povray.general : Reading a colour on an object Server Time
24 Dec 2024 07:36:57 EST (-0500)
  Reading a colour on an object (Message 1 to 8 of 8)  
From: Thomas de Groot
Subject: Reading a colour on an object
Date: 11 Nov 2014 10:36:25
Message: <54622cf9$1@news.povray.org>
I am suddenly not sure. Is it possible to read a colour at a defined 
point - using trace() - on the surface of an object, by using 
eval_pigment() at that point? I know how to do it with an image_map as 
intermediary but can it be done directly?

For instance, if object{A} has a texture{B} and trace() finds a position 
P=<x,y,z> on the surface of A, would the colour at P then be 
D=eval_pigment(A,P) ? That obviously does not work as A is not a 
pigment. However, I would like to do something like that but do not know 
how.

Thomas


Post a reply to this message

From: Nekar Xenos
Subject: Re: Reading a colour on an object
Date: 11 Nov 2014 11:49:54
Message: <op.xo56ddzdufxv4h@xena.home>
On Tue, 11 Nov 2014 17:36:22 +0200, Thomas de Groot <tho### [at] degrootorg>  
wrote:

> I am suddenly not sure. Is it possible to read a colour at a defined  
> point - using trace() - on the surface of an object, by using  
> eval_pigment() at that point? I know how to do it with an image_map as  
> intermediary but can it be done directly?
>
> For instance, if object{A} has a texture{B} and trace() finds a position  
> P=<x,y,z> on the surface of A, would the colour at P then be  
> D=eval_pigment(A,P) ? That obviously does not work as A is not a  
> pigment. However, I would like to do something like that but do not know  
> how.
>
> Thomas
>

It would be wonderful if it worked on uv-mapped meshes as well :)

-- 
-Nekar Xenos-


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Reading a colour on an object
Date: 11 Nov 2014 12:05:01
Message: <web.5462417fa4f9ea0062d177fa0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> I am suddenly not sure. Is it possible to read a colour at a defined
> point - using trace() - on the surface of an object, by using
> eval_pigment() at that point? I know how to do it with an image_map as
> intermediary but can it be done directly?
>
> For instance, if object{A} has a texture{B} and trace() finds a position
> P=<x,y,z> on the surface of A, would the colour at P then be
> D=eval_pigment(A,P) ? That obviously does not work as A is not a
> pigment. However, I would like to do something like that but do not know
> how.
>
> Thomas

Since Trace only returns the point of intersection and the normal vector, and
there's really no way to query object attributes, the best I'd think you could
do is pass the intersection Point and the pigment to eval_pigment...

Although... You might get more information from a function.   It's worth
investigating.

Regards,
A.D.B.


Post a reply to this message

From: MichaelJF
Subject: Re: Reading a colour on an object
Date: 11 Nov 2014 12:35:01
Message: <web.546247d7a4f9ea00ca410ea00@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
 > Thomas
>
> Since Trace only returns the point of intersection and the normal vector, and
> there's really no way to query object attributes, the best I'd think you could
> do is pass the intersection Point and the pigment to eval_pigment...
>
> Although... You might get more information from a function.   It's worth
> investigating.
>
> Regards,
> A.D.B.

That would be of help in very simple situations only. First the object must have
a pigment only and not a more complicated texture or worse an uv-mapping. Second
you must invert all transformations applied to the object after coloring it.

I can understand the wish by Thomas since one can e.g. plant grass of different
length at the object depending on the color - just a stupid idea. In fact I used
color maps, which can be evaluated with eval_pigment, sometimes to determine the
kind of vegetation in a landscape with a corresponding shape.

May be it is possible to implement it into the trace()-statement as a third
return value, but this issue and the effort necessary I cannot judge.

Best regards,
Michael


Post a reply to this message

From: Bald Eagle
Subject: Re: Reading a colour on an object
Date: 11 Nov 2014 17:30:01
Message: <web.54628cfea4f9ea005e7df57c0@news.povray.org>
I searched around a bit, but didn't seem to find much of use.
There was some mention of coupling trace with eval_pigment, but I didn't see any
code or elaboration on that idea...

What's an "object pigment"?
It seemed to be something along the lines of

pigment {object {Something} }

Is / was that some sort of experimental thing / MegaPov?

Maybe LeForgeron knows a way to do this - he's got a ton of clever stuff that he
works on...

POV-Ray obviously needs to work with just such information in order to generate
the rendered image.   I wonder if there's a way to patch into that, or write a
separate object property querying function...  y'know, for 4.0....


Post a reply to this message

From: Alain
Subject: Re: Reading a colour on an object
Date: 11 Nov 2014 19:13:15
Message: <5462a61b$1@news.povray.org>

> I searched around a bit, but didn't seem to find much of use.
> There was some mention of coupling trace with eval_pigment, but I didn't see any
> code or elaboration on that idea...
>
> What's an "object pigment"?
> It seemed to be something along the lines of
>
> pigment {object {Something} }
>
> Is / was that some sort of experimental thing / MegaPov?
>
> Maybe LeForgeron knows a way to do this - he's got a ton of clever stuff that he
> works on...
>
> POV-Ray obviously needs to work with just such information in order to generate
> the rendered image.   I wonder if there's a way to patch into that, or write a
> separate object property querying function...  y'know, for 4.0....
>
>

object pigment is a block pigment, in a way, similar to checker. It 
demand 2 pigments or textures: The first to be used inside the reference 
object, and the second to be used outside.
It's used on an object larger than the controll object.
A use would be to add some text to an object, that text been controled 
by a text object. You can then use a warp to have that text warp around 
some object.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Reading a colour on an object
Date: 12 Nov 2014 03:10:38
Message: <546315fe$1@news.povray.org>
On 11-11-2014 18:31, MichaelJF wrote:
> "Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
>   > Thomas
>>
>> Since Trace only returns the point of intersection and the normal vector, and
>> there's really no way to query object attributes, the best I'd think you could
>> do is pass the intersection Point and the pigment to eval_pigment...
>>
>> Although... You might get more information from a function.   It's worth
>> investigating.
>>
>> Regards,
>> A.D.B.
>
> That would be of help in very simple situations only. First the object must have
> a pigment only and not a more complicated texture or worse an uv-mapping. Second
> you must invert all transformations applied to the object after coloring it.
>
> I can understand the wish by Thomas since one can e.g. plant grass of different
> length at the object depending on the color - just a stupid idea. In fact I used
> color maps, which can be evaluated with eval_pigment, sometimes to determine the
> kind of vegetation in a landscape with a corresponding shape.

Yes, that is what I generally do too and it works fine. My question in 
fact derives from that usage and a solution would be a smart addition 
but I am afraid it is not really possible.

>
> May be it is possible to implement it into the trace()-statement as a third
> return value, but this issue and the effort necessary I cannot judge.

Yes, that would be the logical thing indeed.

Thomas


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Reading a colour on an object
Date: 15 Nov 2014 21:12:19
Message: <54680803$1@news.povray.org>
On 12.11.2014 9:10, Thomas de Groot wrote:

>> May be it is possible to implement it into the trace()-statement as a
>> third
>> return value, but this issue and the effort necessary I cannot judge.
>
> Yes, that would be the logical thing indeed.

it's not quite the same thing, but the camera_view pigment
in MegaPOV might help in some cases.


Post a reply to this message

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