zzf

如题,项目需要同时展示Spine做的动画,引擎是Unity,runtime version 3.8;
目前测试同样的动画可以合批,但是不同的动画之间不能合批,有什么方法可以让不同的Spine动画(纹理不同)也能做到合批吗?

---

https://answer.uwa4d.com/question/6100d3094f8c177460171597#621c4855e7172c2775006957
这篇文章提到了用 SRP Batcher降低DrawCall,试了下,不同的Spine动画(纹理不同)还是不能合批
zzf
  • Messaggi: 4

Harald

只有在所有实例中使用相同的纹理时,批处理才会起作用。当 Unity 批处理多个 Sprite 时,仅仅是因为它在幕后将多个较小的纹理组合成一个较大的 atlas 纹理,然后可以在具有看似不同材质的多个实例之间共享。

SRP 批处理器也不会解决与不同纹理相关的任何问题。它可能只有助于非纹理属性,如材质颜色。

所以简而言之,不幸的是,只能通过组合更多实例以使用单个共享图集纹理来减少批次数量。您通常会通过命令行界面而不是与每个骨架导出一起打包图集来做到这一点。

这是假设您没有看到单个骨架实例的多个批次(例如,由于多个混合模式或单个骨架的多个图集纹理)。如果是这种情况,那么优化绘图顺序或将附件图像分组到图集页面可能会有所帮助。
-----
Batching will only work when the same texture is used across all instances. When Unity batches multiple Sprites, it is only because behind the scenes it is combining multiple smaller textures to a larger atlas texture that can then be shared between multiple instances with seemingly different materials.

The SRP batcher will also not resolve any of the problems related to different textures. It may only help with non-texture properties like material color.

So in short, unfortunately the number of batches can only be reduced by combining more instances to use a single shared atlas texture. You would typically do this by packing the atlas via the command line interface instead of alongside each skeleton export.

This is under the assumption that you are not seeing multiple batches for a single skeleton instance (e.g. due to multiple blend modes or multiple atlas textures for a single skeleton). If this is the case, then optimizing the draw order or grouping of attachment images to atlas pages could help.
Avatar utente
Harald

Harri
  • Messaggi: 4206

zzf

不同的Spine工程之间可以共享纹理吗?现在已经做了3个不同的Spine工程,每个工程有一些image,我可以把这3个工程用到的image打成一个图集吗?
Harald ha scritto:只有在所有实例中使用相同的纹理时,批处理才会起作用。当 Unity 批处理多个 Sprite 时,仅仅是因为它在幕后将多个较小的纹理组合成一个较大的 atlas 纹理,然后可以在具有看似不同材质的多个实例之间共享。

SRP 批处理器也不会解决与不同纹理相关的任何问题。它可能只有助于非纹理属性,如材质颜色。

所以简而言之,不幸的是,只能通过组合更多实例以使用单个共享图集纹理来减少批次数量。您通常会通过命令行界面而不是与每个骨架导出一起打包图集来做到这一点。

这是假设您没有看到单个骨架实例的多个批次(例如,由于多个混合模式或单个骨架的多个图集纹理)。如果是这种情况,那么优化绘图顺序或将附件图像分组到图集页面可能会有所帮助。
-----
Batching will only work when the same texture is used across all instances. When Unity batches multiple Sprites, it is only because behind the scenes it is combining multiple smaller textures to a larger atlas texture that can then be shared between multiple instances with seemingly different materials.

The SRP batcher will also not resolve any of the problems related to different textures. It may only help with non-texture properties like material color.

So in short, unfortunately the number of batches can only be reduced by combining more instances to use a single shared atlas texture. You would typically do this by packing the atlas via the command line interface instead of alongside each skeleton export.

This is under the assumption that you are not seeing multiple batches for a single skeleton instance (e.g. due to multiple blend modes or multiple atlas textures for a single skeleton). If this is the case, then optimizing the draw order or grouping of attachment images to atlas pages could help.
zzf
  • Messaggi: 4

Harald

是的,您可以将三个 Spine 项目的附件图像打包到一个单一的图集纹理中(以及一个单一的 .atlas.txt 描述文件,然后用于所有骨架)。 您通常会通过命令行界面打包图集来做到这一点:
Command line interface - Spine User Guide

由于您还在 这个其他论坛主题 上回答了问题,因此是 这个问题也许已经在那里回答了?
-----
Yes, you can pack attachment images of three Spine projects into a single atlas texture (and a single .atlas.txt description file that is then used at all skeletons). You would typically do this by packing an atlas via the command line interface:
Command line interface - Spine User Guide

Since you also answered on this other forum thread, is the question perhaps already answered there?

---

理论上,您也可以通过 Spine Editor GUI 执行此操作,但始终建议设置导出脚本以便快速重新导出。 使用 GUI,您可以将三个骨架添加到单个 Spine 项目,然后启用 Texture Atlas - Pack 并选择 Image folderto - Single atlas
Texture packing - Spine User Guide: Packing during data export
您还可以选择 Spine - Texture Packer.. 将 GUI 中的文件夹打包为单个图集纹理。
-----
You could theoretically also do this via the Spine Editor GUI, however it is always recommended to setup export scripts for quick re-export. Using the GUI, you could either add three skeletons to a single Spine project and then enable Texture Atlas - Pack and select Image folder and to - Single atlas.
Texture packing - Spine User Guide: Packing during data export
You can also select Spine - Texture Packer.. to pack a folder from the GUI to a single atlas texture.
Avatar utente
Harald

Harri
  • Messaggi: 4206


Torna a 中国Spine用户