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