Jump to: Board index » General » Fusion

Frame render script?

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

OliAndelain

  • Posts: 8
  • Joined: Tue May 12, 2020 9:22 pm
  • Real Name: Oli Seaman

Frame render script?

PostFri May 15, 2020 8:28 pm

What's the general view of using a "frame render script" in a fusion composition in Resolve 16.2?

Are they considered reliable? I using one (set on a transformation node) to move an image but it's not very reliable, quite irregular results with it.

Are there any known issues or 'best practices' I should know about?

Thanks for any tips!
Offline

cadeg_rsh

  • Posts: 248
  • Joined: Tue Jun 05, 2018 5:46 pm
  • Real Name: Roman Shigaev

Re: Frame render script?

PostFri May 29, 2020 8:55 am

OliAndelain wrote:What's the general view of using a "frame render script" in a fusion composition in Resolve 16.2?

Are they considered reliable? I using one (set on a transformation node) to move an image but it's not very reliable, quite irregular results with it.

Are there any known issues or 'best practices' I should know about?

Thanks for any tips!


So... Scripting in Fusion is very interesting thing. It declared, but nobody knows how it work.
I spend couple months to understand it. And I was read Scripting Guide. But...
Offline
User avatar

Bryan Ray

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

Re: Frame render script?

PostFri May 29, 2020 6:54 pm

Plenty of people know how scripting in Fusion works. It's true, though, that the documentation is insufficient.

Personally, I've never had much use for the frame render scripts. They just don't figure into my workflow at all, so I don't have an opinion about their reliability. For modifying a tool's inputs, I use simple expressions on the input. Even very complex behaviors can be achieved using the expressions, although they do get confusing the more you cram into one.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

cadeg_rsh

  • Posts: 248
  • Joined: Tue Jun 05, 2018 5:46 pm
  • Real Name: Roman Shigaev

Re: Frame render script?

PostSat May 30, 2020 7:02 pm

Bryan Ray wrote:Plenty of people know how scripting in Fusion works. It's true, though, that the documentation is insufficient.

Personally, I've never had much use for the frame render scripts. They just don't figure into my workflow at all, so I don't have an opinion about their reliability. For modifying a tool's inputs, I use simple expressions on the input. Even very complex behaviors can be achieved using the expressions, although they do get confusing the more you cram into one.


Sorry, but if I need to check some conditions while it render every frame, what should I do?
Offline
User avatar

Bryan Ray

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

Re: Frame render script?

PostSat May 30, 2020 10:31 pm

Describe what you need to happen, and I'll try to help you through it.

"Simple" expressions can actually be quite complex. Take this node, for instance:

Code: Select all
{
   Tools = ordered() {
      RandomSwitch_2_1 = Dissolve {
         Transitions = {
            [0] = "DFTDissolve"
         },
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            Mix = Input {
               Value = 0,
               Expression = ":t0=0; randomseed(RandomSeed); while t0<=time do off=random(MinimumOffTime,MaximumOffTime); on=random(MinimumOnTime,MaximumOnTime); t=time-t0; t0=t0+on+off; end; n=t0-on; if t>off then return 1; else return 0; end",
            },
            Comments = Input { Value = "Randomly switches the Mix control between 0 and 1. Adjust the frequency of switching using the Max and Min sliders. \r\n\r\nMuse Effects Elements Library, Glitch Tools Collection\r\nby Bryan Ray.\r\nwww.musevfx.com", },
            MinimumOffTime = Input { Expression = "controlPanel_timeStutter_1.MinOffTime", },
            MaximumOffTime = Input { Expression = "controlPanel_timeStutter_1.MaxOffTime", },
            MinimumOnTime = Input { Expression = "controlPanel_timeStutter_1.MinShuffleDuration", },
            MaximumOnTime = Input { Expression = "controlPanel_timeStutter_1.MaxShuffleDuration", },
            RandomSeed = Input {
               Value = 67,
               Expression = "controlPanel_timeStutter_1.RandomSeed+250",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 0, 43.15 } },
         UserControls = ordered() {
            MinimumOffTime = {
               INP_MaxAllowed = 10000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_ControlPage = 0,
               INP_MaxScale = 30,
               INP_Default = 3,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               LINKS_Name = "Minimum Off Time",
            },
            MaximumOffTime = {
               INP_MaxAllowed = 10000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_ControlPage = 0,
               INP_MaxScale = 60,
               INP_Default = 10,
               INP_MinScale = 1,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               LINKS_Name = "Maximum Off Time",
            },
            MinimumOnTime = {
               INP_MaxAllowed = 10000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_ControlPage = 0,
               INP_MaxScale = 30,
               INP_Default = 3,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               LINKS_Name = "Minimum On Time",
            },
            MaximumOnTime = {
               INP_MaxAllowed = 10000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_ControlPage = 0,
               INP_MaxScale = 60,
               INP_Default = 10,
               INP_MinScale = 1,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               LINKS_Name = "Maximum On Time",
            },
            RandomSeed = {
               LINKID_DataType = "Number",
               LINKS_Name = "Random Seed",
               IC_ControlPage = 0,
               INPID_InputControl = "SliderControl",
               INP_Default = 0,
            }
         }
      }
   },
   ActiveTool = "RandomSwitch_2_1"
}


The trick of starting the expression with a colon lets you write multi-line Lua code, but you have to include an explicit return statement.

The expression on the Mix control segments the timeline into intervals of random length, with minimum and maximum durations defined by the various user controls.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

OliAndelain

  • Posts: 8
  • Joined: Tue May 12, 2020 9:22 pm
  • Real Name: Oli Seaman

Re: Frame render script?

PostSun May 31, 2020 5:34 pm

Bryan Ray wrote:Simple" expressions can actually be quite complex. Take this node, for instance:


Thanks very much for your help on this, your scripting technique is far more reliable than what I was doing before - it's saved my project!

For interest of anyone else following this, I was using a 'transform' node to move an image of a kangaroo across the screen. I right-click on the transform's 'Center' control, chose the bottom 'Expression' option and entered the following in the box:

Code: Select all
{1.3-comp.CurrentTime/80, math.abs(math.sin(comp.CurrentTime/10)/3)+0.3}

The first part changes the X of the kangaroo to move across the screen and the second part implement a sinusoidal pattern which looks like he's bouncing - works quite well for a single line!

At first I thought it wasn't working, it seemed to be okay in some places but still jumped around in an annoying way, but I now think that was some aspect of caching my old flawed way, since repeatedly making nominal edits and rerunning caused it over time to transform into a more reliable rendering.

I also hadn't appreciated the richness of options from right-clicking a control option and choosing 'modify with' - I suspect buried in that complexity is the answer to a bunch of other questions I've had about Resolve Fusion (which google has not been able to answer!)

Thanks,
Oli
Online

Sander de Regt

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

Re: Frame render script?

PostWed Jun 03, 2020 8:04 pm

(which google has not been able to answer!)

When it comes to Fusion, Google isn't usually the place to find your answers.
There are a couple of hidden gems in the Youtube community who do great Fusion tutorials that are only seen by 200 people. But in general: if you want to find answers the best place to go is the wesuckless forum at www.steakunderwater.com. It's all Fusion all the time ;-)
Sander de Regt

ShadowMaker SdR
The Netherlands

Return to Fusion

Who is online

Users browsing this forum: No registered users and 62 guests