Pin Light blend mode for Blackmagic Fusion

Just a small offering this time: The pin light mode from After Effects is a conditional operator. For every pixel in each channel, if image2 > 0.5, display the maximum of image1 or 2*(image2 – 0.5). Otherwise, display the minimum of image1 or 2*image2. So put the following expression into each channel of a Custom Tool:

if(c2 > 0.5, max(c1,2*(c2-0.5)), min(c1,2*c2))

Or if you're feeling lazy, unzip this file into your macros directory: blend_PinLight

If I encounter the need for other AE/Photoshop blend modes, I'll expand the macro and update it here. I rather think it's getting to the point where I'll want to create a downloads page on this site instead of hiding all of these tools in blog posts.


Here's the Glitch_HumBar macro I promised in the comments: Glitch_HumBar

And Ribel's VHS_Glitch_Strip macro: VHS_Glitch_Strip

Ribel's macro has an instructive use of the Custom Tool. The NumberIn and PointIn controls are used to select the height and location of the tearing strip. Those numbers are fed into the Setup expressions, where they're divided in half, providing a distance above and below the point control. The Setup expressions run only once per frame, so getting that information there is more efficient than doing it in the other expressions, which evaluate once per pixel. It's just four simple operations, so the savings are minute, but it's good practice, anyway.

