









 
 




 
 


Simple question:
do you know if there is a way for extracting the length of the rays path from
the light source until the camera?
Thank you in advance
Best regards
Post a reply to this message


 
 




 
 


"Motive17" <nomail@nomail> wrote:
> Simple question:
>
> do you know if there is a way for extracting the length of the rays path from
> the light source until the camera?
>
> Thank you in advance
>
> Best regards
try:
vlength(V)
Length of V. Returns a float value that is the length of vector V. Formula is
vlength=sqrt(vdot(A,A)). Can be used to compute the distance between two points.
Dist=vlength(V2V1).
Post a reply to this message


 
 




 
 


"Kontemplator" <haf### [at] yahoocom> wrote:
> try:
>
> vlength(V)
> Length of V. Returns a float value that is the length of vector V. Formula is
> vlength=sqrt(vdot(A,A)). Can be used to compute the distance between two points.
> Dist=vlength(V2V1).
I think he wants the overall length of a ray  not just straight from the light
source, but after reflections, etc.
Post a reply to this message


 
 




 
 


"Kontemplator" <haf### [at] yahoocom> wrote:
> "Motive17" <nomail@nomail> wrote:
> > Simple question:
> >
> > do you know if there is a way for extracting the length of the rays path from
> > the light source until the camera?
> >
> > Thank you in advance
> >
> > Best regards
>
> try:
>
> vlength(V)
> Length of V. Returns a float value that is the length of vector V. Formula is
> vlength=sqrt(vdot(A,A)). Can be used to compute the distance between two points.
> Dist=vlength(V2V1).
Yes, you are right, I know this tool but I'd want the length of the entire ray
path hitting an object of the scene.
Post a reply to this message


 
 




 
 


Am 10.01.2018 um 12:18 schrieb Motive17:
> Simple question:
>
> do you know if there is a way for extracting the length of the rays path from
> the light source until the camera?
If there is only one light source involved, you /could/ use a special
pigment for the objects in your scene that sums up the distance between
the surface and the camera plus the distance between the surface and the
light source.
Use a functionbased pigment, with a function constructed like this:
#declare FnDist = function(x,y,z) { sqrt(x*x + y*y + z*z) }
#declare Fn = function(x,y,z) {
FnDist(xxC,yyC,zzC) +
FnDist(xxL,yyL,zzL)
}
#declare P = pigment {
function { Fn(x,y,z)/MaxDistance }
}
where <xC,yC,zC> is the location of the camera, <xL,yL,zL> is the
location of the light source, and MaxDistance is the maximum total
distance you want to be able to handle properly.
Then choose a finish that gives full brightness whenever the surface is
illuminated (regardless of incident light angle):
finish { ambient 0 diffuse 1 brilliance 0 }
Finally, set up the light source to have no distancebased attenuation
(i.e. use `fade_power 0`).
This should give you an output image where the brightness of each pixel
corresponds to the distance the light ray has travelled.
Make sure to use a high bit depth for the output image, and either use
linear encoding (`File_Gamma=1`) or be aware that your pixel values will
not correspond linearly to distance travelled.
Post a reply to this message


 
 




 
 


