LMTs Part 4: How do they work and how are they made? (continued...)

Tags: #<Tag:0x00007f9649e74028> #<Tag:0x00007f9649e7be90>

(Scott Dyer) #10

The files provided are CTL, not DCTL. CTL is the transform language used for the reference implementations of ACES transforms. DCTL is DaVinci CTL, which despite sounding similar in name, is a completely different language that Resolve uses to specify transforms. So that’s why they’re not showing up in DaVinci despite being placed into the LUT folder - they are not expressed in a file that Resolve will recognize.

(Qusai Nofal) #11

Thanks for the reply, in this case what’s the best solution to use these LMT files while working in DaVinci?

(Paul Dore) #12

I had a go at converting two of the CTLs into DCTLs. I don’t know exactly how accurate the conversion went, but they load and run, so maybe others can check for errors and report back. As with the original CTLs (LMT_Academy_Analytic_3 & 4) they expect ACES AP0 Linear in and out, which will require converting from ACEScc or ACEScct in Resolve (use the Color Space Transform plugin), but the DCTLs can be easily adapted in order to bypass this additional process.

Adapting the original code even further so that it runs on a GPU kernel in an OFX plugin should also be pretty straight forward (particularly CUDA).

LMT Academy Analytic 3 DCTL
LMT Academy Analytic 4 DCTL

Update: The port to CUDA kernel in an OFX plugin was indeed relatively simple, and works just as well (fast) as the DCTL. It’s now just a matter of deciding on which adjustable parameters to include in the plugin UI. I don’t want to jump the gun and compile anything further just yet, seeing as it still is ultimately Scott’s composition, so I’ll wait on feedback from him as to which options should be included in the plugin.

(Scott Dyer) #13

@Paul_Dore wow, this is a great effort! Converting these to DCTL is something I had intentions to do at some point but my focus has been elsewhere and so it’s great to see you’ve done all the heavy lifting. Thank you so much for sharing your work!

(Scott Dyer) #14

My answer to that would simply be “whatever options seem useful”.

I never intended for these example looks to be “final”. While I thought what I provided were reasonable examples, I never expected them to be used “as is”. I could have spent much more time constructing and tuning the parameters. In fact, I kept falling into that trap and had to force myself to focus more on communicating the concepts which was really the meat of this article series.

I wanted to illustrate the power of LMTs and show that an LMT can basically be anything that modifies the default look - whether it be a simple contrast adjustment, complex stack of secondary adjustments, or even a pre-set node overlay operation.

Nevertheless, if they’re useful to somebody, than all the better! :grinning:

(Paul Dore) #15

No worries. It’s your work really, I just did the port. I upped my DCTL game in the process, so lots of win. Let me know, when you get the chance, if the conversion is 100% accurate (so many variables and unchartered territory, it’s quite possible it’s not exact), and also what adjustable options do think should be included in a plugin version. Cheers.

Edit: You’ve already answered those enquiries, so all good :slight_smile: I’ll have a go at a simple UI version of 3, and maybe you can suggest a more expansive version of a LMT to go into a plugin.

(Scott Dyer) #16

Haven’t had a chance to test them yet but I will compare some values through CTL and through the Resolve processing and see how close they get.

My DCTL game is weak (from lack of use) and I have never made an OFX plugin so this could be a great learning opportunity for me as well. Maybe together we can make a good example LMT implementation via plug-in. Glad to have a partner in crime that can ask to help me through the tricky parts.

(Paul Dore) #17

Here’s LMT-Analytic 3 in simple OFX form. The parameters default to the values listed in the original CTL. 31 parameters in total. The plugin works on macOS, DaVinci Resolve 14, CUDA only for now (but easy to compile for windows and linux, as well as in OpenCL).

LMT Plugin macOS CUDA

(Paul Dore) #18

For practical purposes, I added a pair of input and output options to the plugin, so you can drop it onto an ACEScct timeline without the need for additional conversions.

LMT Plugin macOS CUDA

I also made ACEScct timeline compliant versions of the previous two DCTLs.

LMT Academy Analytic 3 ACEScct DCTL

LMT Academy Analytic 4 ACEScct DCTL

(Scott Dyer) #19

Ok, so total newb question here, but how do I “install” this to be able to try it out? From support forums it looks like I’m supposed to just put it in /Library/OFX/Plugins but:

(1) I don’t have that directory yet (I can just create it but that seems wrong, which leads me to…)
(2) Is there an OFX package or something that I need to install separately first?


(Paul Dore) #20

There are two /Library directories on a mac. One in the root directory, and one in the home directory. It goes in the root library, and you will have to add an OFX/Plugins directory if there isn’t one. No need for any pre installed packages. In Resolve you should change GPU Processing Mode to CUDA in Preferences/Hardware Configuration, otherwise it might bypass to CPU usage, which is just passthrough.

(Scott Dyer) #21

Ok, thanks for confirming - it must be something else then. I can see all the ResolveFX plugins, but cannot see any user installed ones.

I checked everything as you said and that’s what I had done. I put the OFX/Plugins folder in the root Library (not user Library), with the LMT.ofx.bundle inside that.
I was not aware about the hardware configuration but have switched that to CUDA and restarted.

I’ll keep looking for help on the Blackmagic forum, even though you are a key participant in most of the conversations I’ve found that seem related to this…

(Paul Dore) #22

What are your specs with regards to operating system, graphics card, and version of Resolve?

(Scott Dyer) #23

I just don’t see it showing up anywhere where OpenFX is listed. It should just show up in the OpenFX library, right?

Have tried on both:
Macbook Pro (mid-2015), MacOS 10.13.3
AMD Radeon R9 M370X
Resolve Studio
Mac Pro (Late 2013), MacOS 10.13.3
AMD FirePro D700 6GB
Resolve Studio

(Paul Dore) #24

CUDA only runs on Nvidia cards, so that’s why they aren’t showing up. AMD cards would need the OpenCL version. There is a sub folder in the macOS plugins repository with some OpenCL only plugins, but I haven’t ported the LMT plugin just yet. It can be done, but I’d prefer to have confirmed the validity of the original plugin code before embarking on the next one. OpenCL is generally a good deal more hazardous and frustrating as well.

I had a go at porting your CTL to a matchbox shader today, but that’s going to be another uphill battle. However, if it’s successful it would mean you could use an adjustable parameter version of your LMT in Baselight and Flame.

(Paul Dore) #25

I had a quick go at an OpenCL version and got it working (but it feels a bit slow and the code is a mess).

LMT OpenCL plugin

(Paul Dore) #26

Some shader versions of LMT Academy Analytic 3. Shader script than runs in the Shadertoy OFX Plugin in Natron and Nuke, and a matchbox shader that works in Flame (and should work in Baselight).

LMT Academy Analytic 3 Shadertoy

LMT Academy Analytic 3 Matchbox shader
LMT Academy Analytic 3 Matchbox xml

(Dominik Belančić) #27

Firstly, thanks for doing the conversion to DCTL!

But, I don’t know if it’s supposed to be like that, but when I use the LMT Academy Analytic 3 the image becomes way too green and the only way to compensate is using an offset control going towards magenta.
It’s not a big deal, but I’m just wondering if I’m doing something wrong or does it really green up the image?

(Paul Dore) #28

Which particular script are you using? There was an issue with the matrix notation in the earlier LMT conversions. The latest DCTLs and OFX plugins have addressed this.

(Dominik Belančić) #29

Was using the one from the GitHub DCTLs, but I exported a DCTL from the OFX (totally forgot you could export) and now it’s all good