SamuZai
DavidKahlVFX
DavidKahlVFX

patreon


Quicktip # 5 - Control the Switch

For this weeks quicktip I wanted to share some methods to use and control switch nodes.  

There is alot of potential in the use of these and allow you to create very dynamic node trees.

And as always feel free to share your own way of using these! ;-)

Option 1 - The Toggler

This is the obvious way to use switch nodes. You define a toggle ui element which is then directly referenced on the switch node. Enable the toggle and you get input 1. Otherwise it's 0. 

Important to point out - this only works for a two way decision. 

Option 2 - Modulo

This approach is a bit more versatile. By using the modulo operator with the amount of possible options you switch through each of them with every full integer of the condition. In this example I am using $F which means each frame another switch is active. 

Here you should note that Frame 1 also starts with switch 1. Input 0 will be active on Frame 4 and all Frames you can divide by 4.

Option 3 - Attribute Mode

Also a good method to control the flow of you nodetree is using attributes. Her implemented through a slider for manual changes but this could also be an automated process. 

However you control it - you simply save the switch input as an detail integer attribute which you then can read on the switch node. 

Option 4 - if condition

And finally you can also use expression with an if condition in the switch node. In this example I take the result of the modulo example which changes the point amount on each frame that I now can test with the expression npoints() in a condition. 

The idea is - if the condition is true the first value counts and if not it is the second value. So again an option to chose between 2 possible results. However you could workaround that limitation with a nested if condition. But then again why not chose another Option all together...


Let me know if this one was useful!

Cheers

Dave


Quicktip # 5 - Control the Switch

More Creators