Closed BOXOPHOBIC closed 5 months ago
for info
SG Branching node https://docs.unity3d.com/Packages/com.unity.shadergraph@17.0/manual/Branch-Node.html
SG Integer Node https://docs.unity3d.com/Packages/com.unity.shadergraph@17.0/manual/Integer-Node.html
SG Comparison Node https://docs.unity3d.com/Packages/com.unity.shadergraph@17.0/manual/Comparison-Node.html
Unity thread https://forum.unity.com/threads/keywords-branching.1534114/
Unity doc https://docs.unity3d.com/6000.0/Documentation/Manual/shader-branching.html
see ASE item #74
Branch Node Provides a dynamic branch to the shader. If input Toggle is true the return output will be equal to input True, otherwise it will be equal to input False.
This is determined per vertex or per pixel depending on shader stage. Both sides of the branch will be evaluated in the shader, and the branch not used will be discarded
@Dawie3565 quick note, the dynamic_branch pragma is unrelated to shader functions or nodes. It is a new declaration type which replaces shader_feature or multi_compile:
https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-declare.html
bumped to 1.9.3.4
@diogovtx this seems to be related to static switch node
see comments from Cristain
bumped priority up based on workflow needed by Cristain ASAP
Implemented in "Static Switch" node in v1.9.3.4:
Unity introduced a new #pragma type called dyamic_branch along side shader_feature and multi_compile. This created a dynamic branch behind the scenes while using the keyword state as a bool state.
All that is needed is to generate the pragma like this:
pragma shader_feature_local_vertex _FEATURE
Becomes
pragma dynamic_branch _FEATURE
The best would be to keep all node states(local, stage, etc..) so we can easly switch between shader feature or branch, but not generate the _local, _vertex etc code when used as branch
Edit: https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-declare.html