# VFX Logic operators with more than 2 inputs?

Discussion in 'Visual Effect Graph' started by eranhaas, May 29, 2020.

1. ### eranhaas

Joined:
May 30, 2013
Posts:
5
I was wondering if there is an easy way to compare more than 2 bools using something like the "and" or operators. I ended up making myself a messy subgraph to deal with it, but I was wondering if I was missing a simpler way.

Thanks.

2. ### Livealot

Joined:
Sep 2, 2013
Posts:
228
There is an And logic block that may do what you want.

I think I have a related question which is how do I replicate if (blah) else if (blah) else() in vfxgraph?

I want to link some compare blocks together, but seems awkward

For example:
• if X < 5, do a small effect
• else if 5 < X < 10, do a medium effect
• else X > 10, do a big effect

3. ### pjbaron

Joined:
Jan 12, 2017
Posts:
53
eranhaas: the sub-graph shouldn't be too messy, just (N - 1) 'AND' operators per N inputs. Unless you're doing lots of them I'd happily go with sub-graphs for AND3, AND4, etc. Although some operators allow additional inputs, they're the ones with an unlabelled input at the bottom left of the node - the logic ones do not support this.

AND3 subgraph operator

livealot: I came across a 'switch' block recently - depending on your logic that might work quite well (for your example do an integer divide by 5 then switch on the result for 0, 1, 2)

In this example the switch controls the velocity of particles involved in the effect.

Last edited: Jul 1, 2020
Livealot and florianhanke like this.
4. ### Livealot

Joined:
Sep 2, 2013
Posts:
228
Thanks @pjbaron for the switch idea. That would be useful if the switch block could use expressions rather than static values.

Here's what I meant by an awkward approach to if/else/then using a classic test of where an input is relative to two thresholds (lower, between, above)

I'm hoping there is a much simpler way to do this