Search Unity

Skewing/ Shearing From Inside Shader?

Discussion in 'Shaders' started by Senshi, Nov 19, 2014.

  1. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    Hey everyone,

    I have a fairly typical, rectangular HP bar that has its top-right vertex pulled out to the right (see image). I'm having it deplete by using a custom "Mask By Offset" shader that I applied to a new uGUI Image object. Ideally, I would like to skew the sprite, so that as it depletes the slope on the right becomes less and less pronounced, until perfectly vertical. Since we can't access a sprite's mesh, I was wondering if I could perhaps achieve the same effect through a shader. Essentially what (I think) needs to happen (for this specific use-case) is that the bottom-right vertex of the generated mesh plane needs to shift to the right my some amount. Is there an easy way of doing this? Or perhaps there's a better solution altogether?

    Thanks in advance,
    Patrick
     

    Attached Files:

  2. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    A new month, a new round! Anyone? =)
     
  3. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
  4. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    @Ben BearFish I'm afraid not, though I haven't revisited the issue in quite a while either.