Wednesday, March 17, 2010

Easier 3D LUTs

I got some feedback from the boss about creating 3D LUTs, as described earlier: "too many steps". So I wrote a script to help out, and in a burst of imagination I called it "Create3DLUT". Thanks to the magic of automation, you can now create your 3D LUTs more easily:
  • Set up a chain of colour correction tools on the flow.
  • Select them all, and run the Create3DLUT script from the comp's Scripts menu.

Thanks to the magic of abbreviation, that list looks shorter, but you'll still be asked for a filename and some details about the LUT. And thanks to the magic of antedation, to make up a convenient word, I've already written the script and slipped it into your Scripts/Comp folder, so you don't even need to download it :-)

But what if you want to make a 3D LUT from a completely different program? Well, why are you even looking at a Fusion dev blog? But since you're here - all you need to do is create an image with a well-spaced range of colours, colour it with the method of your choice, read the pixels back and write their colour values to a file with an appropriate header. Sounds simple enough - and easy to do with a couple of fuses, LUTCubeCreator and LUTCubeAnalyzer.

Use LUTCubeCreator to create the special image, then save it and colour-correct it however you like. When done, load it back into Fusion, and feed it into the LUTCubeAnalyzer. Simply choose a LUT type and filename, click the Write button, and your new 3D LUT is created with a flourish and smile.

4 comments:

  1. Wow! Amazing tools!

    Could there be a checkbox in the LUTCubeAnalyzer to make a reverse color correction?

    For example, if you work with a non-pregraded source and you have to output original colors, you may want to make a pregrade in your composition and then change colors back.
    Or you could apply such a correction to other footages to match the color-corrected source.

    Now it's possible with Curves and CineonLog, but the ColorCorrector is sometimes more suitable.

    ReplyDelete
  2. Not all LUT's are... commutative? You can't reverse them and get the original result.

    ReplyDelete
  3. For LUTCubeCreator, I think the the InSize should have INP_Integer = true attribute.

    ReplyDelete
  4. We recently discussed this between Steve, Eric and me. The result is simply that an inverse LUT function is not simple to implement.

    As Chad pointed out, you can't reverse the 3D LUT function, so trying to do so may result in various different "results" that all work fairly well for certain cases, but there is no "this is the right way" one.

    In a forward 3D LUT you have for any input coordinate (R,G,B) exactly one result of (R',G',B'). At the same time you will have actually several input coordinates (R,G,B) that output the exact same output values (R',G',B'), otherwise the 3D LUT would have been a 1:1 LUT with no effect.

    But obviously thats not true (so you don't have a 1:1 LUT), so it must be true that several input colors point to a common output color (at least after rounding)

    To inverse that common output color is actually impossible. You can't know which of the original input coordinates must be reproduced.

    As artificial this all sounds, as real the mathematical problem is.

    Steve said he needs to invest some time to do an inverse LUT function (at least one possible approach), which I would HIGHLY APPRECIATE. Surely not me alone.

    Maybe Daniel, Stuart, Steven and all others can assist Steve here :-)

    I believe doing it can be a thrilling weekend game for our math & programming gurus.

    Good luck,
    Axel

    ReplyDelete