• Runtimes
  • 合并皮肤之后,新的Spine形象的清晰度降低了

Misaki 您好,您的意思是我将head / attach /body 三个皮肤的图片都单独放在子文件夹吗?单独导出比如head子文件的图片到单独的图集,这样的话,是不是skin我也要把all/attach/body这三个都删除才行?这样会影响动作吗? 运行时我用包含了head图集的skin1 project去跟包含了attach/body的 skin2 project去合并吗?

  • Misaki ответили на это сообщение.
    Related Discussions
    ...

    mingjava I'm not sure if I fully understand your question due to the influence of machine translation, but regarding your last question about combining skins at runtime, yes, that is the recommended method. If you haven't seen Spine Examples/Other Examples/Mix and Match yet, I recommend checking it out first. This scene is briefly introduced in the following video:
    【[spine-unity] 通过示例场景开始使用spine-unity运行时】 【精准空降到 18:22】 https://www.bilibili.com/video/BV1DV4y1A7uf/?share_source=copy_web&t=1102

    • mingjava ответили на это сообщение.

      Misaki 您好,我看过了这个项目,但是我理解这个项目主要针对的是皮肤在一个spine项目里面定义的可以这样来做,如果我们把皮肤分拆到不同的项目里面,比如body和attach一个项目,head一个项目,在运行时拼接着两个皮肤就不行了吧,层级关系应该是会出问题吧。如果用替换附件的形式在运行时替换头这个皮肤的所有附件,我理解是可以的,但是因为一个头可能分为了很多的部分,可能有20个附件,又感觉这样替换比较繁琐。

      • Misaki ответили на это сообщение.

        mingjava I see, I think I understand what you are trying to do. To begin with, dividing the same character into multiple skeletons is not a recommended method. If the reason for dividing into multiple skeletons is because it is troublesome to set up the skins, it may be better to replace the texture atlas page at runtime. This is the method described in the following general runtime guide:
        Spine运行时指南 运行时皮肤 #创建附件

        In other words, create each head part in a uniform size and pack them using the texture packer.
        If the number and size of the input images match the texture packer settings, the texture packer will always pack the textures in the same layout. Therefore, by replacing the texture atlas page images loaded in Unity with the page images packed using this method, you can complete the change in the appearance of the skeleton.

        However, this does require the effort of preparing parts images in a uniform size. So, ultimately, it depends on where you want to put your effort. In some cases, it may be easier to have many skins for a single skeleton, as there are fewer things to keep in mind when preparing parts images. In addition, using skins allows you to use skin bones and skin constraints, so if the complexity varies greatly depending on the skin (e.g., some skins require only five parts for the head, while others require 30 parts), it is easier to manage by using skins.

        • mingjava ответили на это сообщение.

          Misaki 感谢您的热心解答,按照您的解答,我理解想在运行时构建一个角色的话,方案1就是替换贴图的形式,方案2就是同时加载两个完整的角色A和B,然后将B的head skin与A的attach,body skin组合到一起,但是A和B必须是完整的Spine项目。

          • Misaki ответили на это сообщение.

            mingjava I apologize, but I may have lost track of what you are trying to do. However, I thought the following might be the information you are looking for, so I will add it as a supplement.

            It is possible to reference a single texture atlas with multiple skeletons. If that's what you're looking for, the following threads may be helpful:

            Therefore, even if the skeleton is divided, each solution should work. Please let us know if it doesn't work.

            • mingjava ответили на это сообщение.

              Misaki 好的,我现在看看你提供的参考,我还想问个问题,就是只要在运行时打图集,那么一定需要所有参与打图集的图片必须是尺寸唯一才可以吧,否则打图集的布局方式不一致了,就也会导致程序运行问题。

              • Misaki ответили на это сообщение.

                mingjava If the part you want to replace is a mesh attachment, the replacement image must be the same size as the original image. However, if the attachment is not a mesh, you can replace it using the method shown in Spine Examples/Other Examples/Mix and Match Equip.

                • mingjava ответили на это сообщение.

                  Misaki 这个例子我是看过的,是通过替换图集里面指定插槽的附件实现的局部换装。我现在的换装方案是,同时加载两个完整的角色A和B,A和B共用一个.skel.bytes文件,A和B的图集里面的相同图片的尺寸都是一样的,然后将B的head skin与A的attach,body skin组合到一起,这样来实现换装。这样应该是可行的方案吧?是否需要同一个图集里面的图片尺寸都不同,这样打图集的时候保持layout一致。如果运行时重新打图集的布局改变了,而atlas.txt不变,应该会出现贴图位置对不上的问题吧

                  • Misaki ответили на это сообщение.

                    mingjava

                    A和B共用一个.skel.bytes文件

                    This cannot be achieved unless the same skeleton is used. It is not possible to merge skeletons that have been exported separately, so if this is one of your requirements, you should create characters A and B using the same skeleton.

                    If you ultimately want to merge into a single .skel.bytes file, what is the actual reason for splitting the skeleton?

                    • mingjava ответили на это сообщение.
                      • Изменено

                      Misaki 目前我的A和B是使用的同一个骨骼,我是在运行时加载的三个导出的资源,类似与这样的代码,以便保证我获得的SkeletonGraphics都是使用的同样的骨骼,每个对象都包含三个皮肤attach,body,head。我现在的需求是,希望能够在运行时加载的A的皮肤attach和body,与B的皮肤head进行组合。这样是否可行?事实上,我已经实现了这样的功能,但是对于简单的比如待机的动作可以,但是复杂一些的攻击动作,涉及到层级变化的,动画效果就乱了。` // 创建资源
                      SpineAtlasAsset atlasAsset = SpineAtlasAsset.CreateRuntimeInstance(part.atlasText, part.textures, materialPropertySource, true);
                      SkeletonDataAsset skeletonDataAsset = SkeletonDataAsset.CreateRuntimeInstance(part.skeletonJson, atlasAsset, true);

                                  // 创建SkeletonGraphic
                                  SkeletonGraphic skeletonGraphic = SkeletonGraphic.NewSkeletonGraphicGameObject(skeletonDataAsset, this.gameObject.transform, skeletonGraphicMaterial);
                                  skeletonGraphic.gameObject.name = $"SkeletonGraphic_{part.partName}";
                                  skeletonGraphic.Initialize(false);`

                        mingjava ` // 创建资源
                        SpineAtlasAsset atlasAsset = SpineAtlasAsset.CreateRuntimeInstance(part.atlasText, part.textures, materialPropertySource, true);
                        SkeletonDataAsset skeletonDataAsset = SkeletonDataAsset.CreateRuntimeInstance(part.skeletonJson, atlasAsset, true);

                                    // 创建SkeletonGraphic
                                    SkeletonGraphic skeletonGraphic = SkeletonGraphic.NewSkeletonGraphicGameObject(skeletonDataAsset, this.gameObject.transform, skeletonGraphicMaterial);
                                    skeletonGraphic.gameObject.name = $"SkeletonGraphic_{part.partName}";
                                    skeletonGraphic.Initialize(false);`

                        mingjava I realized that maybe what you're really looking for is to use Multiple CanvasRenders, Separator Slot Names and Enable Separation. Have you tried using those parameters?:
                        spine-unity 运行时文档 主要组件 SkeletonGraphic组件 #参数
                        (Although I have linked to the relevant section, this section is quite long, so it may be difficult to find the relevant item. Please scroll down to find the sections.)

                        You can use them to separate the rendering of the skeleton into any number of CanvasRenderers in a single instance. If your needs do not necessarily require two instances, this method is much easier to handle in terms of animation synchronization and other aspects. (Rendering is separate, but animation is managed by a single AnimationState.)

                        If you haven't tried it yet, it's worth giving it a try to see if it meets your needs.
                        The following thread may also be helpful:
                        https://esotericsoftware.com/forum/d/11375-separator-with-skeletongraphics/5

                        • mingjava ответили на это сообщение.

                          Misaki 不是这个需求,我的目的是,通过将两个同样骨骼的对象,拼接他们的皮肤,组合出新的骨骼动画来是否可行,对于一个骨骼对象,预置在这个骨骼里面的皮肤进行拼接是可行的,Spine的例子也是这么用的,那么对于两个同样骨骼的对象,加载到程序里面之后,组合他们的皮肤拼接是否可行?

                          • Misaki ответили на это сообщение.

                            mingjava It is likely that we will not be able to understand what you are trying to convey through text alone, so it would be best if you could send us a Unity project that reproduces the issue. Please create a minimal Unity project and send it to us via email: contact@esotericsoftware.com

                            Also, please explain the expected results with images or videos and attach them to the email.

                            • mingjava ответили на это сообщение.

                              Misaki 你好,misaki,感谢您的耐心解答,先不发邮件了,应该是spine的动作处理的有问题,程序上从两个同骨骼的项目去组合皮肤应该是可行的。

                              9 дней спустя

                              @mingjava I'm afraid your postings are not translating clearly via machine translation. Could you please describe in more words and more detail what you were saying in the last posting?

                              • mingjava ответили на это сообщение.

                                Harald 感谢您得热心回复,我希望能够使用一套骨骼数据,能够在运行时支持角色更换比如头部,身体,目前这两个部分是做成了皮肤head和body,目前我对于组合在一起得head和body,导出两套到unity,然后在程序里面通过组合head和body,可以组合出来四套角色。这些是我已经实现的功能,我想进一步研究,是否可以只导出两套head和两套body,然后还是两两组合,这样比head和body一起导更灵活,如何head和body都是单独导出,他们还能共享一套.skel.bytes导出文件吗?

                                @mingjava Thanks for the explanation, it is a bit clearer now. I'm unfortunately not sure why you want to export skins separately and how many skeleton file you would like it exported as. What is currently bad with exporting 2 head and 2 body skins normally as a single skeleton, resulting in e.g. 2 atlas page textures (2 .png files), 1 .atlas.txt file, and one skeleton file .skel.bytes? What problem are you trying to solve?

                                • mingjava ответили на это сообщение.

                                  @mingjava More precisely: what problem do you want to solve, is it to improve development of multiple people working on a single skeleton to support a split workflow better? Or do you want to improve runtime efficiency, and what precisely do you want to improve?