Search Unity

Replace Spritesheet Black Background by Alpha ?

Discussion in 'Shaders' started by givizator, Aug 24, 2019.

  1. givizator

    givizator

    Joined:
    Oct 23, 2018
    Posts:
    30
    Hi guys :)

    I'm using that tool to make spritesheet of particles : https://assetstore.unity.com/packages/tools/particles-effects/shuriken-to-spritesheet-54137

    As suggested, I've disabled the transparency to preserve the colours on the output, you can see one sprite attached to this thread.

    Now the developper says : "Transparency with colours for particles with additive shaders can only be approximated using the built-in controls. If you're using a particle system with just additive shaders, you can disable transparency to preserve colouring and use an additive shader with the output spritesheet. This will re-enable full transparency (black == 0.0). "

    I dont really have any idea on how to do that.
    How can I use an "additive shader" to turn the black background to alpha on the spritesheet ?

    My end goal is to have the final spritesheet with the transparent background as a .png file as I'm not going to use it inside of Unity.

    Any help on direction to take is welcome !

    Thanks.

    G
     

    Attached Files:

  2. tmcthee

    tmcthee

    Joined:
    Mar 8, 2013
    Posts:
    119
  3. tmcthee

    tmcthee

    Joined:
    Mar 8, 2013
    Posts:
    119
    When you're using an additive shader the alpha channel is irrelevant to transparency.
    The darker the RGB colour the more transparent it will be, because you're adding less to the destination pixel.
    For example, if your destination pixel is (0.5, 0.5, 0.5) and your sprite pixel is black (0,0,0) then the resulting pixel will remain (0.5,0.5,0.5) because you've added 0 to the pixel. So the sprite will appear completely transparent at that pixel.
     
  4. givizator

    givizator

    Joined:
    Oct 23, 2018
    Posts:
    30
    Thank you for the fast answer.
    Any idea where I can find an already working shader to apply it ?

    I've been trying to do it in Unity for the past 2 hours, but I've never used any shader before and I'm kind of lost :/
     
  5. tmcthee

    tmcthee

    Joined:
    Mar 8, 2013
    Posts:
    119
    have you tried
    mobile/particles/additive
    ?
     
  6. CassiusAbreu

    CassiusAbreu

    Joined:
    Dec 12, 2022
    Posts:
    3