Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. 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:
    14
    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:
    464
    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.