Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to access a non property variable?

Discussion in 'Shader Graph' started by froslyakov, Jul 21, 2019.

  1. froslyakov

    froslyakov

    Joined:
    Dec 28, 2018
    Posts:
    5
    So my problem is , what i need to somehow access a mask which is generated inside my shader , but i don't know how can i do so , basically i need an output value of my subgraph. Is it possible to create a property with input field? Or a custom node which can set value in property?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    No.

    Generally, a shader’s only output is the final color value written to the current render target. Technically a shader if properly setup can output to multiple targets or with DX11 or better to arbitrary compute buffers, but Shader Graph has no support for either.

    If you have a mask you want to use in your shader, you either have to recalculate it every time in every shader, or render it out to a render texture before hand using command buffers.
     
  3. froslyakov

    froslyakov

    Joined:
    Dec 28, 2018
    Posts:
    5
    This might work for me , but how do i render it , i am pretty new to a shaders
     
  4. froslyakov

    froslyakov

    Joined:
    Dec 28, 2018
    Posts:
    5
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329