- Modifié
Spine transparency issue in pixel lit shader in Unity
Heyo
First and all, great job on expanding upon the Spine shaders in Unity. One day they were just in there and they are reaaaaally cool. Happy surprise!
Secondly though, I found an issue with using the Pixel-lit function in Unity together with transparency. In Spine I have a sprite panel that is animated to show it getting heated up. To simulate the up-heating I keep an Orange layer hidden in setup. At animation start I turn it visible and at the same time apply 0 slot opacity. At animation end the opacity is higher. Playing the animation the panel looks like it is getting warmer by getting more orange.
But Unity does not really like this combo. At animation start the orange layer is displayed at full setup opacity. Then for a couple of frames it goes down in opacity to match the real animation values for color alpha. Once it does the animation proceeds as expected.
The version I am running right now is 3.5.43. I looked through the changelog however and no mention was made of this specific problem.
All credit goes to forum user ToddRivers for the shader itself: Sprite Shaders for Unity
I'm having trouble imagining what you mean though. But I suspect it has nothing to do with the shader.
It would help if we had some screenshots or something, and/or code.
I'd need some pointers to be able to hand you the code. I can hand you this gif though!
The blinking light in the gif is the transparent, orange layer being turned on. It's actually set for zero transparency at the start, with a gradual increase, so it's pretty strange that there is a blinking effect. There is none at all in Spine itself.
I'll have to check out Todd's thread in more detail. Cheers!
Just a suspicion.
You probably want to set the mix duration to 0, so the color doesn't do a crossfade.
You can find that on the SkeletonData Asset inspector.
What you're seeing may happen if you're mixing between two animations. The attachment visibility will happen immediately, but the color was originally what you set it in setup mode (maybe fully opaque), so it transitioned from that.
Ho ho hooooooooh my god that totally fixed it! I never even thought about that, thanks dude!