Search Unity

Feature Request For Loop as a node support ..and my suggestion

Discussion in 'Shader Graph' started by URocks, Sep 29, 2019.

  1. URocks

    URocks

    Joined:
    May 1, 2014
    Posts:
    159
    What I am missing inside shader graph is for loop node. A lot of people don't want to write it with custom code because it doesn't make sense for visual programming to still need to write some code.

    The concept would be the main Iterator node where inputs will be a number of loops and output will be the current index of loop.

    Then we need in conjunction something like Switch node which will have an index of the loop as input
    Then we can define the type of the switch node outputs from the dropdown (integer, vector3, color, etc..) and also we will define how many inputs (with the same type as output) the switch node will have (usually same number as our Iterator loop count)

    Then we will plug our different variations (for example of colors) inside Switch inputs plus the loop index from Iterator and the switch will output different result from the different index(in this case color).

    Then we can connect Switch or more different Switch outputs to some subgraph inputs.
    In the last step need to process this subgraph results (outputs) from Iterator and switch nodes with some aggregator node which will collect all these different results (made from all loop indexes) or directly add them together or combine them (we cand define this in dropdown) for example in an array or combine them somehow directly...

    This is just my suggestion so please think about it, I hope is doable
    Thanks
     
    Last edited: Sep 29, 2019
  2. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    This would be great for implementing POM and raymarching in a more flexible way.
     
    bobbaluba likes this.