Matchbox request: Colour Balance from Macbeth

Digging around further, there seem to be some python scripts out there that can be pieced together. But want to try some of them out.

However, while searching, I came across this Logik thread from '21 and some relevant comments: Neutralgrade - #9 by fredwarren

In there are also mentioned: FL-00639 and FL-01413

Last piece on this discussion for now.

I played with the ColorCheckMacbeth gizmo in Nuke. It generates the color matrix. If you take this matrix and plug it into a ColorMatrix matchbox, the calibration translates. If you have a pipeline where you’re already doing this for Nuke, you can replicate those values in Flame. Maybe even write a python script that can auto-generate an importable node in Flame.

Be mindful that the gamut in the Nuke gizmo and Flame has to match. I set my project up with ACES 1.2 and had a color mgmt node with input transform to ACEScg in the batch,.

Test example…

Found a definitely off color chart sample online:

Nuke screenshot with wipe:

Copied into Flame with context views:

I originally tried Lewis Saunder’s ColorMatrix matchbox, but had some trouble to make it look right. Some other features in there.

So I simplified it into a very basic 3x3 Matrix mult. New shader is not yet in the portal, so you have to manually copy it into /opt/Autodesk/presets/version/matchbox/shaders/Logik: Dropbox - ak_SimpleColorMatrix.tar.gz - Simplify your life

So you’re half-way there on your original request. You have the backend, for the front end it’s either already in your pipeline, you can use an external tool you have access to, or over time we can write some OpenCV python scripts to generate that matrix.

Or twist ADSK’s arm to build it into Flame to start with.

1 Like

Thanks for the detailed reply, and yes, I do neutralise all plates and HDRIs using the macbeth charts I gather on set. If I can’t get one, things get a bit messy but our approach is pretty much on rails once the footage gets inside Nuke.

In terms of colorists balancing things and producing a technical grade, visually may work very well and client may be happy but given our bread and butter is CGI, that is not a solution I can buy into… the CGI won’t sit on the plate and we will end up fudging it in comp which is very time consuming.

I had a go at this years and years ago, as a Pybox node which I’m not sure anyone ever used because it’s pretty slow and clunky… you can see a demo here on two different colour chart layouts:

It works on the standard Macbeth chart layouts as well if you give it a chart image in your target colourspace like the synthetic ones here: colour-nuke/colour_nuke/resources/images/ColorChecker2014 at master · colour-science/colour-nuke · GitHub

It exports the matrix as a .ctf you can load in ColorMgmt although a tiny Matchbox would also work. To keep the python side simpler it relies on aligning the charts beforehand with an action bilinear… unfortunately like the mmColorTarget gizmo for Nuke it requires a few dependencies which can be annoying to install, and I tried to wrap them up inside the script itself in what seems like a really stupid way in retrospect - but anyone is very welcome to take the script itself and re-package it as something you can run from the logik portal or a right-click menu:


Thanks @lewis This is exactly what I was describing.

@allklier I’ve just seen your post on AFX_reversegrade.

This is really useful. The node I’m after for macbeths is essentially that but with front and back sample pots for each colour on a macbeth.

Is this wildly different than colour curves matching in the Flame Colour Corrector? (which doesn’t seem to work anymore - maybe since I’ve switched to ACES)

@leovfx Not sure what the logic of the Color Corrector is. This matchbox only works on basic white balance of black and white point.

Here’s the math behind it:

    result                  = vec3( (source - s_blackPoint) / s_whitePoint);
    result                  = vec3( (result * t_whitePoint) + t_blackPoint);

Whereas the various Macbeth plugins/tools run a much more complex algorithm to match the two images. Though they still only derive a global 3x3 matrix, not a match that might take highlights and shadows into consideration, such as LUT could.

Can the results be pretty similar in most circumstances? Probably. But you were looking for something more precise.

Right. I’ll have to take your word for it I’m afraid. I’m fairly competent with Flame but my coding skills end outside of the expressions field and google sheets. :sweat_smile: