• RuntimesUnity
  • spine-unity 4.2 Additive Material 叠加效果无法生效

spine-unity运行时版本:4.2
色彩空间:Linear
unity版本:2021.3.30f1

在spine中是这样的,有一层使用了叠加效果的蓝光:

但在unity播放时,使用了叠加效果的图片无法显示:

动画播放在UI上,我发现在启用了MPA Vertex Colors时,显示,我想知道Additive效果的失效是不是因为启用了上述选项,如果是我该如何处理(我尝试关掉MPA Vertex Colors,但是发现其他地方出现了问题,并且似乎上述蓝光仍然没有显示)?

希望大家能给我一些帮助,我将不胜感激!
![](https://)
以下是我的具体配置:

    Related Discussions
    ...

    根据你提供的信息和截图,叠加效果在Unity中无法生效可能是由于以下几个原因:

    1. 预乘Alpha设置:确保在Spine导出时启用了预乘Alpha(Premultiply Alpha),并且在Unity中相应的材质设置也启用了预乘Alpha。你可以参考以下链接了解更多关于预乘Alpha的设置:Spine Unity Documentation

    2. 叠加模式设置:检查你在Spine中使用的叠加模式是否正确映射到Unity中的材质设置。根据你提供的上下文,叠加模式在Spine中设置为Additive,但在Unity中可能需要手动调整材质的混合模式。

    3. 透明背景问题:如果你的图片在Spine中使用了透明背景,确保在Unity中也正确处理了透明背景。你可以尝试将背景设置为非透明,或者确保图片的背景颜色与预期一致。

    4. PMA Vertex Colors:你提到启用了PMA Vertex Colors时显示正常,但关闭后出现问题。可以尝试在Unity中调整材质的其他设置,确保在关闭PMA Vertex Colors时,叠加效果仍然能够正确显示。

    以下是一些具体的步骤来排查和解决问题:

    1. 检查Spine导出设置

      • 确保启用了预乘Alpha(Premultiply Alpha)。
      • 确保导出的图片没有黑色背景,或者在Unity中正确处理了透明背景。
    2. 检查Unity材质设置

      • 确保材质使用了正确的Shader(例如Spine/Skeleton)。
      • 确保启用了预乘Alpha(Premultiply Alpha)选项。
      • 调整材质的混合模式为Additive。
    3. 调试和测试

      • 尝试在Unity中创建一个简单的测试场景,仅包含一个使用叠加效果的图片,逐步调整设置,观察效果变化。
      • 如果问题仍然存在,可以尝试在Unity中手动调整材质的其他参数,确保叠加效果能够正确显示。

    希望这些建议能帮助你解决问题。如果你有更多具体的配置或代码,可以进一步提供,我们可以更详细地进行排查。

      Spinebot 我导出时启用了Bleed,因为我使用的工作流是Straight Alpha,我要在Linear色彩空间下工作,是因为这个问题Additive才会失效吗?

      ruler spine-unity运行时版本:4.2

      Which exact version of the spine-unity 4.2 runtime are you using? What does the Package Manager version say?

      色彩空间:Linear

      Did you also switch the Spine Editor settings to use Linear blending?
      See the documentation of the Color Management setting here:
      http://zh.esotericsoftware.com/spine-settings#%E8%89%B2%E5%BD%A9%E7%AE%A1%E7%90%86
      http://de.esotericsoftware.com/spine-settings#Color-management

      ruler 动画播放在UI上,我发现在启用了MPA Vertex Colors时,显示,我想知道Additive效果的失效是不是因为启用了上述选项,如果是我该如何处理(我尝试关掉MPA Vertex Colors,但是发现其他地方出现了问题,并且似乎上述蓝光仍然没有显示)?

      In general setting Advanced - PMA Vertex Colors is correct when using Spine shaders.

      One incorrect setting in your screenshots is the setting Apply Additive Material at SkeletonDataAsset:

      Apply Additive Material should be disabled, as you want to use PMA Vertex Colors to apply the additive effect, not apply a separate additive material. This should not cause the issue though.

        Harald 感谢你的回复!我发现我的additive效果光不是消失了,而是在unity中看比较暗淡。因为我测试将additive效果光变成夸张的黄色,在unity其实能看见黄光:

        但是在spine中已经将亮度调至最大,unity看整体还是会暗一点。是否是因为之前制作spine动画时,ColorManagement的设置保持默认(不启用ColorManagement, 且选择了Gamma blending)的缘故呢?但是当我启用ColorManagement并选择Linear后,进入动画界面有时会出现Bug,显示了一个镂空的窗口并且不能点击它:

        虽然出现上述Bug,但我还是在选择ColorManagement Linear的情况下重新导出到unity了,颜色暗淡的情况还是没有改善
        请问这种整体偏暗淡是什么原因?

          ruler I would like to know more about the bug that sometimes occurs in Spine when ColorManagement is enabled and Linear is selected. Are you using macOS? We used to have a problem with ColorManagement not working properly on macOS, but if you are using the latest Spine launcher and editor, this problem should be resolved. Please let us know your OS and the version of the Spine launcher and editor you are using.

            Misaki 我的spine editor是4.2.333,使用的是windows10,这个bug如果出现的话,是不是我转换到ColorManagement Linear 其实是失败了呢?

              Misaki Thanks for the information. Unfortunately, I have not been able to reproduce the bug you mentioned in the Spine Editor.

              是不是我转换到ColorManagement Linear 其实是失败了呢?

              The ColorManagement setting in the Spine editor only affects the preview, so it does not change anything in the actual exported textures. Therefore, the bug you are encountering should not affect how it looks in Unity.

              I'll investigate the reason why the color is different from the spine editor.

              ruler I noticed that you did not answer one of Harald's questions: What is the exact version of the spine-unity runtime you are using? For example, the latest version is spine-unity-4.2-2024-07-19.

                ruler Looking at the screenshot you took on the Spine editor, I noticed that part of the background is transparent. As Spinebot already pointed out, note that when using additive blending it is affected by the background color. For example, below is an example where I set all slots in Spineboy to Additive blend, but if I put a gray background image, it looks like this:

                However, if you hide the background image, it will look like this:

                Make sure that the additive image is on the same background on Spine as it is in Unity.

                Misaki 不好意思我略过了,我用的运行时版本是spine-unity-4.2-2024-07-17

                @ruler Please note that the purpose of changing the Spine Editor settings to Linear blending is to see the colors blended in the same style as in Unity (which is set to Linear color space). If the Spine Editor was set to Gamma space blending, the Spine Editor display is unsuitable as a preview since it will display completely different blending colors. Export and import is unaffected by these settings, as Misaki mentioned above.

                What does the scene now look like in the Spine Editor with Linear blending? Also note that only the main viewport will show Linear blending, the Animation Preview window always shows Gamma space blending.

                If it still looks very different, could you please share a minimal Unity project which still demonstrates this issue? You can send it as a zip file to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at it.