Search Unity

Question How can I make this gradient transparent shader?

Discussion in 'Shaders' started by ReeDimm, Jun 28, 2022.

  1. ReeDimm

    ReeDimm

    Joined:
    Jul 13, 2021
    Posts:
    29
    Hey! I looked around everywhere but I couldn't find way to make this type of shader. This one is from game Slide in woods but San Andreas have simliar one.
     
  2. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,924
    That just seems like a gradient with additive blending (its color is added to whatever is behind it).

    The good thing of additive blending is that, unlike alpha blending (transparency), it is order independent which means you don't need to sort objects/triangles back-to-front for it to render correctly.

    You don't need to make your own shader for this. You can for instance use the "Particles/StandardUnlit" one, and set its rendering mode to "Additive", maybe enable "Two sided". Then slap a gradient texture in its albedo slot and you're done.

    If you're using URP or HDRP as your pipeline, ShaderGraph also has blending options to enable additive blending.