Shader optimizations (skipping AND operands etc.)

@midgunner66 so I followed your instructions and realized I used to do it that way, until a few years back I (mis)read somewhere that IFs are bad, and also decided that multiplying parts of a mask (like in my initial example) is more readable and easier to maintain for me than the IF sequence.

Also, wouldn’t this be faster? Change A from 1 to 0 in the final IF, which allows disconnecting A==B. Because connecting it makes the material compile in a different way, correct?

[Animated GIF]
UE4 If Optimization.gif

But yeah, even you said judging from Chosker’s link this may not work either way. I skimmed through that thread and I must say it’s a bit overwhelming… If even you guys can’t agree/be sure how this stuff works…