Jump to: Board index » General » Fusion

Scale tracker movment?

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

Dennis Fassbaender

  • Posts: 177
  • Joined: Fri Mar 11, 2016 11:16 pm

Scale tracker movment?

PostMon May 10, 2021 2:22 pm

Hey there!
Is it possible to scale the movement of a tracker?
I mean, i have connected a transform node´s "center" field to a tracker.
And i would like to multiply all of the movements *1,2 as example.
Using expressions will freeze the connected movement - so an other idea is required.
Attachments
Connected_to_tracker.jpg
Connected_to_tracker.jpg (4.31 KiB) Viewed 1918 times
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostMon May 10, 2021 3:48 pm

You'll need an intermediate control to do it. I usually use a CustomTool, since it conveniently has lots of sliders and PointControls for doing something complex like this.

First, you'll need to reposition the Tracker's Unstable Position. The value at the reference frame is (0.5, 0.5), which is inconvenient for multiplication, so reset it to (0,0). So first, Connect Point In 1 to the Tracker's Unsteady Position.

Next, set an expression on Point In 2 that subtracts 0.5 from Point In 1:
Point(PointIn1.X-0.5, PointIn1.Y-0.5)

Point In 3 gets your multiplier:
Point(PointIn2.X * NumberIn1, PointIn2.Y * NumberIn1)

Finally, Point In 4 moves the reference frame back to (0.5, 0.5):
Point(PointIn3.X + 0.5, PointIn3.Y + 0.5)

You can then use an expression to read PointIn4 on any Center control where you wish to use it. This is how FlexiTrack works.

You could, of course, do it all in one go with a long expression, but it gets confusing and difficult to troubleshoot.

Code: Select all
{
   Tools = ordered() {
      Tracker1 = Tracker {
         Trackers = {
            {
               PatternTime = 0,
               PatternX = 0.5390625,
               PatternY = 0.305555555555556
            }
         },
         CtrlWZoom = false,
         Inputs = {
            Name1 = Input { Value = "Tracker 1", },
            PatternCenter1 = Input { Value = { 0.5390625, 0.305555555555556 }, },
            TrackedCenter1 = Input {
               SourceOp = "Tracker1Tracker1Path",
               Source = "Position",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 550, 16.5 } },
      },
      Tracker1Tracker1Path = PolyPath {
         ShowKeyPoints = false,
         ShowHandles = false,
         DrawMode = "ModifyOnly",
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            Displacement = Input {
               SourceOp = "Path1Displacement",
               Source = "Value",
            },
            PolyLine = Input {
               Value = Polyline {
                  Points = {
                     { Linear = true, LockY = true, X = 0.0390625000000001, Y = -0.194444444444444, RX = -1.62760416666889e-05, RY = -2.89351851851897e-05 },
                     { Linear = true, LockY = true, X = 0.039013671875, Y = -0.19453125, LX = 1.62760416666889e-05, LY = 2.89351851851897e-05 }
                  }
               },
            },
         },
      },
      Path1Displacement = BezierSpline {
         SplineColor = { Red = 255, Green = 0, Blue = 255 },
         NameSet = true,
         KeyFrames = {
            [0.513719956429306] = { 0, RH = { 0.847053289762639, 0.333333333333333 }, Flags = { Linear = true, LockedY = true } },
            [1.51371995642931] = { 1, LH = { 1.18038662309597, 0.666666666666667 }, Flags = { Linear = true, LockedY = true } }
         }
      },
      CustomTool1 = Custom {
         Inputs = {
            PointIn1 = Input {
               SourceOp = "Tracker1",
               Source = "UnsteadyPosition",
            },
            PointIn2 = Input {
               Value = { -0.018609619140625, 0.0965928819444445 },
               Expression = "Point(PointIn1.X-0.5, PointIn1.Y-0.5)",
            },
            PointIn3 = Input {
               Value = { -0.0148504760742187, 0.0770811197916667 },
               Expression = "Point(PointIn2.X * NumberIn1, PointIn2.Y * NumberIn1)",
            },
            PointIn4 = Input {
               SourceOp = "Publish1",
               Source = "Value",
               Expression = "Point(PointIn3.X+0.5, PointIn3.Y+0.5)",
            },
            NumberIn1 = Input { Value = 0.798, },
            LUTIn1 = Input {
               SourceOp = "CustomTool1LUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CustomTool1LUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CustomTool1LUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CustomTool1LUTIn4",
               Source = "Value",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 550, 49.5 } },
      },
      Publish1 = PublishPoint {
      },
      CustomTool1LUTIn1 = 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 },
         NameSet = true,
      },
      CustomTool1LUTIn2 = 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 },
         NameSet = true,
      },
      CustomTool1LUTIn3 = 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 },
         NameSet = true,
      },
      CustomTool1LUTIn4 = 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 },
         NameSet = true,
      },
      Transform1 = Transform {
         Inputs = {
            Center = Input {
               Value = { 0.503151611328125, 0.499497178819444 },
               Expression = "CustomTool1.PointIn4",
            },
            InvertTransform = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 550, 82.5 } },
      }
   }
}
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