clipka <ano### [at] anonymousorg> wrote:
> Am 10.01.2018 um 12:18 schrieb Motive17:
> > Simple question:
> >
> > do you know if there is a way for extracting the length of the rays path from
> > the light source until the camera?
>
> If there is only one light source involved, you /could/ use a special
> pigment for the objects in your scene that sums up the distance between
> the surface and the camera plus the distance between the surface and the
> light source.
>
> Use a functionbased pigment, with a function constructed like this:
>
> #declare FnDist = function(x,y,z) { sqrt(x*x + y*y + z*z) }
> #declare Fn = function(x,y,z) {
> FnDist(xxC,yyC,zzC) +
> FnDist(xxL,yyL,zzL)
> }
> #declare P = pigment {
> function { Fn(x,y,z)/MaxDistance }
> }
>
> where <xC,yC,zC> is the location of the camera, <xL,yL,zL> is the
> location of the light source, and MaxDistance is the maximum total
> distance you want to be able to handle properly.
>
> Then choose a finish that gives full brightness whenever the surface is
> illuminated (regardless of incident light angle):
>
> finish { ambient 0 diffuse 1 brilliance 0 }
>
> Finally, set up the light source to have no distancebased attenuation
> (i.e. use `fade_power 0`).
>
>
> This should give you an output image where the brightness of each pixel
> corresponds to the distance the light ray has travelled.
>
>
> Make sure to use a high bit depth for the output image, and either use
> linear encoding (`File_Gamma=1`) or be aware that your pixel values will
> not correspond linearly to distance travelled.
Thank you for the reply. This could be a very interesting approach.
Maybe a trivial question but...about the values x,y,z in the definition of the
function Fn:
Fn = function(x,y,z) {
FnDist(xxC,yyC,zzC) +
FnDist(xxL,yyL,zzL)
what do they represent for POVray?
I was thinking I could introduce a such function directly as a light attenuation
function in the definition of light source.
What do you think about?
Post a reply to this message


 
 




 
 


"Motive17" <nomail@nomail> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> Thank you for the reply. This could be a very interesting approach.
>
> Maybe a trivial question but...about the values x,y,z in the definition of the
> function Fn:
>
> Fn = function(x,y,z) {
> FnDist(xxC,yyC,zzC) +
> FnDist(xxL,yyL,zzL)
>
> what do they represent for POVray?
They are the x,y, and z values of the point in space that POVRay is evaluating
the function for.
"By default a function takes three parameters and you do not have to explicitly
specify the parameter names. The default three parameters are x, y and z. For
example:
#declare foo = function { x + y * z }
If you need fewer or more parameters you have to explicitly specify the
parameter list."
Post a reply to this message


 
 




 
 


Am 12.01.2018 um 14:53 schrieb Motive17:
> Maybe a trivial question but...about the values x,y,z in the definition of the
> function Fn:
>
> Fn = function(x,y,z) {
> FnDist(xxC,yyC,zzC) +
> FnDist(xxL,yyL,zzL)
>
> what do they represent for POVray?
They represent the x, y and z coordinates for whatever point the pigment
based on the funciton is evaluated for.
> I was thinking I could introduce a such function directly as a light attenuation
> function in the definition of light source.
>
> What do you think about?
That wouldn't fly: The distancebased attenuation of light sources only
affects the brightness based on the distance between the light source
and the surface. The distance between the surface and the camera isn't
affecting the brightness at all.
Post a reply to this message


 
 




 
 


Le 180112 Ã 08:53, Motive17 a Ã©critÂ :
> clipka <ano### [at] anonymousorg> wrote:
>> Am 10.01.2018 um 12:18 schrieb Motive17:
>>> Simple question:
>>>
>>> do you know if there is a way for extracting the length of the rays path from
>>> the light source until the camera?
>>
>> If there is only one light source involved, you /could/ use a special
>> pigment for the objects in your scene that sums up the distance between
>> the surface and the camera plus the distance between the surface and the
>> light source.
>>
>> Use a functionbased pigment, with a function constructed like this:
>>
>> #declare FnDist = function(x,y,z) { sqrt(x*x + y*y + z*z) }
>> #declare Fn = function(x,y,z) {
>> FnDist(xxC,yyC,zzC) +
>> FnDist(xxL,yyL,zzL)
>> }
>> #declare P = pigment {
>> function { Fn(x,y,z)/MaxDistance }
>> }
>>
>> where <xC,yC,zC> is the location of the camera, <xL,yL,zL> is the
>> location of the light source, and MaxDistance is the maximum total
>> distance you want to be able to handle properly.
>>
>> Then choose a finish that gives full brightness whenever the surface is
>> illuminated (regardless of incident light angle):
>>
>> finish { ambient 0 diffuse 1 brilliance 0 }
>>
>> Finally, set up the light source to have no distancebased attenuation
>> (i.e. use `fade_power 0`).
>>
>>
>> This should give you an output image where the brightness of each pixel
>> corresponds to the distance the light ray has travelled.
>>
>>
>> Make sure to use a high bit depth for the output image, and either use
>> linear encoding (`File_Gamma=1`) or be aware that your pixel values will
>> not correspond linearly to distance travelled.
>
>
> Thank you for the reply. This could be a very interesting approach.
>
> Maybe a trivial question but...about the values x,y,z in the definition of the
> function Fn:
>
> Fn = function(x,y,z) {
> FnDist(xxC,yyC,zzC) +
> FnDist(xxL,yyL,zzL)
>
> what do they represent for POVray?
>
> I was thinking I could introduce a such function directly as a light attenuation
> function in the definition of light source.
>
> What do you think about?
>
>
The x, y, z are world centric, with the point <0,0,0> as the origin.
When evaluating a function, for say, an isosurface or a pigment, it's
the current point been tested.
Post a reply to this message


 
 




 
 


clipka <ano### [at] anonymousorg> wrote:
> Am 12.01.2018 um 14:53 schrieb Motive17:
>
> > Maybe a trivial question but...about the values x,y,z in the definition of the
> > function Fn:
> >
> > Fn = function(x,y,z) {
> > FnDist(xxC,yyC,zzC) +
> > FnDist(xxL,yyL,zzL)
> >
> > what do they represent for POVray?
>
> They represent the x, y and z coordinates for whatever point the pigment
> based on the funciton is evaluated for.
>
>
> > I was thinking I could introduce a such function directly as a light attenuation
> > function in the definition of light source.
> >
> > What do you think about?
>
> That wouldn't fly: The distancebased attenuation of light sources only
> affects the brightness based on the distance between the light source
> and the surface. The distance between the surface and the camera isn't
> affecting the brightness at all.
In order to be more clear I'll write down some details...
I was thinking to define this function, based on your advices :
#declare FnDist = function(x,y,z) { sqrt(x*x + y*y + z*z) }
#declare Fn = function(x,y,z) {
FnDist(xxC,yyC,zzC) +
FnDist(xxL,yyL,zzL)
}
l
ight_source {
<0,0,0>
color rgb <255,255,255>*1/Fn
fade_distance 1
fade_power 0
media_interaction off
media_attenuation off
}
Unlickely, It doesn't fly.
I did not understand which is the reason in this case.
I cannot define a function in the definition of light source?
Post a reply to this message


 
 




 

