• Unity
  • Sprite Shaders for Unity

Don't know if anyone realizes this, but this is probably the most popular thread on Spine's Unity forum. Almost reaching 24,000 views at this point. It's even more read than Pharan's official post http://esotericsoftware.com/forum/Noteworthy-Spine-Unity-Topics-5924

It'd be nice if the Spine guys could pick up the torch and continue to iterate \ support Sprite Shaders or just contract out the support work (both legacy and current Unity versions) to ToddRivers?

His shader makes a significant impact to the visual quality of Spine's animations and helps keep it on par with Unity's Standard Shader. (Without it maybe Anima2D has a leg up?)

ToddRivers, your contribution to Spine's visuals is a huge one, hopefully you get the recognition you deserve. :rock:

With so many lurkers in this thread, it's a shame only a select few bother to get involved in the conversation. If you guys are using this tool and appreciate it, say something..

That being said, I'm more or less following alongside ToddRivers, I'm updated to 5.6 and the shaders are working beautifully. ToddRivers should we update to 5.6.1 now? :party: Haha

Related Discussions
...

You have to admit the topic and content of the first post is pretty SEO optimized.
It literally says "Sprite Shaders for Unity". Imagine how many people google that.
I just googled it and it's the 4th result.
Which is apt, because it's actually not Spine-specific. He actually uses it for more than just his Spine stuff.

I don't call the shots regarding who contracts who. But absolutely, anyone who uses this should credit him with big bold text in their game. It should be the first logo when the game first boots up. 'cause he shares his Sprite shaders to the world freely.

The current spine-unity 3.5 unitypackage is actually packaged for Unity 5.4 and includes the shaders in a 5.4 compatible state, though it probably doesn't handle some of the gotchas like platform-specific depth or normal direction weirdness, if any of that exists.

8 jours plus tard

How to get sharp shadow edges ( toon shading ) like in this video?

SOLVED:
Create a new texture with any resolution (power of two preferably), and paint the left half of the texture with a dark color, and the right half with white. Then place the texture in the Spine/Sprite/VertexLit material's Diffuse Ramp texture slot in Unity.

Yes, that's what Diffuse Ramp is for. 🙂

Thanks for sharing.

Is there any way to fix the problem that the light doesn't come from the same direction all the time?
It's as if the light moves with the object as the object rotates, and half way through the rotation the light flips to the other side. It looks really weird.

Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même


See how the directional light always points the same direction, but the light never hits directly from the top or the bottom relative to the texture.

Is this a bug with the shader?

EDIT: Solved after many hours frustrating hours. Solve Tangents must be enabled under "Advanced" in SkeletonAnimation.cs.

Hi @Pharan,
It would be interesting to see if the majority of the lurkers on this thread are also Spine owners or just guys that googled it looking for a Sprite Shader.

It's a complicated topic on this shader. Good mention on the credit bit, for sure we should all be crediting ToddRivers in the game if we're using it.

Pharan a écrit

You have to admit the topic and content of the first post is pretty SEO optimized.
It literally says "Sprite Shaders for Unity". Imagine how many people google that.
I just googled it and it's the 4th result.
Which is apt, because it's actually not Spine-specific. He actually uses it for more than just his Spine stuff.

I don't call the shots regarding who contracts who. But absolutely, anyone who uses this should credit him with big bold text in their game. It should be the first logo when the game first boots up. 'cause he shares his Sprite shaders to the world freely.

The current spine-unity 3.5 unitypackage is actually packaged for Unity 5.4 and includes the shaders in a 5.4 compatible state, though it probably doesn't handle some of the gotchas like platform-specific depth or normal direction weirdness, if any of that exists.

AlaNintendo a écrit

It's a complicated topic on this shader. Good mention on the credit bit, for sure we should all be crediting ToddRivers in the game if we're using it.

Done 😉
(http://www.fatherandsongame.com)

Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même

I noticed that after updating Unity the emission channel doesn't produce HDR effects, even if the Emission Power is set to very high values. To fix this I cannibalized the Standard Shader and its implementation of emission channel:

on line 704 of SpriteShaderGUI.cs - replaced this

_materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, new ColorPickerHDRConfig(0, 1, 0.01010101f, 3), true); 

with this

_materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, new ColorPickerHDRConfig(0f, 99f, 1 / 99f, 3f), true);
9 jours plus tard

Hello! Sorry to bother everyone. I'm kinda new to this lighting thing (and the programming side) in 2D games . I apologize if this isn't the right place to ask these types of questions. I'm using Unity and Spine Pro.

To create a normal map for a spine animation, I should take the atlas file that's exported from Spine then use software to create a normal map to it? Then apply the normal map to the material? Did I get that right? Is that the best way to do it?

Also, which software would you recommend for creating a normal map? So far I've seen SpriteLamp, Sprite Illuminator, Sprite Dlight, and the NVIDIA Texture Tools. I'm not sure which way to go.

Thanks for your time!

