| 
  | 
Dear Povray experts
For my application of POV-ray I need to extract the travelled distance for all
rays falling in the camera. I have tried to extract the distance by making use
of the attenuation equation given in the manual as
Attenuation = 1 / (1 + (distance/fade_distance)^fade_power)
My idea was to take a blue and a red light source, one without any fading and
the other with a fade_power and fade_distance
The ratio between Red and Blue intensity should give me the attenuation, from
which I can then derive the travelled distance of each ray.
This work wonderfully well in case the fade_distance is equal to the look_to
point of the camera. However, for all shorter and longer distances the trick
does not work and does not give good results.
My question is: is there an other way to get the distance from the travelled
rays? Can I extract the distance variable for instance ? It should be there
because the attenuation euqation makes use of it.
any hints appreciated.
Many thinks
Eelco
 
 Post a reply to this message 
 | 
  | 
 | 
  | 
> My idea was to take a blue and a red light source, one without any fading and
> the other with a fade_power and fade_distance
>
> The ratio between Red and Blue intensity should give me the attenuation, from
> which I can then derive the travelled distance of each ray.
>
> This work wonderfully well in case the fade_distance is equal to the look_to
> point of the camera. However, for all shorter and longer distances the trick
> does not work and does not give good results.
You might get better results by rendering with a white light - once 
without attentuation and another render with attenuation. The reason 
being that HDR formats (I assume you are outputing to an HDR image 
format for better precision) IIRC only store a "magnitude" for each 
pixel, so if red and green are vastly different trying to calculate the 
ratio will have a large error.
 
 Post a reply to this message 
 | 
  | 
 | 
  | 
Am 20.02.2015 um 16:17 schrieb eelcovv:
> Dear Povray experts
>
> For my application of POV-ray I need to extract the travelled distance for all
> rays falling in the camera. I have tried to extract the distance by making use
> of the attenuation equation given in the manual as
>
> Attenuation = 1 / (1 + (distance/fade_distance)^fade_power)
>
> My idea was to take a blue and a red light source, one without any fading and
> the other with a fade_power and fade_distance
>
> The ratio between Red and Blue intensity should give me the attenuation, from
> which I can then derive the travelled distance of each ray.
>
> This work wonderfully well in case the fade_distance is equal to the look_to
> point of the camera. However, for all shorter and longer distances the trick
> does not work and does not give good results.
That's a bit odd, and maybe just coincidence: The fade_power / 
fade_distance mechanism is entirely separate from the camera look_at 
mechanism.
Can you be more specific in what way the trick "does not work" and "does 
not give good results"?
Also note that the fade_power / fade_distance mechanism only affects the 
rays from the light source to the first object surface, not those 
between the object and the camera.
> My question is: is there an other way to get the distance from the travelled
> rays? Can I extract the distance variable for instance ? It should be there
> because the attenuation euqation makes use of it.
MegaPOV provided a postprocessing mechanism that you could use to access 
the distance from the camera to the object surface (the first one hit, 
if reflection or refraction is involved).
The same can be achieved by assigning an emission-only finish to all 
objects, with a spherical pigment pattern varying in brightness with 
distance from the camera.
If you need information about the entire distance from light source via 
object surface to camera, try media instead of distance-based light 
attenuation; absorbing media follows a straightforward exponential rule, 
and should be easy enough to compute.
Also, you might want to use "brilliance 0" in the finish; this causes 
illuminated surfaces to appear equally bright regardless of the angle of 
incidence, which saves you the hassle of setting up one colour channel 
for reference.
 
 Post a reply to this message 
 | 
  |