• RuntimesUnity
  • 请教一下:在U3D2021中,怎么解决spine 动画与模型的遮挡关系

比如一个圆环特效,它需要与spine动画实现遮挡关系,它的前面挡住spine,它的背面被spine遮挡。我试了材质球,不要叠加模式和透明通道能够实现,但是加上透明通道和ADD就无法实现了。请问有什么办法吗?

    Related Discussions
    ...

    cjx 来你在Unity项目中实现你的骨架时遇到了麻烦,所以我把标签从 "Editor "改为 "Unity"。

    我相信我们的Unity专家Harald稍后会给你建议,但我认为最好能提供更多关于你如何实现骨架的信息,例如你使用的Spine编辑器和spine-unity运行时的版本,以及你使用哪些组件(SkeletonAnimationSkeletonGraphic,或SkeletonMecanim)来实例化你的骨架。


    It seems that you are having trouble with the implementation of your skeleton in your Unity project, so I have changed the tag to Unity from Editor.

    I'm sure Harald, our Unity expert, will be able to advise you later, but I think more information on how you are implementing your skeleton would be appreciated, e.g. the version of the Spine editor and spine-unity runtime you are using, and which components (SkeletonAnimation, SkeletonGraphic, or SkeletonMecanim) you are using to instantiate your skeleton.

    cjx 如果我正确理解了您的要求,您需要一个对象的一部分(一个环)在前面,一个在骨架游戏对象(例如“SkeletonRenderer”或“SkeletonAnimation”游戏对象)后面。

    有两种解决方案可以实现这一点:

    • a) 如果你的对象不是平面的2D图像而是有3D深度,你可以使用深度缓冲区自动执行排序。 然后,您需要确保您的骨架使用带有启用了“ZWrite”(也称为“Depth Write”、“Write to Depth”)的着色器的材质,例如 Spine/Skeleton Lit ZWrite。 您可以在 此处 查看 Spine 着色器。 然后你的其他对象(环)可以使用正常的深度测试而不需要深度写入(透明添加效果很常见)。 然后你需要确保你的环对象在骨架之后渲染(如果对象排序碰巧放在它之前,你可以相应地设置RenderQueue偏移量)。 缺点是在骨架材质上启用“ZWrite”有其自身的视觉缺陷(透明边界处的锯齿状边缘)。
    • b) 你只是把环对象分成两个对象。 此解决方案不需要任何特殊的着色器属性。

    If I understood your requirement correctly, you want one part of an object (a ring) in front and one behind a skeleton GameObject (e.g. SkeletonRenderer or SkeletonAnimation GameObject).

    There are two solutions to achieve this:

    • a) If your object is not a flat 2D image but has 3D depth, you can use the depth buffer to perform the sorting automatically. Then however you need to ensure that your skeleton uses a Material with a shader that has ZWrite (also called Depth Write, Write to Depth) enabled, like e.g. Spine/Skeleton Lit ZWrite. You can check out the Spine shaders here. Then your other object (the ring) can use the normal depth test without the need for depth write (as is common for transparent additive effects). You need to ensure then that your ring object is rendered after the Skeleton (if object sorting happens to place it before, you can set the RenderQueue offset accordingly). The drawback is that enabling ZWrite at a skeleton material has it's own visual drawbacks (jaggy edges at the transparency border).
    • b) You just split the ring object in two objects. This solution does not require any special shader properties.
    • Responderam a isso cjx.
    • cjx curtiu isso.
      um mês depois

      Harald
      Thank you very much for your explanation. Wishing you a happy life!

      @cjx Glad to hear it helped, thanks for getting back to us. All the best for your project!