I plugged in two textures and it gives me:
MaterialFloat4 Local0 = ProcessMaterialColorTextureLookup(Texture2DSample(Material.Texture2D_0,Material.Texture2D_0Sampler,Parameters.TexCoords[0].xy));
MaterialFloat4 Local1 = ProcessMaterialColorTextureLookup(Texture2DSample(Material.Texture2D_1,Material.Texture2D_1Sampler,Parameters.TexCoords[0].xy));
MaterialFloat3 Local2 = CustomExpression0(Parameters,0.00000000,0.50000000,Local0.rgb,Local1.rgb);
MaterialFloat3 Local3 = (Local2 + Material.VectorExpressions[1].rgb);
Which should be expected, even with dynamic branching. This is because at any moment, the [branch] if (something > something else) could become true and therefore it will need to evaluate the other input.
They key is in when it compiles the IF with either the [branch] or [flatten] methods. I’m assuming that flatten is the default when you don’t specify an attribute before the IF. As I showed earlier, it shows the [branch] in the custom code node, so unless you can uncompile the shader, to see for sure, I’m going to assume that it acknowledged the attribute parameter.
Also, I remade 's node graph, from the original post and this is the HLSL code that I get when I use the branch node of mine, instead of the IF node that he showed:
MaterialFloat Local0 = min(max(Parameters.TangentToWorld[2].b,0.00000000),1.00000000);
MaterialFloat3 Local1 = (GetWorldPosition(Parameters) / 512.00000000);
MaterialFloat2 Local2 = DDY(Local1.rg);
MaterialFloat2 Local3 = DDX(Local1.rg);
MaterialFloat4 Local4 = ProcessMaterialColorTextureLookup(Texture2DSampleGrad(Material.Texture2D_0,Material.Texture2D_0Sampler,Local1.rg,Local3,Local2));
MaterialFloat3 Local5 = (GetWorldPosition(Parameters) / 2048.00000000);
MaterialFloat2 Local6 = DDY(Local5.rg);
MaterialFloat2 Local7 = DDX(Local5.rg);
MaterialFloat4 Local8 = ProcessMaterialColorTextureLookup(Texture2DSampleGrad(Material.Texture2D_0,Material.Texture2D_0Sampler,Local5.rg,Local7,Local6));
MaterialFloat3 Local9 = CustomExpression0(Parameters,Local0,0.50000000,Local4.rgb,Local8.rgb);
MaterialFloat3 Local10 = (Local9 + Material.VectorExpressions[1].rgb);
Here is the replica of his node graph:
