When a skeleton needs to render multiple materials, the resulting texture samples are misplaced when a single material is generated through the Runtime Repackaging function
Help me look at the outline problem !!!
When using the Runtime Repackaging function in Spine to generate a single material for a skeleton that requires multiple materials, you may encounter issues with misplaced texture samples. This is because the outline shaders can incorrectly outline each submesh instead of the whole skeleton. To resolve this, ensure that only a single material is used by packing your atlas accordingly. If this is not possible, you can use the RenderCombinedMesh
component to re-render your combined skeleton mesh with an outline-only shader, such as Spine/Outline/OutlineOnly-ZWrite
for the Built-In Render Pipeline or Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly
for URP.
@LZL Sorry that Spinebots answer is not quite matching your problem, it unfortunately can't process images (yet). The lower half however might still be useful, so I'm leaving it as-is.
As your skeleton also shows incorrect atlas regions, and alternating outline- and normal materials:
- What does your initial skeleton setup look like material-wise?
- What materials are active before repacking?
- How did you create the outline setup on your skeleton before repacking?
- What render pipeline are you using? I assume you're using Built-In Render Pipeline, is this correct?
@LZL Thanks for the additional information. Unfortunately questions 1 and 2 were not quite answered for me:
What does your initial skeleton setup look like material-wise? What materials are active before repacking?
Here I would need to see the Inspector settings with your SkeletonAnimation GameObject selected, and the materials showing at the bottom of the Inspector. You have shown the Material selected in the Project window, which helps a bit but does not yet answer everything that I need to know.
@LZL Thanks for the additional screenshots. Note that your SkeletonAnimation
attachments look completely wrong before repacking. This is the issue you need to fix, it's independent of outline rendering. While it is true that there are some limitations in the outline shaders where repacking helps (as discussed in these forum threads: here and here), but not with incorrect attachment regions. Are you perhaps assigning materials manually in some way? In general you need to properly setup the skeleton first for your skin setup. Then your can switch to outline shaders once that is working as intended.
@LZL Thanks for the detailed writeup and screenshots, these help a lot. I misunderstood your earlier messages then, I thought your attachments before packing looked misaligned. Seeing that they are correct before repacking helped. Unfortunately I can see nothing obviously wrong with your Material setup or code. Could you perhaps send us a minimal Unity project which still shows this issue? You can send it as a zip file 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.
Please note that the outline shader works in texture space, so your attachments need the respective transparent whitespace padding added around them, otherwise the outline will grow (in atlas-space) into neighbour attachment regions. Wider outlines require more padding, while thinner outlines require less padding.
See the blog here:
https://esotericsoftware.com/blog/Outline-shaders-for-spine-unity#Requirements-for-meshes-and-atlas-textures
I'm not sure I understand the above posting correctly, translation was a bit ambiguous. Do you mean that you have later ensured that the export and import settings are correct in regards to PMA and straight alpha, but the problem persists?