Dennis Fassbaender

  • Posts: 177
  • Joined: Fri Mar 11, 2016 11:16 pm

Re: Scale tracker movment?

PostMon May 10, 2021 7:05 pm

Thank you! This is amazing and works great!
Just need to understand what is happening there :D - are the tutorials for this?
Offline

birdseye

  • Posts: 349
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Scale tracker movment?

PostMon May 10, 2021 7:39 pm

That's uncanny, I was just about to ask the same question, I was trying to remove the parallax in a video because the only surface of an object I could track was a good bit closer to the camera than the area of interest. I gave up and scaled the video with a transform node, tracking the foreground feature and then using the that tracking data on the original sized video
I had got as far as using a transform node as a intermrdiate tool but couldn't get past 'Tracker1.TrackedCenter1*0.5', to get at the x and y points, the syntax you either know or don't know..

Does this also allow us to change the reference frame after tracking, which the standard point tracker surprisingly doesn't allow, without using a transform node to realign things at the desired frame after attaching the tracker?
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostMon May 10, 2021 8:14 pm

Dennis Fassbaender wrote:Thank you! This is amazing and works great!
Just need to understand what is happening there :D - are the tutorials for this?


It's not much more than would be covered in an applied geometry or linear algebra class. I thought I explained it in fairly exhaustive detail, but if there's something you don't understand, I'd be happy to try to clarify it.

I think probably the biggest thing is just to get used to the idea that transformations, especially scale and rotation, are always done relative to the (0,0) coordinate. So if you want to scale a transform, you move the center back there, do the scale, then move it back.

edit: Also, sometimes I find it useful to remember that colors can be treated just like 3d transforms. Gain = Scale = Multiplication. Brightness = Translation = Addition. Hue = Rotation = some trigonometry.

birdseye wrote:Does this also allow us to change the reference frame after tracking, which the standard point tracker surprisingly doesn't allow, without using a transform node to realign things at the desired frame after attaching the tracker?


No, what I described is purely geometry—it doesn't actually have anything to do with the Tracker itself. There is a script that will do it, though. Download SecondMan's TrackerPlus package from Reactor. It includes scripts for tracking forward and back by one frame, and for updating the reference frame. And conveniently, it puts all of those scripts on buttons on a new TrackerPlus macro.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

birdseye

  • Posts: 349
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Scale tracker movment?

PostTue May 11, 2021 8:36 pm

"It's not much more than would be covered in an applied geometry or linear algebra class.", I have always wondered what happened in there.

I can see why you took the ref frame to x0 y0. I had intended to subtract the ref position from the current x and y positions of each frame, use the multiplier on the result of the subtraction and then add the result of the multiplication to the current x and y. I can see that making the ref frame x0 y0 means the current x and y position then becomes the displacement in each frame, without the need for the subtraction and addition.
I have tried your comp and haven't sussed out what is going on yet or how to apply it. I will try to learn more about the custom tool it looks very useful. There is one problem, I have found, in trying to suss out what is going on. After tracking the simple saved shape below, when i click on play, Fusion locks up and needs to be restartedl, It may be due to ageing computer I'm using to get a feel for the software, although it has coped with everything else I've tried, so that is weird. I can drag the play head back and forth, so that lets me see the action. The terms 'Point' and 'PointIn' obviously mean something that I'm not aware of. The last computer programing I've done, apart fron CNC part programs, was on a Commodore 64, ;-) when poke's and peek's and assemblers/dissassemblers were all the rage, so the dust is very thick.

