• Unity
  • 'Silhouette' shader for Spine?

Hi and thanks for a great animation software,

I'm having some issues with changing the color to transparent black for Spine animated object. Problem is that each part of the animation is blended together in such a way that the color is not even. I have tried solving this by tweaking the shader with no success yet.

This is what I have currently:

This is what I'm trying to achieve:

Would anyone have some information on how to solve this? Thanks in advance,
-Joni

Related Discussions
...

"This is how realtime mesh rendering works anywhere. The opacity is applied right when the triangles are drawn, not after."

The solution to this unfortunately isn't a shader.
The mesh needs to be rendered to texture first (with a RenderTexture).
Then render that texture using a regular sprite shader.
The problem is capturing the bounds and generating the mesh that the RenderTexture needs to be mapped to. This is a per-game sort of thing.

There's theoretically a shader alternate but it wouldn't support texture alpha blending and you'll have jagged edges. It would be like a cutout shader, and it wouldn't perform well on mobile.

If you know of a modern 2D game that actually does this correctly, we could probably google that.

Thank for the reply and good explanation!

I played a bit with shaders and was able to create something pretty close to what I'm looking for. But, if I remember correctly, I indeed had some issues with jagged edges and it didn't look the same for different kinds of Spine animations

So maybe this is more complicated what I thought, I'll look more into this later. I'll update if I find some good solution.

-Joni

I know this might sound a dirty way to go past the problem, but how about for the moment you just have another atlas painted in the color you need to load when you need the silhouette?

It would still have the same problem. As long as it's any kind of transparent, it would show the overlaps as in the screenshot above.

Have you seen anyone do this correctly?

Hmm I bet placing a copy of the background with alpha in front of a pure black character isn't very feasable either, is it...

I thought of that too. But it would also mean the overlapping parts look more transparent than the rest.

It would also cost an extra grab pass, or not. Depends on how you want to handle refraction/screen effects if you were doing those already. In any case, it would look wrong, sadly.

Pharan schrieb

It would still have the same problem. As long as it's any kind of transparent, it would show the overlaps as in the screenshot above.

Have you seen anyone do this correctly?

I haven't. This silhouette thing is a request from a client for whom I'm making a software. Of course the client will understand if it is not technically possible. It would look much better visually anyhow.

Nice to see that this topic has gained some interest!

Is it possible to use another camera for the silhouette character?