• RuntimesUnity
  • Post-processing does not apply properly to spine object

We use Unity 2022.3.4 version and Spine 4.1 version.
When the depth of field effect is applied, It's applied based on the background(other 3D objects), not depending on the location of the spine character.
I think it's shader's problem. How can I fix it?
Used Universal RenderPipeline - Spine - skeleton lit shader.

Related Discussions
...

Which exact version (including the date) of the Spine URP Shaders UPM package are you using? You can find it in the name of the zip package, or alternatively tell us the package version that is shown in the Unity Package Manager.

If you're not using the latest version of the Spine URP Shaders UPM package, please have a try whether the latest version resolves your issue. You may also want to update the spine-unity runtime as well. As always, be sure to backup your project beforehand.

    Harald it's 4.1.20! As far as I know, it's the latest version...

    @choihyunji While 4.1.20 was not quite the latest package version (it was 4.1.21, you can see it here), the last update fixed unrelated issues. You can check the commit history on gihub here.

    Anyway, I misremembered that the added DepthNormals pass would cover the DoF effect as well. Unfortunately you need to enable ZWrite at shaders to have the DoF effect use the correct depth. While the URP/Spine/Sprite shader always supported this parameter, the other URP 3D shaders did not. Thus we've added a Depth Write property to the two remaining URP 3D shaders URP/Spine/Skeleton and URP/Spine/Skeleton Lit. We have just release new Spine URP Shaders UPM 4.1 and 4.2-beta packages:
    https://esotericsoftware.com/spine-unity-download

    You can then enable this Depth Write property and add minimal Advanced - Z Spacing like -0.01 at the SkeletonAnimation component to have the skeleton render to the depth buffer, and as a result have the DoF effect properly render.

    As you told me, I replaced the package with 4.1.22 version, activated the depth write property, and added z spacing. z spacing works fine but still doesn't have dof effect..



    I will send a small project that reproduces the problem to your email(contact@esotericsoftware.com). Please check if it's okay.

    @choihyunji Sorry to hear your problem persists. We've received your email, thanks for sending the reproduction project. We will have a look at it and get back to you here on the forum once we've figured out what's going wrong.

    @choihyunji It definitely has something to do with settings coming from the used URP-Highfidelity UniversalRenderPipelineAsset. When we switch the asset to the Example URP Asset which is included in the Spine URP Shaders UPM package, the DoF effect is displayed correctly. We will investigate what exactly is causing the problems and hopefully come up with a fix.

      Harald thank you! I'll look forward to it solved

      10 jours plus tard

      We just discovered the cause of the skeleton not being rendered to the depth buffer in the depth pre-pass for the DoF post processing effect. The Render Queue of the material must not be set to Transparent, otherwise it will not be rendered to the buffer at all. You can set the material's Render Queue parameter to Alpha Test via the Inspector as follows:

      Alternatively you could create a copy of the required shaders and change the tag "Queue"="Transparent" to "Queue"="AlphaTest" in lines like the following:

      Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }

      Don't forget to also change the shader's name in the first line of the file as well to a new name, e.g. with AlphaTest added as suffix.