Code: Select all
{
   Tools = ordered() {
      Background2_1 = Background {
         Inputs = {
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 53.333, 26.1515 } },
      },
      Merge1_1 = Merge {
         Inputs = {
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            },
            Background = Input {
               SourceOp = "Background1_1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background2_1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 164.667, 61.9091 } },
      },
      Background1_1 = Background {
         Inputs = {
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftBlue = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 165.333, 17.0606 } },
      },
      Rectangle1 = RectangleMask {
         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" }, },
            Center = Input {
               SourceOp = "Path1",
               Source = "Position",
            },
            Width = Input { Value = 0.206231454005935, },
            Height = Input { Value = 0.357519788918206, },
         },
         ViewInfo = OperatorInfo { Pos = { 164.667, 98.2728 } },
      },
      Path1 = PolyPath {
         DrawMode = "InsertAndModify",
         CtrlWZoom = false,
         Inputs = {
            Displacement = Input {
               SourceOp = "Path1Displacement",
               Source = "Value",
            },
            PolyLine = Input {
               Value = Polyline {
                  Points = {
                     { Linear = true, LockY = true, X = -0.299146624136726, Y = -0.287927084888267, RX = 0.0478180129990715, RY = 0.168316831683168 },
                     { Linear = true, LockY = true, X = -0.155692585139512, Y = 0.217023410161238, LX = -0.0478180129990715, LY = -0.168316831683168, RX = 0.13091922005571, RY = 0.00247524752475254 },
                     { Linear = true, LockY = true, X = 0.237065075027619, Y = 0.224449152735495, LX = -0.13091922005571, LY = -0.00247524752475254, RX = 0.0283194057567316, RY = -0.145214521452145 },
                     { Linear = true, LockY = true, X = 0.322023292297814, Y = -0.211194411620941, LX = -0.0283194057567316, LY = 0.145214521452145, RX = -0.224233983286908, RY = 0.127062706270627 },
                     { Linear = true, LockY = true, X = -0.35067865756291, Y = 0.169993707190941, LX = 0.224233983286908, LY = -0.127062706270627 }
                  }
               },
            },
         },
      },
      Path1Displacement = BezierSpline {
         SplineColor = { Red = 255, Green = 0, Blue = 255 },
         KeyFrames = {
            [0] = { 0, RH = { 40.6666666666667, 0.0819640784676333 }, Flags = { Linear = true, LockedY = true } },
            [122] = { 0.2458922354029, LH = { 81.3333333333333, 0.163928156935267 }, RH = { 167.666666666667, 0.307229220113055 }, Flags = { Linear = true, LockedY = true } },
            [259] = { 0.429903189533366, LH = { 213.333333333333, 0.368566204823211 }, RH = { 303.333333333333, 0.499206950885086 }, Flags = { Linear = true, LockedY = true } },
            [392] = { 0.637814473588526, LH = { 347.666666666667, 0.568510712236806 }, RH = { 428, 0.758542982392351 }, Flags = { Linear = true, LockedY = true } },
            [500] = { 1, LH = { 464, 0.879271491196175 }, Flags = { Linear = true, LockedY = true } }
         }
      },
      Saver1 = Saver {
         CtrlWZoom = false,
         Inputs = {
            ProcessWhenBlendIs00 = Input { Value = 0, },
            Clip = Input {
               Value = Clip {
                  Filename = "D:\\tr scale.mov",
                  FormatID = "QuickTimeMovies",
                  Length = 0,
                  Multiframe = true,
                  Saving = true,
                  TrimIn = 0,
                  ExtendFirst = 0,
                  ExtendLast = 0,
                  Loop = 1,
                  AspectMode = 0,
                  Depth = 0,
                  TimeCode = 0,
                  GlobalStart = -2000000000,
                  GlobalEnd = 0
               },
            },
            OutputFormat = Input { Value = FuID { "QuickTimeMovies" }, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Input = Input {
               SourceOp = "Merge1_1",
               Source = "Output",
            },
            ["QuickTimeMovies.Compression"] = Input { Value = FuID { "DNxHR SQ 8bit_AVdh" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 278.667, 61.9091 } },
      }
   },
   ActiveTool = "Saver1"
}
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostTue May 11, 2021 11:19 pm

