To address the issue of Depth of Field (DoF) not working correctly with Spine assets in Unity's Universal Render Pipeline (URP), you can try the following steps:
Shader Modification: Ensure that the Spine shaders are writing to the depth buffer. Most Spine shaders do not write to the depth buffer by default to allow for better alpha blending. You can modify the shader to include ZWrite On
and AlphaTest
tags. This will help the DoF effect to correctly interpret the depth of the Spine assets.
Render Queue Adjustment: Modify the render queue of the Spine shaders. By default, the render queue might be set to AlphaTest
(2450). You can change it to a higher value, such as 3000, to ensure it is rendered after opaque objects. This can be done by editing the shader or through the material settings in Unity.
Transparency Sort Mode: Ensure that the transparency sort mode is set correctly. From your GraphicsSettings.asset
, it looks like you have set m_TransparencySortMode: 0
and m_TransparencySortAxis: {x: 0, y: 0, z: 1}
, which is correct for sorting by depth.
Post-Processing Order: Adjust the order of the DoF effect in the render queue. You might need to apply the DoF effect after transparent objects instead of after opaque objects. This can be done by modifying the post-processing settings or using a different DoF implementation that supports this.
URP Asset Settings: Ensure that the URP asset settings are configured correctly. Sometimes, switching to a different URP asset (like the example URP asset included in the Spine URP Shaders UPM package) can resolve issues with post-processing effects.
Here are some useful links and references from the context:
By following these steps, you should be able to get the Depth of Field effect working correctly with your Spine assets in Unity's URP.