IndieDoroid

Hi guys,

How can we use sprite masking with the Spine shader? I'm confused on it's implementation.

Blog: Unity SpriteMask and RectMask2D support
I read this, but still wasn't able to get the animations to be masked.

I tried a simple sprite renderer and that didn't work either. :confused:

Is there a video tutorial somewhere we could watch the step by step process?

I'd like to get the arrow to show up inside the grass island area only
screenshot.10.jpg

screenshot.9.jpg



I sent an email with subject and the files : [ BUG] Rect Mask 2d

Thanks for the help :wounded:
You do not have the required permissions to view the files attached to this post.
User avatar
IndieDoroid
  • Posts: 140

Harald

That's some nice music in your reproduction video! Including the mouse cursor in the screen capture would be less surprising BTW ;).

Please note that on the blog post that you referenced we wrote the following on purpose:
Unity UI - Rect masks and SkeletonGraphic
The shaders used by SkeletonGraphic now support Unity's RectMask2D component.
There is also an example scene Spine Examples/Other Examples/SpriteMask and RectMask2D.unity which shows how to use the components. In the example scene a description text also reads:
Use SpriteMasks with SkeletonAnimation and SkeletonMecanim (Non-UI Skeletons).
Use RectMask2D for SkeletonGraphic (UI).
So in short: you are combining the wrong components. If you are using SkeletonAnimation, you have to use a SpriteMask component instead of RectMask2D. RectMask2D is for UI components. :)
User avatar
Harald

Harri
  • Posts: 1524

IndieDoroid

Update Ok figured it out! For anyone else running into this issue, just play with the Top\ Bottom rect transform until the skeleton graphic doesn't pop\disappear!

Thanks for the help Harald :nerd:
Harald wrote:That's some nice music in your reproduction video! Including the mouse cursor in the screen capture would be less surprising BTW ;).

Please note that on the blog post that you referenced we wrote the following on purpose:
Unity UI - Rect masks and SkeletonGraphic
The shaders used by SkeletonGraphic now support Unity's RectMask2D component.
There is also an example scene Spine Examples/Other Examples/SpriteMask and RectMask2D.unity which shows how to use the components. In the example scene a description text also reads:
Use SpriteMasks with SkeletonAnimation and SkeletonMecanim (Non-UI Skeletons).
Use RectMask2D for SkeletonGraphic (UI).
So in short: you are combining the wrong components. If you are using SkeletonAnimation, you have to use a SpriteMask component instead of RectMask2D. RectMask2D is for UI components. :)
Hi Harald,
If you're interested the music if Danimal Cannon. https://danimalcannon.bandcamp.com/
He does gameboy metal\rock music.

Thanks for the reply. I downloaded the examples you mentioned and have gotten some progress. But there seems to be a weird "instant disappear" when the mesh reaches a certain edge of the mask. Do you know whats causing it? :wounded:



If I copy the Rect Transform from the examples then it doesn't pop. But I can't figure out why that is fixing it.. and also it's not a solution . :bigeyed:
0:52 = popping\ disappearing of mesh
0:58 = copying the exact Top\ Bottom values from example and mesh doesn't pop\disappear
User avatar
IndieDoroid
  • Posts: 140

Harald

IndieDoroid wrote:Update Ok figured it out! For anyone else running into this issue, just play with the Top\ Bottom rect transform until the skeleton graphic doesn't pop\disappear!
We are sorry for the troubles, glad you figured it out!
Instead of messing with the bounds manually, you could also use the SkeletonGraphic Inspector's gear icon and choose Match RectTransform with Mesh Bounds.
SkeletonGraphicMatchMeshBounds.png


Although this menu entry exists for a long time now, I think I will improve things a bit in terms of visibility and add a normal button at the bottom of the SkeletonGraphic Inspector display. Otherwise many people will never see this functionality.

---

I have added an issue ticket for this improvement here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1607
I will get back to you once it's done.
You do not have the required permissions to view the files attached to this post.
User avatar
Harald

Harri
  • Posts: 1524

IndieDoroid

Harald wrote:
IndieDoroid wrote:Update Ok figured it out! For anyone else running into this issue, just play with the Top\ Bottom rect transform until the skeleton graphic doesn't pop\disappear!
We are sorry for the troubles, glad you figured it out!
Instead of messing with the bounds manually, you could also use the SkeletonGraphic Inspector's gear icon and choose Match RectTransform with Mesh Bounds.
SkeletonGraphicMatchMeshBounds.png


Although this menu entry exists for a long time now, I think I will improve things a bit in terms of visibility and add a normal button at the bottom of the SkeletonGraphic Inspector display. Otherwise many people will never see this functionality.

---

I have added an issue ticket for this improvement here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1607
I will get back to you once it's done.
Thank you! I need to play around with the sprite mask one .. I wasn't able to get it to work before which was frustrating. But at least the rect 2d mask is making sense to me. :)

Yea I rarely use the top right "gear" icon in unity.. except if I want to reset a game object's base setting or copy component settings. My brain kind of ignores everything else in there ... which I should NOT do though. :lol:
User avatar
IndieDoroid
  • Posts: 140

Harald

I can totally understand that the gear icon is not what you end up using much - it's just so small to see and hit compared to the rest of the Inspector view.

---

New unitypackages have just been released with improved "Match RectTransform with Mesh Bounds" functionality - not only is there now an easy to find button in the Inspector, it now also automatically performs sucha a match operation right after the SkeletonGraphic has been instantiated.

At the same release we have also improved drag and drop Skeleton instantiation functionality: it now finally respects the GameObject under the mouse cursor in the Hierarchy view as its new parent when dropped.

You can download the updated unitypackages here as usual:
Spine Unity Download
User avatar
Harald

Harri
  • Posts: 1524

IndieDoroid

Harald wrote:I can totally understand that the gear icon is not what you end up using much - it's just so small to see and hit compared to the rest of the Inspector view.

---

New unitypackages have just been released with improved "Match RectTransform with Mesh Bounds" functionality - not only is there now an easy to find button in the Inspector, it now also automatically performs sucha a match operation right after the SkeletonGraphic has been instantiated.

At the same release we have also improved drag and drop Skeleton instantiation functionality: it now finally respects the GameObject under the mouse cursor in the Hierarchy view as its new parent when dropped.

You can download the updated unitypackages here as usual:
Spine Unity Download
Thanks a lot for the help! :)
User avatar
IndieDoroid
  • Posts: 140

Harald

You're welcome! :) Thanks for providing feedback, it always helps us to improve Spine where possible.
User avatar
Harald

Harri
  • Posts: 1524

Harald

Thanks very much for your feedback, very glad the forum helped! We try to keep conversations to the forum as much as possible for the above reason.
User avatar
Harald

Harri
  • Posts: 1524


Return to Unity