Dynamic flow control in materials

yes I mean like that, but with a proper setup (at least a texture inside each branch), and scrolling to the part in HLSL where the CustomExpression0 function is used in your case