Jump to: Board index » General » Fusion

Transform Fusion element without affecting image mask

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

cinerobert

  • Posts: 15
  • Joined: Tue Dec 20, 2022 2:31 am
  • Real Name: Robert McLendon

Transform Fusion element without affecting image mask

PostFri Jan 10, 2025 4:46 am

I apologize if I'm using the wrong terminology here. This seems like such a simple use case, but I've been Googling and experimenting for hours with no luck.

I have a png that I'm using to mask some video in Fusion. Like this:

Screenshot 2025-01-09 204240.jpg
Screenshot 2025-01-09 204240.jpg (159.36 KiB) Viewed 632 times


Now, I want to apply transform settins (size, position) to the video *without affecting the image mask*.
Of course, putting a transform node downstream from the video node affects everything.
So does creating a Fusion clip from a timeline and transforming the video on the timeline.
Someone suggested using a transform node, going into a merge node, and then masking the merge node, but I couldn't get that to work.
Offline
User avatar

KrunoSmithy

  • Posts: 3383
  • Joined: Fri Oct 20, 2023 11:01 pm
  • Real Name: Kruno Stifter

Re: Transform Fusion element without affecting image mask

PostFri Jan 10, 2025 10:56 pm

cinerobert wrote:Now, I want to apply transform settins (size, position) to the video *without affecting the image mask*..


There are many many ways to do this, but if you want the most basic version with two nodes, you can add transform node and add your mask to transform node. If its simple shape like in your screenshot, probably best to add rectangle mask where you can control the mask separately. And in transform node you can control the video, separately.

Here I made a quick demo. Copy and paste this code to your node tree in fusion.

sshot-188.jpg
sshot-188.jpg (62.65 KiB) Viewed 617 times


Code: Select all
{
   Tools = ordered() {
      RectangleMask = RectangleMask {
         NameSet = true,
         Inputs = {
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Height = Input { Value = 1, }
         },
         ViewInfo = OperatorInfo { Pos = { 448.805, 22.3281 } },
      },
      Transform = Transform {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            ApplyMaskInverted = Input { Value = 1, },
            MultiplyByMask = Input { Value = 1, },
            Input = Input {
               SourceOp = "Video",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "RectangleMask",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 448.805, 110.207 } },
      },
      Video = Background {
         NameSet = true,
         Inputs = {
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Type = Input { Value = FuID { "Corner" }, },
            TopLeftRed = Input { Value = 1, },
            TopRightGreen = Input { Value = 1, },
            BottomLeftBlue = Input { Value = 1, }
         },
         ViewInfo = OperatorInfo { Pos = { 317.472, 110.207 } },
      }
   }
}


If you have png image as a black and white mask with no alpha channel, just black and white. Than you can use luminance for channel source for the mask.

sshot-189.jpg
sshot-189.jpg (171.71 KiB) Viewed 617 times


You can build on that to as much control or complexity as you like, but that is probably the simplest way.
Offline

Sander de Regt

  • Posts: 3907
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Transform Fusion element without affecting image mask

PostSat Jan 11, 2025 8:55 am

The reason this happens is because as soon as you mask the MediaIn, the result of that operation is in effect a complete intermediate result i.e. the masked image *is* the image now.

If you want to use the mask as a sort of 'window' you should do your transformations first

MediaIN-->Xform

and *then* do your masking. In this case the easiest way is by using a brightness contrast tool after the xform with RGBA checked and gain set to 0. Mask this tool with your rectangle mask and you're good to go. Even typing this out took more time than actuall doing it :D
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

cinerobert

  • Posts: 15
  • Joined: Tue Dec 20, 2022 2:31 am
  • Real Name: Robert McLendon

Re: Transform Fusion element without affecting image mask

PostMon Jan 13, 2025 3:17 am

KrunoSmithy wrote:
cinerobert wrote:Now, I want to apply transform settins (size, position) to the video *without affecting the image mask*..


There are many many ways to do this, but if you want the most basic version with two nodes, you can add transform node and add your mask to transform node. If its simple shape like in your screenshot, probably best to add rectangle mask where you can control the mask separately. And in transform node you can control the video, separately.


Thank you so much, that seems to work. I could swear I tried every combination of connecting those nodes, even tried a merge node based on an old post, but I didn't stumble on the right way!

Is there any way to make the keyframe controls for the transform more visible? I was really hoping to be able to control it the way you can on an edit timeline with bezier handles and so forth.

Before using an xform node, I had tried just doing my transforms on the edit tl, but it seems like once you create a fusion clip all of that is sort of baked in.

BTW what would I search for if I wanted to learn what you're doing with the code there? I've never done that before, I don't even know how to view the code once it's pasted in.
Last edited by cinerobert on Mon Jan 13, 2025 3:33 am, edited 3 times in total.
Offline

cinerobert

  • Posts: 15
  • Joined: Tue Dec 20, 2022 2:31 am
  • Real Name: Robert McLendon

Re: Transform Fusion element without affecting image mask

PostMon Jan 13, 2025 3:21 am

Sander de Regt wrote:The reason this happens is because as soon as you mask the MediaIn, the result of that operation is in effect a complete intermediate result i.e. the masked image *is* the image now.
....
In this case the easiest way is by using a brightness contrast tool after the xform with RGBA checked and gain set to 0. Mask this tool with your rectangle mask and you're good to go. Even typing this out took more time than actuall doing it :D


Thank you for replying. I'm confused about what you're doing with the brightness contrast tool...the method from Kruno just applied the mask directly to the xform node and set the channel on that node to luminance. I always like to learn mulitple ways of doing things though!
Offline
User avatar

KrunoSmithy

  • Posts: 3383
  • Joined: Fri Oct 20, 2023 11:01 pm
  • Real Name: Kruno Stifter

Re: Transform Fusion element without affecting image mask

PostMon Jan 13, 2025 3:59 am

cinerobert wrote:Thank you so much, that seems to work. I could swear I tried every combination of connecting those nodes, even tried a merge node based on an old post, but I didn't stumble on the right way!


Merge node will work as well, but it needs background and foreground inputs already set and than you add blue input for mask.

cinerobert wrote:Is there any way to make the keyframe controls for the transform more visible? I was really hoping to be able to control it the way you can on an edit timeline with bezier handles and so forth.


You mean spline editor. You also have keyframe editor, and they are similar but obviously one is specializing in splines and other in keyframes, and you also have on screen overlay controls.

DaVinci Resolve 16_ Fusion Spline Editor Tutorial


cinerobert wrote:BTW what would I search for if I wanted to learn what you're doing with the code there? I've never done that before, I don't even know how to view the code once it's pasted in.


The code I posted here you can just copy to clipboard and paste in your node graph in fusion and you should see what I've done. It will turn text into nodes. Because they are written in language that can be represnted with text.

Return to Fusion

Who is online

Users browsing this forum: Damian_Crossroads and 22 guests