• RuntimesUnity
  • SkeletonGraphicRenderTexture Deformed Output in Sample Scene

Running the RenderTexture FadeOut Transparency scene as example on URP with a forward renderer in Unity 2022 and Spine 4.2.28 Runtime Examples.

The SkeletonGraphicRenderTexture appears to get deformed as soon as play mode starts, and the deformity changes as the game window is resized.
It also gets multiple errors related to setting the texture on the raw image when the window is resized while the scene is running.

Error below:

Trying to add SkeletonGraphic (spineboy-pro) RenderTexture (UnityEngine.UI.RawImage) for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.
UnityEngine.UI.RawImage:set_texture (UnityEngine.Texture)
Spine.Unity.Examples.SkeletonGraphicRenderTexture:SetupQuad () (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity-examples@6118a5f704/Scripts/Sample Components/SkeletonRenderTexture/SkeletonGraphicRenderTexture.cs:215)
Spine.Unity.Examples.SkeletonGraphicRenderTexture:PrepareQuad (Spine.Unity.SkeletonRendererInstruction) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity-examples@6118a5f704/Scripts/Sample Components/SkeletonRenderTexture/SkeletonGraphicRenderTexture.cs:139)
Spine.Unity.SkeletonGraphic:PrepareInstructionsAndRenderers (bool) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@a8a7ba878a/Runtime/spine-unity/Components/SkeletonGraphic.cs:874)
Spine.Unity.SkeletonGraphic:Rebuild (UnityEngine.UI.CanvasUpdate) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@a8a7ba878a/Runtime/spine-unity/Components/SkeletonGraphic.cs:324)
UnityEngine.Canvas:SendWillRenderCanvases ()
Related Discussions
...

@abgtan Thanks for reporting and sorry for the troubles! We noticed the issue yesterday as well when fixing the other issue you reported.

The problem was that the generated RawImage was ignoring the custom set mesh vertices and uv-coords on some Unity versions, thus rendering the whole RenderTexture in a distorted way.
We fixed the issue by replacing RawImage with SkeletonSubmeshGraphic which has none of the reported issues and is also more resource-friendly.

While it will hardly affect anyone, this is a breaking change:

  • SkeletonGraphicRenderTexture example component: protected RawImage quadRawImage was changed to protected SkeletonSubmeshGraphic quadMaskableGraphic for a bugfix. This is only relevant for subclasses of SkeletonGraphicRenderTexture or when querying the RawImage component via e.g. skeletonGraphicRenderTexture.quad.GetComponent<RawImage>().

A new spine-unity 4.2 unitypackage is available for download here as usual:
https://jp.esotericsoftware.com/spine-unity-download
Please let us know if this resolves the issue on your end as well.

Issue ticket for later reference:
EsotericSoftware/spine-runtimes2513

Thank you @Harald, tested it out and it is indeed fixed.

Sometimes there is a slight positional discrepancy between the RenderTexture and the original SkeletonGraphic when using screen space overlay, but it is quite minor. There's also some color rendering difference from what seems like alpha blending between the RenderTexture and SkeletonGraphic, but it is also very minor.

The one on the right is the render texture.

@abgtan Glad to hear the original issue is resolved, thanks for confirming.

Regarding the rendering differences in the screenshot: Which blend mode are you using at the transparent hourglass ball?

Anyway, I can't yet explain a slight positional offset, could you perhaps send us a minimal Unity project which still demonstrated the above issues? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at what's going wrong.

5日 後

@abgtan We have just released a bugfix for the "darker blending" issue. The problem was that the used material to render the quad with the RenderTexture to the scene, UI/Default, was using straight alpha blending, while it required premultiply-alpha blending to avoid a double-darkening effect. SkeletonGraphicRenderTexture now provides a Quad Material property in the inspector where you can assign the newly added RenderQuadGraphicMaterial. If it's null, a material will be generated at runtime with the proper settings.

From the changelog:

  • SkeletonGraphicRenderTexture example component now also received a quadMaterial property, defaulting to the newly added Material asset RenderQuadGraphicMaterial which applies proper premultiplied-alpha blending of the render texture. The quadMaterial member variable was moved from SkeletonRenderTexture to the common base class SkeletonRenderTextureBase.

A new spine-unity 4.2 unitypackage is available for download here as usual:
https://esotericsoftware.com/spine-unity-download
Please let us know if this resolves the color issue on your end as well. Thanks again for reporting!

Issue ticket for later reference:
EsotericSoftware/spine-runtimes2520

@abgtan Regarding the offset issue, unfortunately I could not reproduce any offset at all, all pixels seemed perfectly the same to me, also not with different GameView aspect ratios or resolutions. Could you please let us know where exactly we should look at to see any offset happening? Are you sure that with the offset you've updated the Spine Examples UPM package to the latest version?

  • abgtan がこの投稿に返信しました。

    Harald

    Thanks Harald!

    For the positional offset, I found that it is related to the game window configuration. If I have a game window with a Fixed Resolution, let's say 1920x1080, then the issue doesn't occur. But when I configure the game window to just have an aspect ratio of say 16:9, then it does happen. So since this is an editor thing...it could be safe to ignore, maybe? I haven't tried it on a build.

    I recorded the sample scene where I turn the render texture component on/off with a 16:9 aspect ratio game window. You can see a slight shift in position from left to right during toggling, and after I resize the game window while keeping the same aspect ratio, the shift goes up and down.

    @abgtan Thanks for the additional info and the video! Unfortunately I could still not reproduce the issue. I will have another try whether perhaps I have modified some scene content or settings while fixing the alpha blending issue. I will let you know as soon as I have any news to share.

    @abgtan I just had another try running from the unmodified project again, unfortunately without any luck, I still can't reproduce the offset issue after dragging the Game view window borders around to all different sizes with 16:9 Aspect active.

    • abgtan がこの投稿に返信しました。

      Harald Strange. It does seem like it would only happen in the editor though. Maybe my screen resolution + aspect ratio is messing it up. Thank you for testing it out.

      @abgtan Strange indeed. At least good to hear that it's only happening in the Editor. Again thanks for reporting and the reproduction project.