• Unity
  • Tint overlay color using Skeleton shader

Hi, I want to ask how to overlay a color to a skeleton, but not just simple tint (like with changing r-g-b value of Skeleton). Simplest purpose of this is to show color when the enemies are damaged. I attached a gif example of the effect.


I already implemented this by modifying the Bones shader fragment function to use a tint color, which I can modify the color to black and the tint color to the color I want.

fixed4 col = 2.0f * i.color * _Color * tex2D(_MainTex, i.texcoord);
col.rgb += _TintColor.rgb;

The thing is I want to use the lighting on Unity, so I need to modify it from the SkeletonLit shader and it's more complicated than I thought.

  • I tried testing it first on Skeleton shader (then will go test in on Skeleton Lit if successful), changing the fragment function and nothing affect the final animation. Even when I commented out everything and just return the tint color that I set on the material.
  • I also tried modifying directly the r-g-b-a value on SkeletonRenderer mesh color, but from what I can tell it's always back to the usual tint (overlay with color + alpha).
    Does anyone have experience modifying the Skeleton shader for something like this? Or how to achieve the color overlay effect using other methods but still supporting the lights? I'm using the latest master branch (12 Aug 2015).

So I do something like this for my game, but I'm not using the SkeletonLit shader. Instead I'm using a variant of the Unity Standard shader that has vertex colors added that I picked up on the Unity forums (http://forum.unity3d.com/threads/standard-shader-with-vertex-colors.316529/) and then tinkered with. Take a look at the attached folder and see if that helps (you'll want to change it from tint to overlay for the vertex color, and probably remove some spurious lines).

8 mois plus tard

I'm trying to achieve the same effect as hitnoodle in the Spine/Skeleton shader, but I'm running into the same troubles 🙁 I tried commenting out everything in the fragment function and just returning my overlay colour, but it has no effect on what gets rendered.

I don't know enough about shaders to fully understand everything in the default one 🙁 I'm assuming I can't just edit the fragment function because of all the shadow caster logic in there? Is there a simple way to render a skeleton in a solid colour like in hitnoodle's example above? 🙁


05 Jun 2016, 14:59


Hmm... I just noticed the SkeletonGhost shader, and I think that does exactly what I need if I set the Texture Fade Out value to 1.0 🙂 Modifying Unity's built in Unlit/Transparent shader slightly also does the trick 🙂

If you're looking to implement something lit, ToddRivers' code is a good reference: Sprite Shaders for Unity
Very informative stuff there for sprite coloring. And while you're at it, you may pick up some neat optimized implementation too (eg, not needing mesh normals for lit sprites).