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

Resolved Universal RP and Shader Graph not working in other computer

Discussion in 'Shaders' started by Acronox, Oct 21, 2021.

  1. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    So I'm currently working with these 2 packages and it works ok in my main computer, but I use another computer and when I clone the project (via Github or Unity Collab, even copying the files manually) the shader I created (and any new one) doesn't work.

    I think this is not a problem with version managing and instead it's a dependency one. Does my second computer needs something to get this libraries/package to work? I've read some posts and see that some people had this problem and solved by installing DirectX11 or updating it, but doesn't work for me. Or is this a hardware problem, bc my main computer has a graphic card and I think this one has an Intel integrated one ...

    Anyways, thanks for reading. :)
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Can you describe what you mean by "doesn't work"? Do you mean the shader fails to compile? And if so, what's the error it shows? If you select the shader in the project view, it should show a list of errors in the inspector if it's not compiling, otherwise you can right click on it and reimport the shader to have the errors show up in the console (usually).

    If you mean it doesn't show the way you expect it to, you'd need to show screenshots of what it looks like when it works, and what you're seeing when it doesn't.

    On your second computer, can you create a new URP project from Unity Hub and have it work? Can you make a basic shader graph in that project on that computer and have it still work? If so you're probably missing some of the files needed for the project.
     
  3. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    Oh, sorry about my bad explanation. When I say "It doesn't work" I mean that it compiles, but it literally doesnt work. In the shader preview, as you can see:

    Captura.PNG

    It literally doesn't work. I'm not rn in my main computer, but it should display the card painted on cyan. You can see that also in the game it is transparent whenever I activate it (it has to activate when I click it) it looks transparent:

    upload_2021-10-21_17-4-21.png

    (It should be shown in cyan within the red lines)

    upload_2021-10-21_17-4-45.png

    I created a new project and try to use the Universal RP and this is when I'm using the sprite default material (which doesn't render with the library shader)

    upload_2021-10-21_17-12-35.png

    However if I use the material that it comes by default, it should appear black or skyblue, and it does by a milisec (I can't take a screenshot because this happens just the first time and it's very fast) and then just becomes transparent:

    upload_2021-10-21_17-14-26.png

    I don't really know why this happens, but this is all evidence I can get. (Btw, as you can see, my main language is not english so sorry if I make some mistakes while typing :) )
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    That CardColor has an alpha of 0.0.
    upload_2021-10-21_15-18-36.png
    If the materials you are using also have an alpha of 0.0, then it'll be invisible. This is working as intended. The node preview won't be invisible because the previews ignore the alpha value and only show the RGB color value.

    You can also reproduce the exact same visuals without using a custom shader / material here by modifying the sprite renderer's color. It too is just multiplying the sprite by that color value. This will also be faster rendering wise as it allows all the sprites to stay batched.

    As for why your last example isn't showing, you're using the URP lit sprite shader, which I think has a bug that it goes invisible if there are no lights in the scene?
     
  5. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    Ok, now I'm on my main computer and, as you can see, the alpha is still in 0 but this works (and this should be the correct working). I tried changing the color manually but I didn't get quite the effect and I was gonna add a glow on top of that.

    upload_2021-10-21_23-32-28.png
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Can you take a screen grab of the shader graph in that project? I’m curious if there’s something different with the Master Node. Namely I think the Sprite Unlit has a separate alpha input in some versions of the URP. Which if that’s the case it means the problem is your two computers have different versions of the URP on them.
     
  7. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    Sure, this is the Shader Graph

    upload_2021-10-22_0-56-54.png

    Edit: Btw, about your question of Sprite-Lit-Material, you're right, it doesn't work correctly bc there's no light, but the result should be the sprite in fully black.
     
    Last edited: Oct 22, 2021
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Honestly the fact that it shows anything with the alpha set to 0.0 is the bug in my mind.

    But also the URP's 2D features are kind of broken and buggy, so I can't really give you any more advice, apart from maybe upgrade to a newer version of Unity & URP. Unity 2021's URP 2D renderer seems a lot more stable.

    I can tell you I've never had a sprite shader graph display anything in any version of the URP I've played with before 2021, so part of me is more surprised it worked to begin with.
     
    Acronox and JamesArndt like this.
  9. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    Thank you for your advice ... well I guess I'll try in a third computer and if that doesn't work maybe I'll upgrade Unity version to see if this works. But isn't there a less buggy Shader library?
     
  10. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    The 2D renderer for the URP is still experimental. If you want something that actually works consistently, don't use the URP. Use the built in renderer's existing 2D renderer.
     
    Acronox likes this.
  11. Acronox

    Acronox

    Joined:
    Apr 29, 2021
    Posts:
    11
    I upgraded Unity and yes, it works. Since I don't know how to develop shaders in the traditional way I think I'll keep this solution and probably change if I consider it convenient, thank your for your help!!!