Z Cam zlog2 workflow

Hi folks,

This is a topic about the cameras from Z Cam not the DRT :slight_smile: .
@yooofi came to me with the question how he could manage some footage from a Z Cam camera shot in zlog2 for compositing properly. After some back and forth we came to the conclusion that their tools are a bit weird. I’m not an image engineer but I think there are at least some big question marks so hope any of you can help me get more clarity on this.

On their website they provide the following assets.

  1. ACES page with example script for Nuke, a DCTL and a zlog2 to linear .cube LUT + zlog2 color to AP0 and AP1 .spimtx files.
    image

  2. A LUT page with a zip download containing conversion LUTs and an OFX plugin.
    image

The interesting part is they seem to use a .cube file to convert zlog2 to linear within 0-1 float.
They then scale this up by multiplying but it’s inconsistent and vaguely commented.

DCTL:

DEFINE_LUT(Zlog2ToLinear, ./zlog2_to_linear_4096.cube)

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
    float r = p_R;
    float g = p_G;
    float b = p_B;

// zlog2 to linear
    float3 res = APPLY_LUT(r, g, b, Zlog2ToLinear);

// gain factor for aces ap0, could adjust this factor according to the actual requirements
    r = res.x * 8.0f * 3.7f;
	g = res.y * 8.0f * 3.7f;
	b = res.z * 8.0f * 3.7f;

// zlog2 to acesap0
	res.x = 0.59268922f * r + 0.23980554f * g + 0.09364286f * b;
	res.y = 0.0078253f * r + 0.99994013f * g + (-0.07973914f) * b;
	res.z = 0.06103745f * r + (-0.24592234f) * g + 1.13939635f * b;
	
    return res;
}

So here they multiply by 8 and then again by 3.7 (why twice?).
However, in the Nuke example on the website it looks like a multiply of 7.416
The DCTL comment:

// gain factor for aces ap0, could adjust this factor according to the actual requirements

What is the idea behind this? Why change the exposure according to requirements? Shouldn’t this always be the same conversion no matter what you’ve shot?

I also found by eyeballing that a multiply of ~13.5 is pretty close to what you actually get if you use a .cube LUT to go to ACEScct instead, skipping the ‘hacky’ linear conversion LUT and use ACES Transform instead to convert to linear. Comparing that result with the same output transform yields the same result visually between the two. And whilst having tested on only 2 images the result made sense in terms of output exposure, even versus their own zlog2 to display conversion LUTs.
To double check my sanity I duplicated the DCTL file and changed the double mults to a single 13.5 value per channel and it matched my manual compensation.

Then there is their OFX plugin which works in Resolve but not in ReFusion or Fusion Studio is also quite the thing. If I insert it in a linear signal and set both input and output to zlog2 assuming a non-op, half of the image information on the bottom becomes clipped. I assume it’s using the same range limited cube LUTs. It has an option to output to AP0/linear. This is unusable because everything above 1.0 is unrecoverable. Yet the output option Rec709-lin does the same as that LUT zlog2_to_linear_4096.cube used in the DCTL requiring a gain boost after.

I wanted to share this information because I’m curious if any of it might make sense or that we are dealing with some issues we should see to be addressed if Z Cam is willing to look at it.

Has any of you ever had the need to work with Z Cam material? If so happy to hear your experience.
If you want to test yourself here is the clip I used which has some good brights on the first frame.
(Z011C0033_20201007061411_0001.MOV in the ProResHQ folder)

2 Likes

I’m dealing with this problem too. I have a Zcam I wanted to try an ACES workflow just for curiosity, I trying to making sense of it too. The ZlogColor Plugin works really nice for what it is intended (non color managed workflows) but I found clipping too when trying to use wider Color spaces. I’ll try some of your numbers, they seem promising, thanks for sharing

Hey @ron.ruizg
No problem, let me know how it goes! You may also want to use their zlog to ACEScct cube LUT if you don’t want to use the customized DCTL if using in Resolve. It’s probably the cleanest and easiest.

Hi! How do you make the conversion to linear bypassing the use of the conversion LUT used in the DCTL? I hope you can help me, it’s only for educational purposes, thanks!

You can’t because their DCTL is just referencing that LUT (first line of code). There is no formula based version anywhere. The matrix transform zlog2 primaries to AP0 is code however but .spimtx files can also be used in Nuke or Fusion for instance. You could also type in the numbers yourself in a separate node but there’s no way of getting around using at least 1 LUT file.

So the option is to either use their .cube file to go to ACEScct and then ACES/OCIO transforms to get to wherever you need to be. Or the method of using their DCTL with the multiply changed to ~13.5 or separate zlog2 to AP0 matrix and zlog2 to linear LUT and multiply/gain by ~13.5 afterwards. Both are just not that elegant.