- 編集済み
Help plz! How do I make my character translucent in Unity?
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:
This is how it became when I was trying to make it translucent in my way:
This is what I was really looking for, so could you pls help me to achieve the effect below in Unity?
See this thread here: Unity3D 에서 불투명한 스파인 리소스가 겹치는 문제
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?
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.
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.
Hi, was the example ever built/included? I couldn't see it as-of v3.8.95. Thanks!
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
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).
Harald wroteAn adjusted version of the
SkeletonRenderTexture
component is required when usingSkeletonGraphic
. 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
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