sobotka / filmic-blender

Film Emulsion-Like Camera Rendering Transforms for Blender
https://sobotka.github.io/filmic-blender/
2.07k stars 147 forks source link

Filmic LUT for Resolve #40

Open rock7-dan opened 6 years ago

rock7-dan commented 6 years ago

I am having some trouble replicating the transform for use in Resolve - i've converted the filmic configuration using ociobakelut and imported it into Resolve; however when applying the LUT the image (32bit EXR) it appears clipped loosing all of the detail in the highlights.

ociobakelut --iconfig config.ocio --inputspace Linear --outputspace "Filmic Log Encoding" --format iridas_itx  --looks "High Contrast"  filmic-high.cube

Resolve Colour Space is set to Rec.709 Gamma 2.2 - any ideas?

resolve blender
sobotka commented 6 years ago

Your issue is due to the fact that Resolve uses a proprietary approach to colour management instead of OCIO or the like. It also began life as a display referred application, and as such, scene referred EXRs require careful handling.

I would encourage you to avoid canned all-in-one transforms and instead simply convert the transforms for use in Resolve, which requires nothing more than duplicating values in a spreadsheet and changing the headers accordingly.

You will need a shaper transform to take the scene referred EXR data to the Filmic log base encode at the very start of your transform. This is essentially a normalized log2 conversion that covers the appropriate range as per the AllocationTransforms in the configuration.

For simplicity, start by importing 16 bit log encoded TIFFs, and applying the Filmic contrast (converted to dot cube) of your choosing. Once you have that working (same approach the institute used on Agent) you can branch out to more complex approaches involving EXRs and an appropriate shaper.

rock7-dan commented 6 years ago

Thanks for the speedy reply Troy - I'll give log tiffs a shot!

sobotka commented 6 years ago

Happy to help you get the full set converted. It is pretty trivial. Here is a sample of the Base contrast to deliver perfect 1:1 based off of the Filmic log encoding base.

The next, yet untitled version of Filmic will likely have a full Resolve compatible set of cube files. Until then, converting the transforms is going to be the most ideal approach.

Let me know how it goes. Closing for now.

rock7-dan commented 6 years ago

Thanks - this worked well and converting the other looks was indeed trivial!

Useful to note if anybody else comes across this thread; the stock Blender colour config needs to be tweaked to expose the Filmic Log colorspace ("Filmic/None" is actually "Filmic sRGB"):

- !<View> {name: FilmicLog, colorspace: Filmic Log}

I am keen to explore the EXR pipeline further, could you provide some quick pointers for how best to accomplish this?

sobotka commented 6 years ago

It would actually be equally trivial now that you understand the issue.

The key point is that the EXRs are scene referred data extending from zero to infinity. In order to take this into the display referred range, you need to shape the data to it. In the case of the Filmic Base log, it is simply a log2 series of values normalized to 0.0 to 1.0, covering the Filmic range.

If you examine the configuration, you will see that the actual transform from scene referred values is three steps:

  1. An AllocationTransform of Log2 from -10 stops to +15 stops.
  2. The desaturation 3D LUT on this wide dynamic range.
  3. The final AllocationTransform to the scaled Log2 -10 to +6.5 stops.

To achieve this in Resolve, you would require the two AllocationTransform's as a 1D LUT and properly convert the 3D LUT for desaturation to the cube format.

I will post the appropriate demonstration when I have some time.

sobotka commented 6 years ago

@rock7-dan I've included a new sheet in the Google Docs spreadsheet that covers the desaturation Filmic Log to Linear transform. In theory, this, coupled with a purely linear 4096 entry LUT that includes a LUT_1D_INPUT_RANGE 0.0 0.66 line should be enough to assemble the full transform from an EXR for Resolve. I haven't tested anything yet, so please let me know if you find time.

The proper flow would be:

  1. EXR rolled through the inverse of the desaturation LUT I recently added.
  2. Roll through the desaturation 3D LUT, in cube format.
  3. Roll through the scaling LUT described above with the 0.66 linear LUT.
  4. Roll through the contrast LUT of your choosing.

