• RuntimesUnity
  • Help me look at the outline problem !!!

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

Related Discussions
...

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:

  1. What does your initial skeleton setup look like material-wise?
  2. What materials are active before repacking?
  3. How did you create the outline setup on your skeleton before repacking?
  4. What render pipeline are you using? I assume you're using Built-In Render Pipeline, is this correct?
  • LZL님이 이에 답장했습니다.

    Harald 我先描述下我的意图,我想要实现人物描边效果,但是仅限于轮廓,不含眼睛等内部元素的轮廓,想要使用官方提供的spine的outline 来进行实现,下面逐条回答你的疑问
    1.初始设置的是一个裸模型并进行描边

    2.后续使用代码动态添加solt以及对应的sprite,描边效果会将眼睛等部分的内部元素也进行描边,所以我将动态修改的后的数据进行了重新打包
    3.在默认材质上就已经使用了描边shader所以重新打包之后仍然时候的默认的描边shader
    4.使用的内置的默认管线

    Harald Do you need me to reply in English

    • Harald님이 이에 답장했습니다.

      @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님이 이에 답장했습니다.

        LZL Thanks for asking. There is no need to reply in English, you can reply in your language and I can use the translation function of the forum.

        Harald 下面两个图片是默认设置


        下面两个图片是重新包装之前被添加上去的材质并且已经被激活

        下面一个图片是合并之后 材质和纹理
        不知道我这样回答对不对

        @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님이 이에 답장했습니다.

          Harald 我把正确设置皮肤之后的效果图片发你
          这是没有重新打包之前的




          这样的描边会把眼部进行描边,对此我就想重新打包材质是他可以对整体描边,下面是整体重新打包材质之后的效果




          已经对应重新打包的代码

          @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.

          • LZL님이 이에 답장했습니다.

            Harald 上述问题我这边已经解决了,但是又发现一个新的问题,导入unity中的SkeletonData把材质设置为outline,预览时候会出现下面的问题

            • LZL님이 이에 답장했습니다.

              LZL 补充下设置截图

              • LZL님이 이에 답장했습니다.

                LZL 上述的问题发生之前已经查看过官方文档对导入设置进行过规范,进阶操作 - Premultiplied和Straight Alpha导入

                • Harald님이 이에 답장했습니다.

                  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

                  LZL LZL 上述的问题发生之前已经查看过官方文档对导入设置进行过规范,进阶操作 - Premultiplied和Straight Alpha导入

                  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?

                  • LZL님이 이에 답장했습니다.

                    Harald yes

                    • Harald 님이 이 게시물을 좋아합니다..