Jump to: Board index » General » Fusion

How can I enlarge a canvas with empty pixels and a value?

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

Vincent Boudewijn

  • Posts: 37
  • Joined: Mon Mar 24, 2014 10:05 pm

How can I enlarge a canvas with empty pixels and a value?

PostTue Sep 29, 2020 3:49 pm

Hey everyone,

Bit techy but here we go..

I'm learning fusion and I'm coming from Nuke.I'm a digital matte painter and in Nuke I used a function in the 'reformat' node that was very helpful for me using camera projections.

With this function, I was able to export a slightly bigger canvas than the project resolution. This way I had more room to paint a matte painting outside the camera frame, and then when setting up the camera projection back in Nuke, the matte painting would still cover everything regardless of camera shake and other wild movements. (Because I have painted extra matte painting bits outside of the frame)

In the reformat node I could set the mode to 'scale', now by dragging the slider from 1 to 1.5 it would enlarge my project from 2048x858 to 3,072x1,287, but giving me an empty border around my image.

When importing the matte painting back into Nuke I would use the earlier generated 1.5 value and divide it with my projector focal length to correct the projector. (For instance: 24mm/1.5=16mm)

I've found that there is a resize node, but it doesn't have the option to reformat by a scale value. This scaling value is very important for me.. Is there another way to get this working in fusion?

Thanks for taking the time to read. I hope one can answer!
Offline

Sander de Regt

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

Re: How can I enlarge a canvas with empty pixels and a value

PostTue Sep 29, 2020 4:07 pm

There is an actual scale option which lets you use a multiplication factor to resize, but this will resize the whole image. I am not sure what you're looking for, but maybe you can use the crop tool (it allows for cropping larger) and just type in *1.5 after the x value of your image and it will resize with this value giving you extra space outside of your image.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: How can I enlarge a canvas with empty pixels and a value

PostTue Sep 29, 2020 4:36 pm

Maybe I'm misunderstanding but can't they just merge the image over a Background with alpha = 0 and the required size? An expression could be used in the Background image size controls to set this size dynamically based on the image size of the input, multiplied by 1.5? This would result in the original image on a larger canvas, surrounded by transparent pixels.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: How can I enlarge a canvas with empty pixels and a value

PostTue Sep 29, 2020 8:01 pm

At the end of this post is node code for the Crop method, which works out a tad cleaner than the Background->Merge method both because it's only one node, and because it can use an expression that automatically enlarges according to the dimensions of the node connecting to Crop, and will continue to work whatever input image/generator is passed to that Crop node. The Background->Merge method can also use an expression for enlarging the canvas, if it referenced the Loader/MediaIn by name, or the input to the Merge by name. But the Crop is probably the cleanest way as it's self contained.

The expressions used to get the dimensions:
Code: Select all
self.Input.OriginalWidth * 1.5
self.Input.OriginalHeight * 1.5
It would be easy to make this expression generic, by adding a UserControl called, let's say, "Scale Amount" and then having the expression multiply by that. That would allow setting any scale amount using a slider, rather than having to update two expressions.

Vincent, if you weren't aware you can copy the below code and then paste it into Fusion and it will create the nodes in your current comp.

Code: Select all
{
   Tools = ordered() {
      Crop1 = Crop {
         NameSet = true,
         Inputs = {
            XOffset = Input { Value = -452, },
            YOffset = Input { Value = -254, },
            XSize = Input {
               Value = 2712,
               Expression = "self.Input.OriginalWidth*1.5",
            },
            YSize = Input {
               Value = 1524,
               Expression = "self.Input.OriginalHeight*1.5",
            },
            KeepCentered = Input { Value = 1, },
            Input = Input {
               SourceOp = "Loader1",
               Source = "Output",
            },
            ClippingMode = Input { Value = FuID { "None" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 1236, -109.606 } },
      },
      Loader1 = Loader {
         Clips = {
         },
         CtrlWZoom = false,
         NameSet = true,
         ViewInfo = OperatorInfo { Pos = { 1056, -109.606 } },
      }
   }
}
Last edited by TheBloke on Tue Sep 29, 2020 8:25 pm, edited 2 times in total.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline
User avatar

Bryan Ray

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

Re: How can I enlarge a canvas with empty pixels and a value

PostTue Sep 29, 2020 8:16 pm

DoD will expand naturally as elements are added. It's probably not necessary to use the SetDomain, unless you need to solve a specific problem.

It might also be a good idea to read the size from the Crop's input instead of the Loader's output. That way if you substitute a different Loader, or synthetic imagery, it will adapt to the change.

self.Input.OriginalWidth * 1.5
self.Input.OriginalHeight * 1.5
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: How can I enlarge a canvas with empty pixels and a value

PostTue Sep 29, 2020 8:18 pm

Ahh yes I see, as soon as eg a Paint node is added, the DoD expands.

Great tip re self.Input, I didn't realise that worked in an expression. Thanks, I'll update the previous post.

Actually that points to the Crop being the better method - because it can use self.Input, whereas the Background->Merge method cannot (it has no input in this setup). It could reference the Merge's input, but overall the Crop seems the cleanest method, as Sander suggested.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline

Vincent Boudewijn

  • Posts: 37
  • Joined: Mon Mar 24, 2014 10:05 pm

Re: How can I enlarge a canvas with empty pixels and a value

PostWed Sep 30, 2020 11:00 am

Thank you you guys, this is exactly what im looking for!! cheers!

Return to Fusion

Who is online

Users browsing this forum: No registered users and 35 guests