POV-Ray : Newsgroups : povray.general : Colour from single trace : Re: Colour from single trace Server Time
29 Apr 2024 11:29:15 EDT (-0400)
  Re: Colour from single trace  
From: Alain
Date: 11 Nov 2018 18:55:48
Message: <5be8c184$1@news.povray.org>
Le 18-11-11 à 05:02, Stephen a écrit :

> Option #2 is closer to what I would find useful. If “trace” also 
> returned the RGB* value of the uv image map at the point of intersection 
> of the object by trace. That would be usable.
> * Also filter and transmit values, if possible.
> 
> 
Trace return a coordinate, and optionally, a normal vector.
#declare Normal = <0,0,0>;
#declare Location = trace(Object, Origin, Direction, Normal );

«Location» will return the intersection point, or <0,0,0> if it miss the 
object and «Norm» will return the normal at the found point, or <0,0,0> 
if the object is missed.
Only testing the normal can reliably determine if the object is hit or not.

Next, you need to use eval_pigment() to get the pigment at the 
intersection point, using the transformed pigment of the target object.
If a layered texture is used for the object, then, you need to evaluate 
that layered texture. Better declare that texture and keep track of any 
transformation applied to the object after the texture is applied.

This will return the RGB value of the pigment at the found point.

This don't work for UV mapped textures as those are only defined at the 
surface. Same for aoi and slope patterns.
It WILL work for an image_map as it stretch infinitely along the Z axis.
It will also work for any map type as those are defined everywhere.

What you want is a trace that do use a fifth parameter to return the 
pigment at the found point. This is not possible now, and probably not 
in the short trem. Something like :
#declare Normal = <0,0,0>;
#declare Pigment = rgb 0;
#declare Location = trace(Object, Origin, Direction, Normal , Pigment );


Post a reply to this message

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