PointIn1 is the name of the first of the position controllers in the CustomTool. If you mouse over any input in the Inspector, you'll see its name appear in the lower left corner.

Point controllers, of course, have two dimensions, so if you need to address them separately, there's a way to do it. The Point() function converts two numbers into a single Point vector. Since you can't put separate expressions in X and Y, you have to use Point( <x expression> , <y expression> ) to do it.

To read numbers from a Point, you can take them right out of the vector components .X and .Y.

Thus, if I want the X portion of Transform1's Center control, I'll mouseover the control to find out that it's name is, indeed, Transform1.Center. Then I can grab that X value with Transform1.Center.X.

The CustomTool is, by far, my favorite Fusion tool, and it's rare that you'll see a comp come from my desk that doesn't have one in it. Obviously, the availability of all of those Points and Sliders is great, but it also lets you do all kinds of interesting math on an image, using up to two other images as controls, on a pixel-by-pixel basis.

I've written about it here: http://www.bryanray.name/wordpress/blac ... pressions/
Along with a general tutorial on procedural animation using expressions.

For your tracking problem, I have not encountered that particular crash scenario before. You might try setting Use GPU to Disabled on the Tracker. That's usually the first place I start to troubleshoot mysterious Fusion problems.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

birdseye

  • Posts: 349
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Scale tracker movment?

PostWed May 12, 2021 12:37 am

I tried a few times with different videos same result, moving the play head with the mouse is fine but hitting play locks up Fusion even with the GPU disabled in the tracker. It's a now long in the tooth Win7 computer that's way past an update, so the surprise is that's it's first refusal.
That is another useful tip regarding geting the values from tool. Just to check, I see the 'Transform.Center' in the viewer, do you also see it in the inspector, I don't.? That would also help with syntax and spelling. In this part of the world that would be 'Centre' and I'd be stumped for half an hour.
Anyway, some more things to play around with.
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostWed May 12, 2021 2:48 am

It shows up in the status bar in the lower left corner of the UI. The status bar will also show the names of inputs an outputs if you mouse over them in the Flow.

Untitled.jpg
Untitled.jpg (52.57 KiB) Viewed 1725 times


Another way to get the name of a parameter is by adding an expression to it, then clicking the '+' button. That will load the scripting name into the expression field.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

AdemJaffers

  • Posts: 16
  • Joined: Thu Sep 12, 2019 12:23 am
  • Real Name: Adem Jaffers

Re: Scale tracker movment?

PostThu Jan 27, 2022 12:13 pm

First, you'll need to reposition the Tracker's Unstable Position. The value at the reference frame is (0.5, 0.5), which is inconvenient for multiplication, so reset it to (0,0). So first, Connect Point In 1 to the Tracker's Unsteady Position.


Excuse me for possibly asking the obvious, but how does one reset the Unsteady position in this example.
Cheers
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostThu Jan 27, 2022 5:57 pm

first, Connect Point In 1 to the Tracker's Unsteady Position.

Next, set an expression on Point In 2 that subtracts 0.5 from Point In 1:
Point(PointIn1.X-0.5, PointIn1.Y-0.5)


The very next thing I said there was the procedure.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

AdemJaffers

  • Posts: 16
  • Joined: Thu Sep 12, 2019 12:23 am
  • Real Name: Adem Jaffers

Re: Scale tracker movment?

PostFri Jan 28, 2022 12:36 am

Bryan Ray wrote:
first, Connect Point In 1 to the Tracker's Unsteady Position.

Next, set an expression on Point In 2 that subtracts 0.5 from Point In 1:
Point(PointIn1.X-0.5, PointIn1.Y-0.5)


The very next thing I said there was the procedure.


Ahhhh, I missed the relation, but now you point it out. Cheers.
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostFri Jan 28, 2022 12:39 am

Yeah, it wasn't super clear. :D
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

birdseye

  • Posts: 349
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Scale tracker movment?

PostFri Jan 28, 2022 10:14 am

It's worth mentioning that the size control in the track modifiers will scale the tracking data.
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Scale tracker movment?

PostFri Jan 28, 2022 5:33 pm

I really don't know Modifiers very well. I ought to make it a point to use them more often so I can learn all of these interesting capabilities that I write long and complex expressions to cover. :lol:
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com

Return to Fusion

Who is online

Users browsing this forum: No registered users and 28 guests