• Unity
  • gradient on top of spine animation in unity

Hello

I searched on the forum but i didn't find exactly what I was looking for,so sorry fi its a repost, is there a way to have a gradient from a colour to full transparency on top of a spine character in unity? So the gradient will always be from bottom to top, but won't affect the animations, or the background?

thanks

Related Discussions
...
  • Изменено

You could write your own shader (based on one of the shaders provided in the spine-unity runtime) that adds such a gradient overlay effect at the end of the fragment shader. This would then render in a single pass and save resources.

If you for whatever reason need to keep the overlay separate: Alternatively you could write a (or use an existing) gradient shader that renders the existing skeleton mesh again. You could use the RenderExistingMesh component to re-render the same skeleton with a different Material and shader. This however comes with the drawback of multiple semi-transparent pixels of overlapping attachments being overlaid multiple times, so here we would recommend having z-write and z-test enabled to avoid such multiple overlays. For these reasons we would recommend the first solution over this one, unless you don't care about overlapping attachments.