9 Comments

  1. I love your blog posts!
    I wish they are more frequent.
    About PinLight blending mode – I am curious, how is it used in VFX?
    Can you give some examples?

  2. I am glad you find them useful. I wish they were more frequent, too!

    It's fairly rare that you'd need a special effect blend mode like Pin Light for VFX, but every once in a while you might run across a technique for After Effects or Photoshop that uses one. I needed Pin Light because I was creating a collection of new macros to simulate video glitches such as over compression, RF interference, adaptive resolution degradation, and so on. My starting point was a set of After Effects templates: http://creationeffects.com/creation-glitch-effects.html
    One of the templates made some cool color distortions that I couldn't figure out how to replicate with the tools at hand, so I deconstructed it and discovered that it used the Pin Light mode. There isn't a comparable tool in Fusion, so I had to create it myself.

    The Transmission Glitch macros are still a work in progress, but I will eventually either post them here or link to where they appear on the MuseTools page: http://www.musevfx.com/tools/

  3. The video glitches are really cool!

    I have seen some other plugins with similar purpose like Red Giant's Glitch tool
    https://www.redgiant.com/universe-tools/glitch/
    The first tutorial shows some use of blending modes although there is no PinLight,
    but it gives a look at the various parameters of glitch generation.

    Looking forward to see your tool in action!
    Best regards!

  4. Flattery will get you everywhere. Have a complimentary hum bar macro! It simulates an incorrectly grounded antenna on analog video.

    CODE REMOVED – You may download the macro from the link in the original post instead.

  5. I was too exited to try it out!
    Unfortunately the tool tries to load for a second or two,
    then appeared shortly as empty tool tile and disappeared.
    What could be the cause?

  6. Odd. I can't think of what I might have done wrong; I just copy-pasted the code into the comment field. Maybe WordPress stripped out a control character somewhere. Anyway, I've added a download link to the article.

  7. It worked from the the download link!
    Very nice and subtle effect. Thank you for sharing!

    You can try ant test if my macro works if copied from the message :)

    {
    Tools = ordered() {
    VHS_Glitch_Strip = MacroOperator {
    CtrlWZoom = false,
    Inputs = ordered() {
    MainInput1 = InstanceInput {
    SourceOp = "CT_VHS_Glitch_2",
    Source = "Image1",
    },
    Input1 = InstanceInput {
    SourceOp = "CT_VHS_Glitch_2",
    Source = "PointIn1",
    },
    Input2 = InstanceInput {
    SourceOp = "CT_VHS_Glitch_2",
    Source = "NumberIn1",
    Default = 0.05,
    },
    Input3 = InstanceInput {
    SourceOp = "VHS_Glitch_Mask_2",
    Source = "Level",
    Default = 1,
    },
    Input4 = InstanceInput {
    SourceOp = "VHS_Glitch_Mask_2",
    Source = "SoftEdge",
    Default = 0.005,
    },
    },
    Outputs = {
    MainOutput1 = InstanceOutput {
    SourceOp = "CT_VHS_Glitch_2",
    Source = "Output",
    },
    },
    ViewInfo = GroupInfo { Pos = { 1155, 247.5, }, },
    Tools = ordered() {
    CT_VHS_Glitch_2 = Custom {
    CtrlWZoom = false,
    CtrlWShown = false,
    NameSet = true,
    Inputs = {
    PointIn1 = Input { Value = { 0.5, 0.39894419306184, }, },
    NumberIn1 = Input { Value = 0.05, },
    LUTIn1 = Input {
    SourceOp = "CT_VHS_GlitchLUTIn1_1",
    Source = "Value",
    },
    LUTIn2 = Input {
    SourceOp = "CT_VHS_GlitchLUTIn2_1",
    Source = "Value",
    },
    LUTIn3 = Input {
    SourceOp = "CT_VHS_GlitchLUTIn3_1",
    Source = "Value",
    },
    LUTIn4 = Input {
    SourceOp = "CT_VHS_GlitchLUTIn4_1",
    Source = "Value",
    },
    Setup1 = Input { Value = "p1y-n1/2", },
    Setup2 = Input { Value = "p1y+n1/2", },
    Intermediate1 = Input { Value = "(y>s1)&&(y<s2)", },
    RedExpression = Input { Value = "if(i1,getr1d(x,p1y),r1)", },
    GreenExpression = Input { Value = "if(i1,getg1d(x,p1y),g1)", },
    BlueExpression = Input { Value = "if(i1,getb1d(x,p1y),b1)", },
    NameforNumber1 = Input { Value = "Glitch Height", },
    ShowNumber2 = Input { Value = 0, },
    ShowNumber3 = Input { Value = 0, },
    ShowNumber4 = Input { Value = 0, },
    ShowNumber5 = Input { Value = 0, },
    ShowNumber6 = Input { Value = 0, },
    ShowNumber7 = Input { Value = 0, },
    ShowNumber8 = Input { Value = 0, },
    NameforPoint1 = Input { Value = "Glitch_Position", },
    ShowPoint2 = Input { Value = 0, },
    ShowPoint3 = Input { Value = 0, },
    ShowPoint4 = Input { Value = 0, },
    EffectMask = Input {
    SourceOp = "VHS_Glitch_Mask_2",
    Source = "Mask",
    },
    },
    ViewInfo = OperatorInfo { Pos = { 0, 42.4281, }, },
    },
    CT_VHS_GlitchLUTIn1_1 = LUTBezier {
    KeyColorSplines = {
    [0] = {
    [0] = { 0, RH = { 0.333333333333333, 0.333333333333333, }, Flags = { Linear = true, }, },
    [1] = { 1, LH = { 0.666666666666667, 0.666666666666667, }, Flags = { Linear = true, }, },
    },
    },
    SplineColor = { Red = 204, Green = 0, Blue = 0, },
    CtrlWShown = false,
    },
    CT_VHS_GlitchLUTIn2_1 = LUTBezier {
    KeyColorSplines = {
    [0] = {
    [0] = { 0, RH = { 0.333333333333333, 0.333333333333333, }, Flags = { Linear = true, }, },
    [1] = { 1, LH = { 0.666666666666667, 0.666666666666667, }, Flags = { Linear = true, }, },
    },
    },
    SplineColor = { Red = 0, Green = 204, Blue = 0, },
    CtrlWShown = false,
    },
    CT_VHS_GlitchLUTIn3_1 = LUTBezier {
    KeyColorSplines = {
    [0] = {
    [0] = { 0, RH = { 0.333333333333333, 0.333333333333333, }, Flags = { Linear = true, }, },
    [1] = { 1, LH = { 0.666666666666667, 0.666666666666667, }, Flags = { Linear = true, }, },
    },
    },
    SplineColor = { Red = 0, Green = 0, Blue = 204, },
    CtrlWShown = false,
    },
    CT_VHS_GlitchLUTIn4_1 = LUTBezier {
    KeyColorSplines = {
    [0] = {
    [0] = { 0, RH = { 0.333333333333333, 0.333333333333333, }, Flags = { Linear = true, }, },
    [1] = { 1, LH = { 0.666666666666667, 0.666666666666667, }, Flags = { Linear = true, }, },
    },
    },
    SplineColor = { Red = 204, Green = 204, Blue = 204, },
    CtrlWShown = false,
    },
    VHS_Glitch_Mask_2 = RectangleMask {
    CtrlWShown = false,
    NameSet = true,
    Inputs = {
    ShowViewControls = Input { Value = 0, },
    SoftEdge = Input { Value = 0.005, },
    MaskWidth = Input { Value = 1920, },
    MaskHeight = Input { Value = 1080, },
    PixelAspect = Input { Value = { 1, 1, }, },
    ClippingMode = Input { Value = FuID { "None", }, },
    Center = Input {
    Value = { 0.5, 0.39894419306184, },
    Expression = "CT_VHS_Glitch_2.PointIn1",
    },
    Width = Input { Value = 1, },
    Height = Input {
    Value = 0.03,
    Expression = "CT_VHS_Glitch_2.NumberIn1-SoftEdge*4",
    },
    },
    ViewInfo = OperatorInfo { Pos = { 0, 9.42813, }, },
    },
    },
    },
    },
    ActiveTool = "VHS_Glitch_Strip",
    }

  8. I figured it out. WordPress is replacing all the quote marks with "smart quotes," which are a different character, but one that isn't even in the font I'm using here.

    Nice effect! I haven't done much with tape artifacts yet, so that will be a nice one to add to the arsenal, if you don't mind.

    edit: I found a plug-in that will disable the smart quotes behavior, so pasted code should work now. Fortunately, it looks like the original quotes you pasted in were preserved—the change happened on display, not on submission. I was able to paste your macro into my Fusion with no problem.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.