qjf1992

3.8版本SDK+URP,耗时很大(如图),非Deep单帧30ms左右,Deep模式下单帧57ms

资源裁剪只有一个4顶点的裁剪
节点数:65
顶点:2k,顶点变换6k,三角形3k
骨骼170个
您没有权限查看这个主题的附件。
qjf1992
  • 帖子: 2

Harald

请注意,将剪裁多边形与许多顶点组合起来会给 CPU 带来沉重的处理负载,因为每个三角形都需要被剪裁。 此处对此进行了描述:
剪裁附件 - Spine用户指南: 性能

由于您使用的是具有 4 个顶点的裁剪多边形,因此强烈建议使用 Unity 遮罩组件,例如 SpriteMaskMaskRectMask2d

如果您不能用 Unity 蒙版组件替换裁剪多边形,我们强烈建议尝试将裁剪多边形从 4 个顶点减少到 3 个顶点(裁剪多边形的大小无关紧要),并减少网格中的三角形数量 .
----
Please note that combining clipping polygons with many vertices will put a heavy processing load on the CPU, as each triangle needs to be clipped. This is described here:
剪裁附件 - Spine用户指南: 性能

Since you are using a clipping polygon with 4 vertices, it is highly recommended to use Unity masking components instead, such as SpriteMask, Mask and RectMask2d.

If you can't replace the clipping polygon with a Unity mask component, we would highly recommend trying to reduce the clipping polygon from 4 to 3 vertices (size of the clipping polygon does not matter), and reducing the number of triangles in the mesh.
头像
Harald

Harri
  • 帖子: 3996

qjf1992

非常感谢,你已经完全解决了我的问题。
我希望追问,即使只有一个剪裁,也会带来如此巨大的开销吗?
是否使用剪裁是一个错误的方式?
Harald 写道:请注意,将剪裁多边形与许多顶点组合起来会给 CPU 带来沉重的处理负载,因为每个三角形都需要被剪裁。 此处对此进行了描述:
http://zh.esotericsoftware.com/spine-clipping#%E6%80%A7%E8%83%BD

由于您使用的是具有 4 个顶点的裁剪多边形,因此强烈建议使用 Unity 遮罩组件,例如 SpriteMaskMaskRectMask2d

如果您不能用 Unity 蒙版组件替换裁剪多边形,我们强烈建议尝试将裁剪多边形从 4 个顶点减少到 3 个顶点(裁剪多边形的大小无关紧要),并减少网格中的三角形数量 .
----
Please note that combining clipping polygons with many vertices will put a heavy processing load on the CPU, as each triangle needs to be clipped. This is described here:
http://zh.esotericsoftware.com/spine-clipping#%E6%80%A7%E8%83%BD

Since you are using a clipping polygon with 4 vertices, it is highly recommended to use Unity masking components instead, such as SpriteMask, Mask and RectMask2d.

If you can't replace the clipping polygon with a Unity mask component, we would highly recommend trying to reduce the clipping polygon from 4 to 3 vertices (size of the clipping polygon does not matter), and reducing the number of triangles in the mesh.
qjf1992
  • 帖子: 2

Harald

很高兴听到它解决了您的问题!

关于使用裁剪多边形是否是“错误的方式”:
裁剪多边形的问题是每个附件三角形都需要与 CPU 上的每个裁剪三角形一起裁剪,因此它很快就会变得昂贵。 仅当您无法以其他方式创建相同效果并且只有很少的附件顶点可见时,才建议使用它。 但是,有时使用裁剪多边形是合理的,例如 就像在 spinboy 动画portal中一样,剪裁仅用于动画的开始。
-----
Glad to hear it solved your issue!

Regarding whether using clipping polygons is the "wrong way":
The problem with clipping polygons is that each attachment triangle needs to be clipped with every clipping triangle on the CPU, so it gets expensive rather quickly. It's only recommended when you can't create the same effect in another way, and have only few attachment vertices visible. However, sometimes it's justified to use a clipping polygon, e.g. as in the spineboy animation portal where clipping is only used for the beginning of the animation.
头像
Harald

Harri
  • 帖子: 3996


回到 中国Spine用户