llxwd008

Unity游戏,当场景中有很多spine对象时,每帧更新会消耗大量时间在update和数值计算上(特别是插值时三角函数计算,手机CPU计算这些比PC慢太多了)。有可能预先导出每个动画的每一帧mesh,uv数据,在runtime的时候直接Render这一帧,而不去实时进行运算吗?相当于一个预烘焙的过程。
llxwd008
  • 帖子: 2

Nate

We don't provide a way to bake the meshes, sorry. You could use the Spine Runtimes to generate the baked data yourself. For example, here is some code that applies an animation at a given framerate and prints out the bone locations:
很抱歉,我们不提供烘焙网格的方法。你可以使用Spine Runtimes来自己生成烘焙数据。例如,这里有一些代码,可以在给定的帧率下应用动画,并打印出骨骼的位置。
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/BonePlotting.java#L75

You could do similar, but print out mesh vertices. You'd need to store the data and write something that applies it at runtime, which may be a lot of work. :(
你可以做类似的事情,但是打印出网格顶点。你需要存储数据,并写一些在运行时应用数据的东西,这可能会有很多工作。 :(

Can you show your metrics view?
你能展示一下你的指标视图吗?

It may be sufficient to simplify your skeletons and animations. If not paying attention, it is likely that your skeletons are well not optimized. Keep the number of mesh vertices to a minimum needed for the deformations you are doing. Use prune to minimize how many bones affect each vertex (to reduce the number of vertex transforms). Avoid deform keys, as they require a lot of space and interpolating between deform keys uses CPU. instead, use weights and animate bones to deform meshes.
它可能足以简化你的骨架和动画。如果不注意,很可能你的骨架好没有优化。将网格顶点的数量保持在你所做的变形所需的最小值。使用prune来尽量减少影响每个顶点的骨骼数量(以减少顶点变换的数量)。避免使用变形键,因为它们需要大量的空间,而且变形键之间的插值会消耗CPU。相反,使用权重和动画骨骼来变形网格。

Sorry most of those links are to the English documentation. The Chinese documentation has not been updated in some time. We are working on updating the English documentation for 4.0, then we'll do the Chinese translations again (it's a lot of work!).
抱歉,这些链接大多是英文文档。中文文档已经有一段时间没有更新了。我们正在努力更新4.0的英文文档,然后再做中文翻译(这是一个很大的工作!)。
头像
Nate

Nate
  • 帖子: 10741

Harald

它可能不是您想要的,但是spine-unity还允许烘焙到骨架网格物体,这至少可以节省一些运行时计算。

请在spine-unity文档中查看此部分:
spine-unity Runtime Documentation: Skeleton Baking
-----
It might not be what you want, but spine-unity also allows baking to a skeletal mesh, which saves at least some runtime computations.

Please see this section in the spine-unity docs:
spine-unity Runtime Documentation: Skeleton Baking
头像
Harald

Harri
  • 帖子: 2774

llxwd008

Nate 写道:We don't provide a way to bake the meshes, sorry. You could use the Spine Runtimes to generate the baked data yourself. For example, here is some code that applies an animation at a given framerate and prints out the bone locations:
很抱歉,我们不提供烘焙网格的方法。你可以使用Spine Runtimes来自己生成烘焙数据。例如,这里有一些代码,可以在给定的帧率下应用动画,并打印出骨骼的位置。
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/BonePlotting.java#L75

You could do similar, but print out mesh vertices. You'd need to store the data and write something that applies it at runtime, which may be a lot of work. :(
你可以做类似的事情,但是打印出网格顶点。你需要存储数据,并写一些在运行时应用数据的东西,这可能会有很多工作。 :(

Can you show your metrics view?
你能展示一下你的指标视图吗?

It may be sufficient to simplify your skeletons and animations. If not paying attention, it is likely that your skeletons are well not optimized. Keep the number of mesh vertices to a minimum needed for the deformations you are doing. Use prune to minimize how many bones affect each vertex (to reduce the number of vertex transforms). Avoid deform keys, as they require a lot of space and interpolating between deform keys uses CPU. instead, use weights and animate bones to deform meshes.
它可能足以简化你的骨架和动画。如果不注意,很可能你的骨架好没有优化。将网格顶点的数量保持在你所做的变形所需的最小值。使用prune来尽量减少影响每个顶点的骨骼数量(以减少顶点变换的数量)。避免使用变形键,因为它们需要大量的空间,而且变形键之间的插值会消耗CPU。相反,使用权重和动画骨骼来变形网格。

Sorry most of those links are to the English documentation. The Chinese documentation has not been updated in some time. We are working on updating the English documentation for 4.0, then we'll do the Chinese translations again (it's a lot of work!).
抱歉,这些链接大多是英文文档。中文文档已经有一段时间没有更新了。我们正在努力更新4.0的英文文档,然后再做中文翻译(这是一个很大的工作!)。
Thank you, I think I can read some Eng Document, I'll try it, Thanks.

---

Harald 写道:它可能不是您想要的,但是spine-unity还允许烘焙到骨架网格物体,这至少可以节省一些运行时计算。

请在spine-unity文档中查看此部分:
spine-unity Runtime Documentation: Skeleton Baking
-----
It might not be what you want, but spine-unity also allows baking to a skeletal mesh, which saves at least some runtime computations.

Please see this section in the spine-unity docs:
spine-unity Runtime Documentation: Skeleton Baking
I have tested this Skeleton-Baking...It bake the spine skeleton to Unity Animator and Animations, it may still cost a lots in runtime, I'll try it, Thank you!
llxwd008
  • 帖子: 2

Harald

是的,不幸的是,它仅保存了部分计算(通过将顶点转换计算移至GPU),而不是全部。 它可能会有所改善,在很大程度上取决于您的设置。
-----
Yes, unfortunately it only saves some of the computations (by moving vertex transformation computations to the GPU), but not all. It might just improve things a bit, how much depends largely on your setup.
头像
Harald

Harri
  • 帖子: 2774


回到 中国Spine用户