POV-Ray : Newsgroups : povray.general : Rays path Length Server Time
31 Oct 2024 10:23:33 EDT (-0400)
  Rays path Length (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Motive17
Subject: Rays path Length
Date: 10 Jan 2018 06:20:01
Message: <web.5a55f6861559a83fe278d3b70@news.povray.org>
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

From: Kontemplator
Subject: Re: Rays path Length
Date: 10 Jan 2018 08:20:00
Message: <web.5a561217f3020183659f6d40@news.povray.org>
"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(V2-V1).


Post a reply to this message

From: Bald Eagle
Subject: Re: Rays path Length
Date: 10 Jan 2018 08:45:01
Message: <web.5a5617daf3020183c437ac910@news.povray.org>
"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(V2-V1).

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

From: Motive17
Subject: Re: Rays path Length
Date: 10 Jan 2018 08:50:01
Message: <web.5a561958f3020183e278d3b70@news.povray.org>
"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(V2-V1).

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

From: clipka
Subject: Re: Rays path Length
Date: 10 Jan 2018 10:48:51
Message: <5a5635e3$1@news.povray.org>
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 function-based 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(x-xC,y-yC,z-zC) +
        FnDist(x-xL,y-yL,z-zL)
    }
    #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 distance-based 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

From: Motive17
Subject: Re: Rays path Length
Date: 12 Jan 2018 08:55:01
Message: <web.5a58bdc7f3020183e278d3b70@news.povray.org>
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 function-based 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(x-xC,y-yC,z-zC) +
>         FnDist(x-xL,y-yL,z-zL)
>     }
>     #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 distance-based 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(x-xC,y-yC,z-zC) +
         FnDist(x-xL,y-yL,z-zL)

what do they represent for POV-ray?

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

From: Bald Eagle
Subject: Re: Rays path Length
Date: 12 Jan 2018 10:05:01
Message: <web.5a58ce75f3020183c437ac910@news.povray.org>
"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(x-xC,y-yC,z-zC) +
>          FnDist(x-xL,y-yL,z-zL)
>
> what do they represent for POV-ray?

They are the x,y, and z values of the point in space that POV-Ray 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

From: clipka
Subject: Re: Rays path Length
Date: 12 Jan 2018 12:41:29
Message: <5a58f349@news.povray.org>
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(x-xC,y-yC,z-zC) +
>          FnDist(x-xL,y-yL,z-zL)
> 
> what do they represent for POV-ray?

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 distance-based 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

From: Alain
Subject: Re: Rays path Length
Date: 12 Jan 2018 16:20:11
Message: <5a59268b@news.povray.org>
Le 18-01-12 à 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 function-based 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(x-xC,y-yC,z-zC) +
>>          FnDist(x-xL,y-yL,z-zL)
>>      }
>>      #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 distance-based 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(x-xC,y-yC,z-zC) +
>           FnDist(x-xL,y-yL,z-zL)
> 
> what do they represent for POV-ray?
> 
> 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

From: Motive17
Subject: Re: Rays path Length
Date: 15 Jan 2018 06:30:00
Message: <web.5a5c9064f3020183e278d3b70@news.povray.org>
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(x-xC,y-yC,z-zC) +
> >          FnDist(x-xL,y-yL,z-zL)
> >
> > what do they represent for POV-ray?
>
> 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 distance-based 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(x-xC,y-yC,z-zC) +
          FnDist(x-xL,y-yL,z-zL)
                               }
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

Goto Latest 10 Messages Next 3 Messages >>>

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