[URP] Fix Inconsistent Depth of Field Blurring on Particles
Solution
Unity 2019.4.x - Unity 6.3.x
Published 21 days ago
A ParticleSystem rendered with Depth of Field (DoF) exhibits inconsistent blurring behavior. Particles often appear sharp when positioned in front of nearby opaque geometry but become excessively blurred when viewed against the skybox or distant objects. This happens because the transparent particle shader does not perform a Depth Write by default, causing the post-processing stack to use the depth values of the background objects instead of the particles themselves.
Ensure consistent particle blurring by enabling Depth Write and adjusting the Render Queue to AlphaTest for proper depth buffer interaction.
The inconsistent blurring of particles with Depth of Field is addressed by properly configuring the material rendering queue. The core of the issue lies in how particles interact with the depth buffer, which DoF effects rely upon.
- Select your particle material and ensure Depth Write is enabled.
- Set the
Queue ControltoUserOverride. - Change the
Render Queueproperty toAlphaTest(or 2450). - If using
Surface Typeset toTransparent, ensure theZWritetoggle is explicitly enabled to perform a Depth Write.
Additional Tips
- Enable
Depth Texturein theUniversal Render Pipeline Assetsettings to ensure the depth buffer is available for post-processing. - Setting the queue to
AlphaTestensures particles are rendered before the standard transparent queue, allowing a Depth Write to occur early in the frame. - Be aware that enabling Depth Write on semi-transparent particles can cause sorting issues if many particles overlap significantly.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.