Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Sharder Graph - Texture or slider.

Discussion in 'Graphics Experimental Previews' started by colinstewart, Oct 10, 2018.

  1. colinstewart

    colinstewart

    Joined:
    May 1, 2013
    Posts:
    3
    Hi,

    So I don't know if this is possible at all with Shader Graph currently, but I'd like to have it similar to how the standard shaders work, if I don't have a map plugged into metalness (for instance) I will have a slider to control the value and if I were to plug a map in the slider would disappear/be greyed out/no longer have an effect.

    I'm probably just being an idiot as I know there are logic features in there I just can't seem to get my head around it.

    Sorry if this has been answered somewhere else and thank in advance for any help you can offer.

    Colin
     
  2. colinstewart

    colinstewart

    Joined:
    May 1, 2013
    Posts:
    3
    Got something working, It isn't perfect but it will do for now. Exposed a Boolean value into a branch node, the user can define if two specific map types are missing now and if they are use a slider to set a value.

    As I said not perfect but works for what I am doing for now.
     
  3. ThePilgrim

    ThePilgrim

    Joined:
    Apr 25, 2013
    Posts:
    8
    If you don't want to expose a boolean to the user, I found you can create a custom function node that checks that the dimensions of a given texture are greater than 4x4 (which is apparently the default dimensions if you don't give it a texture).
    upload_2020-7-14_8-19-59.png
     
  4. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    392
    This is a cool hack, but I am concerned that dependent texture reads are expensive.
    Also, the keyword approach means multiplying variants that need to be compiled and loaded at runtime.
    I guess the real solution will be when custom inspectors are supported for shader graph materials, but I would love to see something sooner that doesn't have a runtime performance impact.
     
unityunity