EDIT: Did a little more searching in the forum, seems like SpriteIlluminator is the way to go. Woo

Awesome credit! 8)

Btw congrats on the game release, I saw it on the new release list. Didn't know that was your game :party: ):

NeatWolf a écrit
AlaNintendo a écrit

It's a complicated topic on this shader. Good mention on the credit bit, for sure we should all be crediting ToddRivers in the game if we're using it.

Done 😉
(http://www.fatherandsongame.com)

Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même


17 Jun 2017, 03:53


Hmm would it be possible to expose this into the Inspector for easier use?

new ColorPickerHDRConfig(0, 1, 0.01010101f, 3)
Gabriev a écrit

I noticed that after updating Unity the emission channel doesn't produce HDR effects, even if the Emission Power is set to very high values. To fix this I cannibalized the Standard Shader and its implementation of emission channel:

on line 704 of SpriteShaderGUI.cs - replaced this

_materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, new ColorPickerHDRConfig(0, 1, 0.01010101f, 3), true); 

with this

_materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, new ColorPickerHDRConfig(0f, 99f, 1 / 99f, 3f), true);

Some real quality shaders, thanks for all the hard work ToddRivers!

Hey everyone!
Been a while. First cheers for all the thanks! I'm glad the shaders have been useful 🙂
I learnt to code by poking around other peoples open source code so feel it's good to give some back 😉

@NeatWolf thanks so much! You're game looks lovely, will have to try it! Did you play/see the Triennale Game Collection? That was a pretty cool collection of indie games put together by the art design museum in Milan.
I've added your emission fix as well 🙂

I stuck them on the asset store as well to try and help other peops find them.
https://www.assetstore.unity3d.com/en/#!/content/88191

24 jours plus tard

@ToddRivers Awesome!! Thanks for posting it onto the asset store 🙂

I'm sure lots of people will appreciate all your hard work !

un mois plus tard

Hey @ToddRivers we recently updated Spine-Unity and Spine-Csharp with the new runtime of Spine 3.6 and now all of our materials using your shaders look like this:

Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même

We are using vertex lit with standard alpha (and the sprites come from Photoshop and they are being exported as standard alpha too) and they worked before.
Is this because we're using Unity 5.5.0f3?

Thanks!

7 jours plus tard

@ToddRivers I can attest to this bug as well. I'm on Unity2017 now

But I can't seem to reproduce it consistently... If I recall the fix was to use PNG and not TGA files. But that might not be a good choice? I heard TGA is supposedly better for alpha channel control :think:

17 jours plus tard

We fixed it!. The problem was that in the new shaders the combo box for the blend mode changed, so before we had Pre-multiplied Alpha (or whatever mode we were using like, soft add, add, etc) and with the update it changed every material to Opaque. That's why it looked like that 😉.

6 jours plus tard

Hi,
I am sorry for being a bit off topic. I am trying to modify Unity UI Sprite Default to support RectMask2d. But honestly i am totally a noob in shaders. I am trying to do this as with default UI shader am getting terrible fps drop. But I need masking and Sprite-Defult shader do not support it. I know that UI default shader uses stencil, but Sprite default does not. But this should not be problem as in unity documentation is stated that RectMask2d do not use stencil.

3 mois plus tard

Hey everyone !
I'm having this weird issue using the pixel lit option as it renders my sprite is completely semi transparent. You can see it pretty well in the gif below, seeing through the sword or seeing his right sleeve that's supposed to be completely hidden under his red cloak

I tried different parameters but none that look good or solve the issue. Any pointers ?


Bumping this, maybe if anyone has any pointers 🙂 (or should I just file a bug report thread ?)

8 jours plus tard
MrHoot a écrit

Hey everyone !
I'm having this weird issue using the pixel lit option as it renders my sprite is completely semi transparent. You can see it pretty well in the gif below, seeing through the sword or seeing his right sleeve that's supposed to be completely hidden under his red cloak

I tried different parameters but none that look good or solve the issue. Any pointers ?


Bumping this, maybe if anyone has any pointers 🙂 (or should I just file a bug report thread ?)

If I remember correctly it's because you need to check "Write To Depth" under the Depth header (under the Shader/Material). You also need to change your Z spacing (it's a slider under the Advanced settings in the Skeleton Animation (script) that's on your character). Hope this points at some direction

un mois plus tard
ToddRivers a écrit

The shaders are now up on GitHub. To download them follow this link and click 'Clone or download' and then download as a zip. Copy the SpriteShaders folder into anywhere inside your Unity Assets folder.
https://github.com/traggett/UnitySpriteShaders

Are these shaders compatible with 5.6.X? We don't want to udate yet to 2017.X and ruin our project haha. Thanks!, this shader is amazing and we've been using the one provided by the Spine 3.6 Runtime but we would like to have it separately and at the same time updated as far as we can inside 5.6.X.
If not, could you provide the version that was updated until 5.6.X?

Thanks again! 🙂