POV-Ray : Newsgroups : povray.unofficial.patches : f_output_depth non-linear - but what? Server Time: 28 Feb 2020 01:35:04 GMT
  f_output_depth non-linear - but what? (Message 1 to 4 of 4)  
From: Paco
Subject: f_output_depth non-linear - but what?
Date: 21 Sep 2009 09:45:00
Message: <web.4ab74a31bf54fa92ea2377910@news.povray.org>
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???


Post a reply to this message

From: Paco
Subject: Re: f_output_depth non-linear - but what?
Date: 21 Sep 2009 13: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

From: clipka
Subject: Re: f_output_depth non-linear - but what?
Date: 21 Sep 2009 14:15:42
Message: <4ab78a8e$1@news.povray.org>
Paco schrieb:
> 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.

How about the assumed_gamma and Display_Gamma settings, or the 
Gamma_Correct() macro?


Post a reply to this message

From: Paco
Subject: Re: f_output_depth non-linear - but what?
Date: 22 Sep 2009 00:35:01
Message: <web.4ab818ae5c107e41ea2377910@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Paco schrieb:
> > 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.
>
> How about the assumed_gamma and Display_Gamma settings, or the
> Gamma_Correct() macro?

Thanks for the suggestion. Ideally I'd like to have gamma correction for the
colour image, but disable it for the depth image. I guess I could render them
separately with and without gamma but the above works fine.

It may be worth putting a sentence in the documentation about gamma correction
affecting the depth output in post processing because to me at least this is not
obvious.


Post a reply to this message

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