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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How does sprite extrude edges work?

Discussion in '2D' started by madGlory, Apr 15, 2020.

  1. madGlory

    madGlory

    Joined:
    Jan 12, 2016
    Posts:
    44
    How exactly does sprite extrude edges work? Whether I set it to 0 or to Max it doesn't seem to do anything different.

    Does anyone know how to use this feature properly and what problem it is designed to solve?
     
  2. DiegoDePalacio

    DiegoDePalacio

    Unity Technologies

    Joined:
    Oct 28, 2009
    Posts:
    506
  3. madGlory

    madGlory

    Joined:
    Jan 12, 2016
    Posts:
    44
    So the application that I was trying to use it for is drawing a border around a sprite. I wrote a simple shader to test out if anything was being affected by the value. The shader frag function simply returns white.

    The result appears to be the exact same size with extrude edges width of 0 and of 32. I attached 2 photos, the first is the border width of 0 and the second is 32. Maybe I'm understanding wrong but I was under the impression that the generated mesh size would affect the draw area of the shader?

    I was hoping to use the extrude edges to add more draw space for a custom outline shader that I was working on which is currently being cut off. It would be much easier to extrude the edges of all of my sprites than it would be to change the real size and reimport all 300 of them. But the feature seems to be doing nothing for me. Am I missing a key piece of information?
     

    Attached Files:

  4. Katoha

    Katoha

    Joined:
    Feb 17, 2020
    Posts:
    5
    Did you ever find a solution to this?
     
  5. noonoox

    noonoox

    Joined:
    Nov 15, 2014
    Posts:
    14
    I really want to know the answer as well! I'm having a similar problem.
     
  6. madGlory

    madGlory

    Joined:
    Jan 12, 2016
    Posts:
    44
    No nothing yet, I filed a bug report and Unity responded by saying everything was working normally which doesn't appear to be the case as the extrude edges function is clearly not affecting the sprite at all.

    I sent back a video showing the issue as clearly as possible and am now awaiting a reply.
     
  7. madGlory

    madGlory

    Joined:
    Jan 12, 2016
    Posts:
    44
    I just got a reply from unity saying this:

    "It seems that the Sprite is not affected by the option because its full rect already takes up all the texture. The developer told me that Extrude Edges essentially extends the Sprite’s Mesh to the surrounding alpha pixels. The workaround would be to make the Texture bigger by adding some alpha pixels and then using the Extrude Edges option to determine how far to extrude the edge of the Texture."

    Considering we have 300+ sprites in our game, adding white space to all of them is not a simple solution.

    Not quite sure where to go from here.
     
    godynl likes this.