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. Dismiss Notice

Question 2D emission shader not working

Discussion in 'Shader Graph' started by Sinister-Design, Nov 21, 2020.

  1. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    64
    I'm trying to create a simple emission shader for Texture2D sprites based largely on Brackeys's tutorial. It seems like this should work, and yet the Main Preview remains blank... Shader Graph Probs.png
    ...and nothing renders when I use the shader in-game:
    Shader Graph Probs B.png I've gotta be missing something here, right?
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    1. Do you have a Global Volume with Bloom? I'm not seeing it in your hierarchy.
    2. You're using an Image component not a SpriteRenderer. Try a SpriteRenderer. Bloom is applied before UI typically. See the order within Frame Debugger's: Post-Processing preceeds UGUI.
    3. Why are you subtracting OneMinus alpha? The tutorial doesn't do this.
     
  3. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    64
    1. Yes.
    2. I'm trying to apply a bloom effect within the game's user interface; this means using canvases. Is this simply something Unity can't handle?
    3. Shader Graph has a bad habit of displaying garbage where a Texture2D's alpha is 0. This fixes it.
     
  4. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    I suspect this is the problem. The workaround is to do something custom but unfortunately I haven't done that. If you were to ask in General Graphics someone should be able to instruct you how post-processing could be applied to UI or a workaround.
     
  5. Sinister-Design

    Sinister-Design

    Joined:
    Sep 19, 2015
    Posts:
    64
    Any input from Unity developers here? Does URP simply not support post-processing of objects within Canvases? (If so, that seems like a pretty enormous oversight!)
     
  6. myazuid

    myazuid

    Joined:
    Jan 29, 2019
    Posts:
    26
    well this is very old but in case anyone else stumbles across it, you need to change the canvas render mode. The default is Screen Space - Overlay. Change it to Screen Space - Camera. Then you can use post processing effects like bloom.