POV-Ray : Newsgroups : povray.general : Rays path Length : Re: Rays path Length Server Time
29 Apr 2024 07:44:56 EDT (-0400)
  Re: Rays path Length  
From: Alain
Date: 15 Jan 2018 11:08:38
Message: <5a5cd206$1@news.povray.org>
Le 18-01-15 à 06:28, Motive17 a écrit :
> 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)
>                                 }
> light_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.
That just can't work.
> I did not understand which is the reason in this case.
> I cannot define a function in the definition of light source?
Yes, but not to control how it behave.
You can use a function to place it or set it's base colour.
> 
> 
> 

That function, ANY function, need the (x,y,z) when invoked. You just 
don't need to explicitly set those when creating the function. You can 
plug in some constants instead of x, y or z.
Also, you'll get an undefined variable error if any of xC, yC, zC, xL, 
yL or zL is not previously defined.

Next, it can only set the colour of the light, not how it behave as it 
travel. It's the job of fade_power and fade_distance.

You need to set fade_power 2 to have realistic fading. Using fade_power 
0 effectively turn light fading OFF.


Post a reply to this message

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