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 Shader issue with 2D sprite

Discussion in 'Shaders' started by atheoran, Jan 11, 2023.

  1. atheoran

    atheoran

    Joined:
    Oct 11, 2017
    Posts:
    2
    Hello all,

    I'm trying to create an outline glow shader my 2d sprites.
    The sprite's I'm using have a transparent background.. but for some reason the sprite gets some background artifact added to it and I can't figure out why..

    I'm using:
    * Unity - 2021.3.16f1
    * Universal RP - 12.1.8
    * Shader graph - 12.1.8

    Original sprite:
    blue sword.png
    Sprite with my shader...
    blue sword with shader.png

    Other full example:
    Other example.png


    I hope someone knows some things I can try, and thanks in advance!

    Edit: added another image, added versions
     
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,539
    Set the import settings compression to High Quality or None and see if that fixes the issue.
    But also, you're Stepping the value by 0... So you're going to lose all the gradient values of that alpha.
     
  3. atheoran

    atheoran

    Joined:
    Oct 11, 2017
    Posts:
    2
    Didn't help :/ but it's so wierd, even when I only put a sample texture 2D its already like that..
     
  4. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,539
    That's why I mentioned the stepping value in your shader. I think your math with the nodes there might be off a bit..
     
  5. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,503
    It doesn't look like you're actually using your alpha? Often your image editor will extend colors behind transparent areas with adjacent colors to reduce image size (the weird blobby triangles/squares).
    d - Copy.png