Search Unity

Unity UI Soft Shadow and Rounded Corners on UI

Discussion in 'UGUI & TextMesh Pro' started by lovemoebius, Feb 12, 2019.

  1. lovemoebius

    lovemoebius

    Joined:
    Dec 12, 2016
    Posts:
    88
    Hello,

    I'm fairly new to using Unity's UI system and coming from a web dev background I'm having a bit of trouble adjusting to this.

    There's two thing I really need:
    1. Soft Shadows (so being able to control direction, blur and opacity)
    2. Rounded Corners on image (I could add the rounded corners in the image itself, but then it ends up looking weird because of scaling)
    I've been googling for about two hours and I just can't find anything that could work. I can't use store assets because of company rules and all the soft shadow shaders I've found so far only work for sprites and I have absolutely no idea how to convert it.

    I'm aware Unity has a hard shadow component and TMP shadows for text, but neither of them is what I need.

    Does anyone have any idea what I should do? How do I convert shaders from use with sprites to UI?
     
  2. lovemoebius

    lovemoebius

    Joined:
    Dec 12, 2016
    Posts:
    88
    I ended up having to use specifically Illustrator (but I suppose other vector software could also work) to create images with shadows and rounded corners manually and then slicing them in the sprite editor.

    Really wish there was a better way to do this, but I guess it will do for now.
     
  3. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
  4. lovemoebius

    lovemoebius

    Joined:
    Dec 12, 2016
    Posts:
    88
  5. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    At least you could make a shadow sliced graphic and put it below the images with a negative offset.
     
  6. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,268
    It is ironic that flash had very simple but effective shadows, blur etc. but in the new hardware accelerated 3d world such things are not easy and Unity builds little in to help...

    But yes you want to use a 9-sliced sprite for shadows [full-borders] based on a soft/blurred shadow image.

    You can also use masks to round corners etc but they are not the fastest of things to use, overlaying an image to achieve the same effect is faster where possible.
     
    yezzer likes this.