Page 1 of 1

Frame Render Start?

PostPosted: Sun Feb 06, 2022 12:41 pm
by Rezzimx
Hi. I created a picture animation and for that I used Frame Render Script. But by rendering each frame, I'm losing a lot of performance. So I understand there is a Frame Render Start which can render just once and change all the parameters. But when I write exactly the same code there, the program closes. Maybe a different syntax is used there. Could you please tell me how to write this function in Frame Render Start? For example:
if (Size==0) then
Blend=0
elseif (Size==1) then
Blend==1
end

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 12:53 pm
by Sander de Regt
I'm just wondering: why do you want to use a script for this? i.e. what do you want to achieve that Fusion can't by default or with simple expressions and/or connections?

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 1:03 pm
by Rezzimx
Sander de Regt wrote:I'm just wondering: why do you want to use a script for this? i.e. what do you want to achieve that Fusion can't by default or with simple expressions and/or connections?

When I use Expressions or Frame Render Script I get 22 frames when playing, and if I don't use it then I get 60 frames. I don't need these lags when I can get 60 fps.

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 1:13 pm
by Sander de Regt
I usually animate the blend slider if I need to do this. I haven't measured the fps.
But the thing is that if you use a script Fusion cannot cache whatever it is it's doing for that particular node, because it has to check on every frame whether or not the script gives a different result.
If you use a manually keyed blend slider, Fusion can tell: ah, the blend value is the same as last frame, so no need to evaluate again. This might explain the difference in fps. You're asking Fusion to do something on every frame again and again. It's still software, so for us it's easy to say: hey, this is still the same, don't worry about it, but the software still has to check.

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 1:19 pm
by Sander de Regt
From your example

if (Size==0) then
Blend=0
elseif (Size==1) then
Blend==1
end


I take it that you've animated the size of the foreground image to be either 0 or 1, is that correct?
If so, you already have an animation that is the same that you want the blend slider to be.
So why not right-click on the blend slider and select connect to--> merge1 size (or whatever it's called in your case)?

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 2:28 pm
by Rezzimx
Sander de Regt wrote:I usually animate the blend slider if I need to do this. I haven't measured the fps.
But the thing is that if you use a script Fusion cannot cache whatever it is it's doing for that particular node, because it has to check on every frame whether or not the script gives a different result.
If you use a manually keyed blend slider, Fusion can tell: ah, the blend value is the same as last frame, so no need to evaluate again. This might explain the difference in fps. You're asking Fusion to do something on every frame again and again. It's still software, so for us it's easy to say: hey, this is still the same, don't worry about it, but the software still has to check.

Yes I understand that Frame Render Script checks every frame, so I wanted to try to do it in Frame Render Start so that the information is checked only in the beginning, and if everything is correct, I will not lose fps, but the problem is that I still do not know what syntax in Frame Render Start, so I do not know how to use the same ifelse there for example.

Regarding my example, this is just an example.

Re: Frame Render Start?

PostPosted: Sun Feb 06, 2022 2:33 pm
by Sander de Regt
In that case I'm afraid I can't help you, since it's pretty difficult to find a concrete solution with an abstract example to work with, so I'm still not sure what is you actually want to do. I'm not a scripter, so all my suggestions usually are based on the default tools, calculations and connections inside of Fusion.