Search Unity

Question ShaderGraph treating data types strangely.

Discussion in 'Shader Graph' started by Ben_at_Work, May 24, 2022.

  1. Ben_at_Work

    Ben_at_Work

    Joined:
    Mar 16, 2022
    Posts:
    80
    Most of the time ShaderGraph automatically converts between similar data types, either adding or trimming channels based on context. On a recent graph, however, I've been constantly prevented from connecting even same-type data together.

    As an example, I'm unable to put a saturate node's float output into more than one of the float inputs of a combine node. Once it's plugged into one channel, it's unable to to connect to the others. However, I can plug it into three preview nodes, then each of those into the combine node to get the redundant channels that I had intended. Even the preview nodes can't plug into more than one, though.

    In another situation, I have a vector2 node passing through a multiply node into a remap node. The data type is the same throughout. For some reason I'm unable to directly replace the connect to the remap node so as to cut the multiply out. I have to delete the connection, then redraw it.

    This pattern is repeated throughout the entire graph, and it's throwing off my intuitive understanding of when and how data types are transferred between nodes. I opened a separate graph and the above limitations don't exist. I can plug a single float into as many of the combine node's inputs as I want. I can replace and interchange connections without deleting the existing connection all the way down the line.

    Is there some setting I've toggled that makes this happen? Is my graph somehow corrupted? Or is there something I just don't get about data types?

    badConnectors.png
     
  2. Ben_at_Work

    Ben_at_Work

    Joined:
    Mar 16, 2022
    Posts:
    80
    Shader Graph will apparently treat the standard redirect node as separate in the same way it treats the Preview nodes in the above image. Since the redirect nodes can be deleted without breaking the connection, I can link three "unique" redirect nodes, then delete all of them so that the single output is properly connected to all three inputs.

    I don't know why Shader Graph is insisting I work this way on this particular graph.
     
  3. Ben_at_Work

    Ben_at_Work

    Joined:
    Mar 16, 2022
    Posts:
    80
    A few of my linking issues, but not nearly all unfortunately, came down to the difference between the shader's vertex stage and fragment stage. Some data sources are not available during vertex stage, so the node branches that use them are unable to connect to the other side.

    Unity ought to have a tooltip to explain that because I hadn't traced it through to know what wasn't available.

    The strange bypass I described above is an example of an issue that has nothing to do with the shader's stage, so the problem is ongoing.