I’m trying to build a relatively complicated material that requires branching flow control, but having trouble figuring out how to do it.
Let’s say I have a scalar value (x) which can be 0-70, and I want to change various features of the material based on where this value sits in this value range. For example:
x > 0 && x <= 10: Feature Set 1
x > 10 && x <= 20: Feature Set 2
x > 20 && x <= 30: Feature Set 3
… and so on
The only flow control within a material seems to be the Math If node, which takes a float and outputs another value based on three possibilities (<, >, ==). So this works fine for comparing two values, but doesn’t give the opportunity (as in the Branch node in normal Blueprint) to continue testing the value down a more complicated logic branch. Or does it? Am I missing something here?
In ordinary BP, I could either convert my scalar value to an integer and then Switch on Int with the number of outputs as possibilities. Or build logic like this:
x > 0 && x <= 10 ?
True: Feature Set = 1;
False: x > 0 && x <= 10 ?
True: Feature Set = 2;
Is there a way to do this inside a material?
Since the effect I am creating is dependent upon pixel/vertex positions, it doesn’t seem like I can place this logic outside the material, so I need to find a way to have multiple possibilities based upon a value inside the material editor itself, if possible. Am I off the map here?!