z-depth render pass normalize option?

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
User avatar
Herbert123
Mitglied
Posts: 1763
Joined: Sat 12 May 2012 21:38

z-depth render pass normalize option?

Post by Herbert123 » Sun 12 May 2019 00:09

I'd like to request an option to normalize the values of a z-depth rendered pass to a range of 0-1 (meaning the full range of values of a given depth mode).

I now resort to either the Optimize HDR or Exposure adjustments, but the first one will not always work well, and with neither one is it possible to quickly discover the minimum and maximum values easily. So often I have to open Blender, and use its normalize node to fix this, which is inconvenient when you're working on a comp. So it would be great if either someone could tell me if a normalize option is already present in PhotoLine (I looked, could not find an equivalent function), or if this could be implemented somehow.

Here are two examples I prepped together. In the cathedral example (z-depth2.pld) the z-depth pass is used as a mask for the mist effect, and I used the Optimize HDR adjustment to create a visible depth mask, which I use to add camera depth blur and restrict the mist towards the end of the hall.

However, in the second Star Trek example, this will not work. The values are ranged too wide, I think. I can use the Exposure effect, but it is very hard to control, and ideally we just want to normalize the depth values to the 32bit/16bit/8bit range and map the z-depth values to 0-1m which in 8 bit mode this would mean 0-255 greyscale values, in 16bit mode 65536 values, and in 32bit 2,147,483,647 values, and then use the other adjustments to further process it.

Now, unless I am mistaken, a "Normalize" option isn't available in PhotoLine? If so, would it be difficult to add that somewhere as an option? For example, in the Tool-->Color-->Normalize as a menu option? That would be incredibly helpful for anyone wanting to use depth masks in PhotoLine.

Here are the two examples:
http://www.wizzydev.com/uploads/z-depth.pld
http://www.wizzydev.com/uploads/z-depth2.pld
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

User avatar
Herbert123
Mitglied
Posts: 1763
Joined: Sat 12 May 2012 21:38

Re: z-depth render pass normalize option?

Post by Herbert123 » Sun 12 May 2019 08:32

Here is a screenshot of Blender's Normalize node and how it affects the z-depth channel/layer in an EXR file:
S0xyr.jpg
You do not have the required permissions to view the files attached to this post.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

bkh
Betatester
Posts: 3611
Joined: Thu 26 Nov 2009 22:59

Re: z-depth render pass normalize option?

Post by bkh » Sun 12 May 2019 14:40

Isn‘t automatic histogram correction what you are looking for?

Cheers

Burkhard

User avatar
Herbert123
Mitglied
Posts: 1763
Joined: Sat 12 May 2012 21:38

Re: z-depth render pass normalize option?

Post by Herbert123 » Sun 12 May 2019 23:03

Unfortunately, no. It will not work with a depth channel.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

bkh
Betatester
Posts: 3611
Joined: Thu 26 Nov 2009 22:59

Re: z-depth render pass normalize option?

Post by bkh » Wed 15 May 2019 08:15

Sorry, only had a chance to look at your samples now (in fact, only the first sample).

The problem (specific to 32 bit depth maps) is that the values in your depth map are outside the usual 0...1 range (32 bit values are floats, not 32 bit integers, btw.). In your example, the depth image seems to contain true depth information ranging from 0 to (near) infinity. So an ordinary "normalize" would map infinity to 1 and everything else to 0, probably not what you want.

Instead, you'll want to apply a transformation, something like x ↦ x/(x+1), easily achievable using PL's layer blend mode, to get the data into the usual 0...1 range. Maybe Blender's "normalize" does something like that under the hood. Once the data is in that range, you can use histogram correction.

Cheers

Burkhard

User avatar
Gerhard Huber
Entwickler
Entwickler
Posts: 3600
Joined: Mon 18 Nov 2002 15:30
Location: Bad Gögging

Re: z-depth render pass normalize option?

Post by Gerhard Huber » Wed 15 May 2019 13:01

that's the problem.
So I changed the function in Optimize HDR to ignore infintiy values. So you can see the 2. max Value in the curve window and enter this value in the border field to get an 0...1 image (in Beta 14).

User avatar
Herbert123
Mitglied
Posts: 1763
Joined: Sat 12 May 2012 21:38

Re: z-depth render pass normalize option?

Post by Herbert123 » Wed 15 May 2019 17:15

Many thanks, it works great now. This is a great addition for dealing with those z-depth render passes.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

User avatar
Herbert123
Mitglied
Posts: 1763
Joined: Sat 12 May 2012 21:38

Re: z-depth render pass normalize option?

Post by Herbert123 » Sat 18 May 2019 09:09

Hmm, I wonder: does PhotoLine have a Lensblur equivalent to create a convincing looking depth of field effect with a z-depth map?

Using a blur effect won't work.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait