POV-Ray : Newsgroups : povray.advanced-users : How to trace() and evaluate colour of CSG object? : Re: How to trace() and evaluate colour of CSG object? Server Time
28 Sep 2024 06:10:06 EDT (-0400)
  Re: How to trace() and evaluate colour of CSG object?  
From: Alain
Date: 2 Nov 2010 14:42:50
Message: <4cd05baa$1@news.povray.org>
Le 2010-11-02 07:43, none a écrit :
> 2010-11-02 11:49, Le_Forgeron skrev:
>>>> But notice that the "colour" that a laser-scanner would get would in
>>>> fact be the level of reflected laser-beam in the ray direction.
>>>
>>> Yes, that's true. But in this case I actually do want the pigment of the
>>> object that is hit by the ray, and not a simulation of the remission of
>>> the laser beam, so you can actually disregard the application I
>>> described. Sorry for the confusion.
>>
>> Do you want to know the pigment of the object as seen from the camera of
>> the scanner, or really the pigment of the object (independently of the
>> lightning condition ?)
>
> I want to know the pigment of the object, independent of any lighting.
>
> Actually, what I really want is to know which object the ray hit. I just
> imagine that using different pigments for different objects and looking
> at the pigment at the end of each ray would be an easy way to accomplish
> that.
>
> I just thought of another workaround to accomplish what I want. Given an
> array of objects, I can trace() a ray to each of them and only consider
> the closest hit. That would take care of occlusions.
For that, you can use v_length() and retain the one with the smallest 
value. Start with a large test value, like 1e9.
>
> Thanks a lot for your effort to help!

Do trace against the union. Then, do an eval_pigment() against the 
pigment of the object, including any transform applied after the texture.

That way, you find the first intersection point, then you evaluate the 
texture at that point, ignoring any lighting and finish.
You may still need to test against the individual objects if the various 
components have different textures, and test for the one that returns 
the same coordinates and normal as the trace against the whole union.



Alain


Post a reply to this message

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