MrSkinny

Is there a standard method for applying a shader to a Spine object as a whole (and not just it's individual sprites). I assume there is a way to render to an immediate texture and run a shader on that before rendering to the screen?

An example of the shader I'm trying to add is a simple character outline.

Thanks
MrSkinny
Posts: 4

Pharan

This is more a Unity question. I think you'll have more thorough answers in the Unity forum.
Short answer is that Spine generates a mesh and leaves it to Unity to render it.

The behavior you're seeing is inherent to Unity (and most engines, actually) and applies to any mesh being drawn.
You may need a runtime Texture to draw to and run that through a shader.
User avatar
Pharan

Pharan
Posts: 4502

MrSkinny

Pharan, thanks for the reply.

I know this can be done with another camera that only capture the Spine gameObject layer and renders it to a RenderTexture. We already do this for our background layer. I haven't been able to find a better solution this is probably what I'll do.

-- 08 Sep 2017, 18:04 --

I thought I would add a small update to this thread. I found a video that shows a pretty clean approach to using the separate camera captures to a texture technique.

Shaders Case Study - Brawl Stars: Toon Shading - YouTube

There is a couple of minor drawbacks. You are doing 2 draws instead of 1. There is also a slight loss in quality when comparing the texture to the original. However, for us this has only been noticeable when doing a side by side comparison.
MrSkinny
Posts: 4

Pharan

I've seen this video. Thanks for sharing!
It's still very specific to the setup of your game so it's unfortunately not something we can directly incorporate into the runtime.
But it's something any dev can do, for sure.
User avatar
Pharan

Pharan
Posts: 4502


Return to Unity