z-depth render pass normalize option?

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2164
Registriert: Sa 12 Mai 2012 21:38

z-depth render pass normalize option?

Beitrag von Herbert123 »

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
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2164
Registriert: Sa 12 Mai 2012 21:38

Re: z-depth render pass normalize option?

Beitrag von Herbert123 »

Here is a screenshot of Blender's Normalize node and how it affects the z-depth channel/layer in an EXR file:
S0xyr.jpg
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
/*---------------------------------------------*/
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
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: z-depth render pass normalize option?

Beitrag von bkh »

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

Cheers

Burkhard
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2164
Registriert: Sa 12 Mai 2012 21:38

Re: z-depth render pass normalize option?

Beitrag von Herbert123 »

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
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: z-depth render pass normalize option?

Beitrag von bkh »

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
Benutzeravatar
Gerhard Huber
Entwickler
Entwickler
Beiträge: 4144
Registriert: Mo 18 Nov 2002 15:30
Wohnort: Bad Gögging

Re: z-depth render pass normalize option?

Beitrag von Gerhard Huber »

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).
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2164
Registriert: Sa 12 Mai 2012 21:38

Re: z-depth render pass normalize option?

Beitrag von Herbert123 »

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
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2164
Registriert: Sa 12 Mai 2012 21:38

Re: z-depth render pass normalize option?

Beitrag von Herbert123 »

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