合并皮肤之后,新的Spine形象的清晰度降低了
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 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:
- https://esotericsoftware.com/forum/d/26758-%E5%A6%82%E4%BD%95%E8%AE%A9%E5%A4%9A%E4%B8%AAspine%E9%A1%B9%E7%9B%AE%E5%85%B1%E7%94%A8%E4%B8%80%E5%BC%A0%E5%9B%BE%E9%9B%86
- https://esotericsoftware.com/forum/d/25014-how-to-merge-atlas/4
Therefore, even if the skeleton is divided, each solution should work. Please let us know if it doesn't work.
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?
- Изменено
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 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 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 I'm afraid you've described a problem you've encountered in your attempted solution, but not what initial problem you want to solve. Could you please answer this question:
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?