The place where random ideas get written down and lost in time.

2023-05-17 - DaVinci Fusion Plugin

Category DEV

How to write a Fusion video effect plugin?

This SO answer leads to “we suck less” (aka WSL), and “eyeon”.

That last name “eyeon” is the company which originally created Fusion before being acquired by BlackMagic to integrate it in DaVinci Resolve.

  • https://www.steakunderwater.com/wesuckless/ is the place to find a community behind plugins.
  • API should be available via Help > Documentation > Developer. There’s a PDF IIRC.
  • An older version (Fusion 8, 2016) can be found here: https://documents.blackmagicdesign.com/UserManuals/Fusion8_Scripting_Guide.pdf
  • Scripting:
    • “FusionScript”, to be used either in Lua or Python.
    • Uses LuaJIT for performance. Lua is the preferred choice.
    • Choice of Python 2 or 3.
  • Fuses:
    • OpenCL for tools & filters
  • Scripts:
    • Composition scripts (a “composition” is a full Fusion document)
    • Tool scripts (for a “single tool” aka a single node?)
    • Bin scripts (as in “media bin”)
    • Utility scripts (act on Fusion itself)
    • Script libraries (scriptlib, used by other scripts)
    • External command-line script which can act on a composition.
    • Event scripts.
      • Composition callbacks (load, save, render, etc)
      • Button callbacks (for UI)
    • InTool scripts (executed when evaluating each frame)

Fuses has its own SDK documentation:

  • https://documents.blackmagicdesign.com/UserManuals/Fusion_Fuse_SDK.pdf?_v=1658361162000
  • Locally as “Fusion Fuse Manual.pdf” in C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Fusion Fuse
  • Plugin types:
    • Image Processing, with inspector and onscreen crosshair.
    • Metadata processing.
    • Modified plugins (affects number inputs)
    • View LUT plugins.
  • Using Lua with LuaJIT.
  • What I’d use is an Image Processing “Tool” plugin.
    • Plugin has code to register its name.
    • Code to register inputs (UI controls) but also Image input/output.
    • Callback NotifyChanged when UI controls change (e.g. to adjust UI).
    • Callback Process to process an image and compute an output.
    • Native methods that apply to the entire image:
      • ColorMatrixFull (RGBA offset, scale, etc)
      • RGBA Color Gain, Gamma, Saturate.
      • Color Space conversion (RGB, HSV, etc)
      • Clear/Fill
      • Channel operations on 1 image with + - * / and RGB coefficients.
      • Channel operations on 2 images with RGB fg vs bg: Copy, Add, Multiply, Subtract, Divide, Threshold, And, Or, Xor, Negative, Difference.
      • Transform or Merge (center, pivot, size, angle, edge wrapping)
      • Crop, Resize
      • Blur (also for Glow)
    • Pixel Processing : create functions that take pixels from 2 images and return the resulting pixel.
      • Functions are “pre declared” and stored in an array, then used in Process.
    • Processing has 8 channels: 4x RGBA and 4x Bg-RGBA (I guess for the background?)
    • Shapes: created using MoveTo/LineTo + matrix operations then filled and merged with image.
    • Text overlays: font management, then draw as shapes.
    • Per-pixel processing using for y/for x/getPixel/setPixel.
  • DCTL (DaVinci Color Transform Language)  is a shader-style processing.
    • C-like syntax, operates om x,y individual pixels.
    • Converted to GPU as needed.
    • Transform DCTL to change color data in one image.
    • Transition DCTL to compute transition between two images.
  • OpenFX
    • C/C++ shader with VS.Net SLN project.

Some example of Fuses here:

https://www.steakunderwater.com/VFXPedia/96.0.243.189/index8be6.html?title=Eyeon:Script/Reference/Applications/Fuse/Example_Fuses#Example_Fuses


 Generated on 2025-01-18 by Rig4j 0.1-Exp-f2c0035