hhfan

Currently, the character (an assassin) that I am working on has the power of making himself invisible, therefore I need to make my character translucent to show that he is invisible.
I was planning to adjust the picture’s alpha value to achieve this effect. However, when I done it, all the pictures have become translucent, and the result was not what I was looking for. The pictures with low sorting layer value were no longer been fully covered by the pictures with high sorting layer value. So, is there any way to achieve the translucent effect that I was really looking for?

This is my character below:
原版.png


This is how it became when I was trying to make it translucent in my way:
错误.png


This is what I was really looking for, so could you pls help me to achieve the effect below in Unity?
正确.png
You do not have the required permissions to view the files attached to this post.
hhfan
  • Posts: 24

Mario

User avatar
Mario

Mario
  • Posts: 3089

hhfan

Thanks for the reply. Unfortunately, I have used Shader for another function, so that I could not use Shader for this matter.
Is there any other alternatives which will help me to solve my problem? Any other suggestions?
hhfan
  • Posts: 24

Mario

I'm afraid there's no way around using the method described in the post. The problems stems from the order in which attachments are rendered (or not rendered at all). Note that this is not a problem specific to Spine, but a general problem when rendering translucent images on top of each other.
User avatar
Mario

Mario
  • Posts: 3089

Harald

One alternative would be to use a RenderTexture: https://docs.unity3d.com/Manual/class-RenderTexture.html.

You could render the character to the RenderTexture at 100% opacity (so without the transparency applied yet) and then overlay the RenderTexture to your scene at the desired opacity via a simple quad with the RenderTexture applied at a simple transparent material (lets say 50% transparent). This would be the quickest and easiest solution in your case.

We are planning to provide an example scene in the future to show common fade-out scenarios.
User avatar
Harald

Harri
  • Posts: 4104

Aurigan

Hi, was the example ever built/included? I couldn't see it as-of v3.8.95. Thanks!
Aurigan
  • Posts: 16

Harald

Unfortunately we did not yet get to add it for spine-unity, sorry!
(It will not be included in the Spine Editor but on the runtime side.)

The issue ticket can be found here: https://github.com/EsotericSoftware/spine-runtimes/issues/1337

---

A new example component SkeletonRenderTexture has been added to the repository on the 4.0 branch, alongside with a fadeout example scene named 'RenderTexture FadeOut Transparency'. This commit will be merged to 4.1-beta soon.

A new 4.0 spine-unity unitypackage is available for download here as usual:
Spine Unity Download
User avatar
Harald

Harri
  • Posts: 4104

Alexees

@Harald we mostly use SkeletonGraphics. How does that work then?
Alexees
  • Posts: 13

Harald

An adjusted version of the SkeletonRenderTexture component is required when using SkeletonGraphic. Unfortunately we didn't get to provide such an example component yet. We'll have a look whether we can quickly provide such a component (at least a limited version that should cover most use-cases).
User avatar
Harald

Harri
  • Posts: 4104

Alexees

Harald wrote:An adjusted version of the SkeletonRenderTexture component is required when using SkeletonGraphic. Unfortunately we didn't get to provide such an example component yet. We'll have a look whether we can quickly provide such a component (at least a limited version that should cover most use-cases).
That's great. Looking forward to this
Alexees
  • Posts: 13

Harald

We can gladly announce that a new SkeletonGraphicRenderTexture example component has just been released for spine-unity 4.1. You can check out the updated example scene RenderTexture FadeOut Transparency to see it in action.

Note that SkeletonGraphicRenderTexture uses RectTransform bounds to define the render area. You can set a RectTransform at the Custom Render Rect property if you don't want to use the normal SkeletonGraphic RectTransform bounds, as shown in the example scene.

A new spine-unity 4.1 unitypackage is available for download:
spine-unity Download

Issue ticket URL for later reference:
https://github.com/EsotericSoftware/spine-runtimes/issues/2130
User avatar
Harald

Harri
  • Posts: 4104


Return to Unity