Hi!
I was hoping to get some clarity about the Dynamic Branch material function found here:
/Engine/Functions/Engine_MaterialFunctions02/Utility/DynamicBranch
The description says:
“The code connected to the “Color Input 1” will be executed if the alpha is greater than 0 and the “Color Input 0” input code will be evaluated if the alpha is 0. Dynamic branches are best used when masking 20 or more instructions or a texture sample.”
However, it does when viewing the generated hlsl (DirectX SM6) it doesn’t seem to implement an actual branch, instead produces this:
float3 Local22 = select_internal( (abs( Local1 - 0.00000000f) > 0.00000100f) , select_internal( ( Local1 >= 0.00000000f) , 12.50000000f , Local21 ) , Local21 );
and I would expect to see something more like:
[branch]
if(local1 > 0)
{
//code for output 1
}
else
{
//code for output 2
}
When looking inside the Dynamic Branch function, it is just an “if” node checking if the input > 0
Please can you confirm if this is all intended or if it is mislabed?
I am aware of future intention to add “if-then-else” node feature, as mentioned at 38:16 of https://youtu.be/KYmd_LNlw2c?si=OHvOyX2-PE3iG4As&t=2296 which looks to be a true dynamic branch, does this have a planned release version yet? And if possible please could you tell me the scope of the engine changes required to implement that node.
Thank you!
UDN Dynamic Branch.zip(432 KB)