In theory this should yield a perfect 1:1 with the output from Blender proper from an EXR.

Again, I haven't had time to actually put this together and test it, so I am hoping you or someone else might be able to. I've included the scaling LUT as well as the desaturation LUT in the Google Sheet linked previously, as well as the Filmic Base Log Encoding should it be useful. The Filmic Base Log Encoding isn't required for the above transform chain. You can find all of the LUTs in the workbook above, in the various sheets located at the bottom of it. Hope this helps.

The aforementioned Google Sheet is located here.

finnschi commented 5 years ago

Any updates on this? (its a pretty old thread ;) I am trying to get filmic blender to work in Flame, and while it takes the look and desat shaper Luts just fine, I can´t figure out how to do the proper lin->log transform to match 1:1 .

sobotka commented 5 years ago

What LUT formats are supported under Flame in 2019? Is there a pure log node?

finnschi commented 5 years ago

What LUT formats are supported under Flame in 2019? Is there a pure log node?

Sp1d works so does 3dl , I actually JUST this minute gotten it to work , with the google sheet data and applying it in reverse. it matches Nuke almost 100% .

FilmicLog_to_linear.spi1d.zip

Flame Lin to Log: flame_lintolog

Nuke Lin2Log (using filmic OCIO) nuke_lintolog

sobotka commented 5 years ago

The only tricky part would be the two step with the desaturation in the middle. The log is a simple log2, with no linear / offset / break point.

You need to place the 3D LUT in after the first log transform, then perform the scale down to the smaller range, which is a simple uniform scaling.

I’ll try to take a peek this weekend if I can find time. I don’t have Flame around, however.

finnschi commented 5 years ago

I hope its ok to post the settings for flame, but maybe some people do care and find this very interesting, Ill try to get it working in Resolve as a next step !

Colormanagement setup for Batch , 2 different ways with and without Desaturation: flame_setup01

Lin2Log settings using my custom shaper lut: flame_lintolog_settings

Second node "filmic base contrast" adds the look . Desat gets applied in the same way. filmicbaselut

finnschi commented 5 years ago

The only tricky part would be the two step with the desaturation in the middle. The log is a simple log2, with no linear / offset / break point.

You need to place the 3D LUT in after the first log transform, then perform the scale down to the smaller range, which is a simple uniform scaling.

I’ll try to take a peek this weekend if I can find time. I don’t have Flame around, however.

Desat lut actually works fine as far as I can tell. (see flame /batch node tree)

The default lin2log in flame actually isnt log2 and there is no way of changing it as far as I know.

sobotka commented 5 years ago

1:1 should be possible via a simple 1D, 3D, then matrix for the scale.

finnschi commented 5 years ago

1:1 should be possible via a simple 1D, 3D, then matrix for the scale.

Yea thats exactly what ive been doing its just the first 1D doesnt match the nuke lin->log 1:1, but almost , I actually think the difference is in the internal math of each software, I am using a crazy testpattern thats a very edge-case.

sobotka commented 5 years ago

I can do up the two logs to lin pretty easily. Just need a moment on the weekend...

finnschi commented 5 years ago

very cool, send it over and I can test it in Flame asap. I am using this test image btw: https://github.com/openexr/openexr-images/blob/master/TestImages/RgbRampsDiagonal.exr

sobotka commented 5 years ago

I still intend to generate the LUTs, but a wise mind I know suggested to use the change of base formula if you have natural log or log10; ln(x) / ln(base) for example.

sobotka commented 5 years ago

Apologies for the delays here. I'm going to try and dig into this today.

For posterity sake, attaching a useful link to Resolve's Cube LUT format, which includes combined 1D shapers with 3D LUTs.

aditalwar commented 5 years ago

Hi James, Did you have any success with the Resolve cube LUT ?

sobotka commented 3 years ago

It can be used on any system that supports OpenColorIO.