Search Unity

Emission Glow with Unity UI

Discussion in 'Scripting' started by Ben-BearFish, Jul 21, 2015.

  1. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I was trying to do emission glow with Unity's uGUI buttons, panels, and sprites and was wondering if it's possible to apply the same emission effect to them as the Unity 5 Standard Shader?
     
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Any suggestions?
     
  3. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Googling this issue brought me here. I can't believe this thread is the number one search result.
     
    Last edited: Dec 2, 2016
  4. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Just place another sprite in front of the desired ui element with the desired glow texture. The emission element of the standard shader is just a texture added after all lighting has been calculated, that is, it is unaffected by light. The whole ui is by default unlit, so just adding the emission sprite above should do trick.
     
  5. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    I think you might be talking about something that you haven't tried yourself. The emission effect doesn't just blend color. It is additive by definition.

    Make a dark background in the scene. Add a partially transparent UI yellow color element. Now add a quad in 3d space with a fade yellow emission standard material(Leave albedo black).

    Notice how the quad is glowing while the blended UI element is just washed out. You will find that making the UI element additive is impossible since only color blending is happening.

    Try it. It will only take you one minute.

    The only way to make a UI element glow is to remove the transparency. But having a full color UI isn't what I want.
     
  6. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Just replace the material with something additive, like the stock Particles/Additive.
     
    StaffanEk likes this.
  7. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Now your cooking with gas.
     
  8. Dameon_

    Dameon_

    Joined:
    Apr 11, 2014
    Posts:
    542
    This will only work for worldspace UI elements, but if you put them on a layer rendered by a camera with postprocessing effects, you can bring all those postprocessing effects to your GUI. This includes blur, bloom, and all the other effects provided by Unity.