POV-Ray : Newsgroups : povray.unofficial.patches : f_output_depth non-linear - but what? : Re: f_output_depth non-linear - but what? Server Time
23 Apr 2024 22:00:05 EDT (-0400)
  Re: f_output_depth non-linear - but what?  
From: Paco
Date: 21 Sep 2009 09:25:01
Message: <web.4ab77dd35c107e41ea2377910@news.povray.org>
"Paco" <nomail@nomail> wrote:
> I've been trying to get depth information from a scene using both the raw
> f_output_depth feature as well as the PP_Depth macro. Here are some of the
> samples:
>
> Actual depth      pixel value
> 25                     35
> 50                     53
> 100                    72
> 150                    88
>
> This is based on using a depth range of 0->1500
>
> This is obviously non-linear - but not referenced anywhere in the documentation
> and I can't find it via google. Does anyone know how the conversion from the
> actual distance from the camera to the object is converted into a value in
> f_output_depth???

After many, many hours of pouring through the source code for both POV and
megaPOV I found it - bloody gamma correction. Don't know if it's a bug but it
would be nice to turn it off in post-processing somehow.

x' = 255* (x/max)^ (1/gamma)

assuming that min_dist=0.

You can pre-correct for it by using something like:

post_process {
    function { pow(f_output_depth(x,y)/depth_max_disp,2.2) }
    function { pow(f_output_depth(x,y)/depth_max_disp,2.2) }
    function { pow(f_output_depth(x,y)/depth_max_disp,2.2) }
    function { 1 }
    save_file "depth.bmp"
  }


Post a reply to this message

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