Jump to: Board index » General » Fusion

Simple expression for strobing makes node turn red?

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

Joelarvidsson

  • Posts: 201
  • Joined: Fri Oct 12, 2012 6:18 am

Simple expression for strobing makes node turn red?

PostTue Feb 27, 2024 10:57 am

Hi Im an editor and have not used fusion that much. But I like to create an expression that is going a brightness/contrast node. The expression will be on the gain slider.

The expression is designed to create a strobing effect that starts with more frequent black frames and gradually decreases the frequency of these black frames over time.

Below is the expression but it does not work, it turns the brightness/contrast node red and also the output node. But I guess is because it after the node that failed.

frame = time; duration = 100; intensityStart = 25; fadeRate = 0.5; currentIntensity = math.max(0, intensityStart - (frame / duration) * fadeRate); if frame % math.max(1, math.floor(currentIntensity)) == 0 then 0 else 1 end

Do you se what is causing the node to go red? Thanks! /Joel
Resolve Studio 18.5, Studio driver 536.99
Supermicro 2 Intel Xeon E5-2687W 3.10GHz processors. 64GB ram. GTX 1080Ti GPU Samsung PM893 SSD for system, Intel ssd for cache. Windows 10 pro. Qnap gnap TS-1685 for media. 925MB/s & 1062MB/s
Offline

Sander de Regt

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

Re: Simple expression for strobing makes node turn red?

PostTue Feb 27, 2024 11:01 am

In simple expressions you need to use
Code: Select all
iif
instead of
Code: Select all
if

Personally I'd always try to do this with modifiers and other calculations first, before writing such a lot of code. For example a Shake or Perturb modifier with values that change over time, gives you much more interactive control, without having to type things over and over again.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

Joelarvidsson

  • Posts: 201
  • Joined: Fri Oct 12, 2012 6:18 am

Re: Simple expression for strobing makes node turn red?

PostWed Feb 28, 2024 5:46 am

Thanks for your input Sander de Regt, it did not help in this case but still it was very kind of you share your thoughts and knowledge. Thank you!
Resolve Studio 18.5, Studio driver 536.99
Supermicro 2 Intel Xeon E5-2687W 3.10GHz processors. 64GB ram. GTX 1080Ti GPU Samsung PM893 SSD for system, Intel ssd for cache. Windows 10 pro. Qnap gnap TS-1685 for media. 925MB/s & 1062MB/s
Offline

Joelarvidsson

  • Posts: 201
  • Joined: Fri Oct 12, 2012 6:18 am

Re: Simple expression for strobing makes node turn red?

PostWed Feb 28, 2024 6:19 am

I think Im starting to se the problem. It's because I created an adjustment layer on the edit page to be more flexible. So I need to reconstruct the expression to alter abit since it does not have any media input file.
Resolve Studio 18.5, Studio driver 536.99
Supermicro 2 Intel Xeon E5-2687W 3.10GHz processors. 64GB ram. GTX 1080Ti GPU Samsung PM893 SSD for system, Intel ssd for cache. Windows 10 pro. Qnap gnap TS-1685 for media. 925MB/s & 1062MB/s
Offline
User avatar

Bryan Ray

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

Re: Simple expression for strobing makes node turn red?

PostWed Feb 28, 2024 9:12 pm

For a multi-line expression, you have to start it with a colon : and you have to deliberately use the return keyword to send the value out to the input.

Code: Select all
:frame = time; duration = 100; intensityStart = 25; fadeRate = 0.5; currentIntensity = math.max(0, intensityStart - (frame / duration) * fadeRate); if frame % math.max(1, math.floor(currentIntensity)) == 0 then return 0 else return 1; end


I have not evaluated the expression to know if it does what you want or not, but that ought to at least get it to evaluate successfully.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com

Return to Fusion

Who is online

Users browsing this forum: No registered users and 48 guests