Page 1 of 1

Rotate a clip about the center of its mask on Fusion

PostPosted: Thu Jan 07, 2021 10:17 pm
by purplemagic
I'm trying to build a Fusion composite that rotates a clip about the center of its circular mask.

So I added an elliptical mask to the Media In, and attached the Media In to a Tranform which will in turn rotate it.

When I set the Pivot of the Tranform to the same as that of the mask and adjust the Tranform's Rotation Angle, the clip starts rotating but soon goes off the screen! On the other hand, if the mask is placed at the exact center of the screen, it works fine.

What did I do wrong here?

Thanks.

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Fri Jan 08, 2021 9:53 am
by Sander de Regt
I don't think you did anything wrong per se, but are you using the transform only for rotating or also scaling and positioning?

Can you share a composition? (select all your nodes - copy/paste between [code][/code] tags)

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Fri Jan 08, 2021 8:14 pm
by purplemagic
Sander de Regt wrote:I don't think you did anything wrong per se, but are you using the transform only for rotating or also scaling and positioning?

Can you share a composition?


After further investigation, I found that the clip goes off screen only when I manually move the mask in the Node Editor after the first frame of the clip. If I move the mask at the first frame, it works fine. Any idea why? Here's the code. I appreciate your help.

Code: Select all
{
   Tools = ordered() {
      Merge = Merge {
         NameSet = true,
         Inputs = {
            Background = Input {
               SourceOp = "RotateInner",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 440, -16.5 } },
      },
      RotateInner = Transform {
         NameSet = true,
         Inputs = {
            Pivot = Input {
               Value = { 0.729110529238682, 0.500205616644276 },
               Expression = "Point(InnerMask.Center.X, InnerMask.Center.Y)",
            },
            Size = Input { Value = 1.51, },
            Angle = Input { Expression = "time / comp:GetPrefs().Comp.FrameFormat.Rate * 30", },
            ReferenceSize = Input { Value = 1, },
            Input = Input {
               SourceOp = "MediaIn",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 275, -16.5 } },
      },
      InnerMask = EllipseMask {
         NameSet = true,
         Inputs = {
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            MaskWidth = Input { Value = 512, },
            MaskHeight = Input { Value = 285, },
            PixelAspect = Input { Value = { 1, 1 }, },
            UseFrameFormatSettings = Input { Value = 1, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Center = Input { Value = { 0.729110529238682, 0.500205616644276 }, },
            Width = Input { Value = 0.234622170873801, },
            Height = Input {
               Value = 0.234622170873801,
               Expression = "InnerMask.Width",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 55, -16.5 } },
      },
      MediaOut = MediaOut {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            Index = Input { Value = "0", },
            Input = Input {
               SourceOp = "Merge",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 605, -16.5 } },
      },
      MediaIn = MediaIn {
         ExtentSet = true,
         NameSet = true,
         CustomData = { MediaProps = {
               MEDIA_FORMAT_TYPE = "PNG",
               MEDIA_HEIGHT = 285,
               MEDIA_LAYER_DESC = {
               },
               MEDIA_MARK_IN = 0,
               MEDIA_MARK_OUT = 119,
               MEDIA_NAME = "test.png",
               MEDIA_NUM_FRAMES = 120,
               MEDIA_NUM_LAYERS = 0,
               MEDIA_PAR = 1,
               MEDIA_PATH = "test.png",
               MEDIA_SRC_FRAME_RATE = 24,
               MEDIA_START_FRAME = 0,
               MEDIA_WIDTH = 512
            }, },
         Inputs = {
            EffectMask = Input {
               SourceOp = "InnerMask",
               Source = "Mask",
            },
            GlobalOut = Input { Value = 119, },
            Layer = Input { Value = "0", },
            ClipTimeEnd = Input { Value = 119, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 165, -16.5 } },
      }
   }
}

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Sat Jan 09, 2021 10:59 am
by Sander de Regt
I can't replicate your problem I'm afraid. Whatever I do with the mask, everything rotates just as I'd expect it to. Can you perhaps make a screengrab/video to show your issue?

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Sun Jan 10, 2021 3:07 am
by purplemagic
Sander de Regt wrote:I can't replicate your problem I'm afraid. Whatever I do with the mask, everything rotates just as I'd expect it to. Can you perhaps make a screengrab/video to show your issue?

On the Fusion page, move the playhead to frame 100 or later and try moving the mask using the onscreen control. The mask will soon disappear. Thanks again.

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Sun Jan 10, 2021 8:39 am
by Sander de Regt
I'm using Fusion standalone and it doesn't happen for me, so I can't reproduce your problem.
That's why I was asking for a video to demonstrate, because there doesn't seem to be an actual problem with your setup, which means something else is causing it.

Is your MediaIn long enough? What are you connecting to the merge? (there is nothing connected to it in the code that you posted) etc

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Tue Jan 12, 2021 1:16 am
by purplemagic
Sander de Regt wrote:I'm using Fusion standalone and it doesn't happen for me, so I can't reproduce your problem.
That's why I was asking for a video to demonstrate, because there doesn't seem to be an actual problem with your setup, which means something else is causing it.

Is your MediaIn long enough? What are you connecting to the merge? (there is nothing connected to it in the code that you posted) etc


If that's the case, I suspect it is a Davinci Resolve bug. In fact, my Davinci Resolve has been crashing at least once per session with no apparent reason. Thank you for your help.

Re: Rotate a clip about the center of its mask on Fusion

PostPosted: Tue Jan 12, 2021 7:56 pm
by Chris Theofanopoulos
purplemagic wrote:
Sander de Regt wrote:I can't replicate your problem I'm afraid. Whatever I do with the mask, everything rotates just as I'd expect it to. Can you perhaps make a screengrab/video to show your issue?

On the Fusion page, move the playhead to frame 100 or later and try moving the mask using the onscreen control. The mask will soon disappear. Thanks again.
Masks create keyframes when you move them around. If you have moved the pivot point from the center I think it is normal. You should probably animate the pivot point according to your mask animation

Sent from my FIG-LX1 using Tapatalk