Skip to content

Transparency Sorting Fix

Vladislav Kantaev edited this page Aug 6, 2022 · 3 revisions

When working with complex transparent objects, you may encounter sorting issues. This happens because the order in which the mesh parts are drawn is not under your control; therefore, it can be arbitrary.

Sorting Issue Sorting Issue Fixed
Sorting Issue Sorting Issue Fixed

It is possible to fix via the so-called Depth Pre-Pass. It means that even though the object is transparent, we can write it to the depth buffer to ensure only the topmost geometry will be drawn during the transparent pass.

To enable the Depth Pre-Pass, locate your renderer asset. By default, it should be named UniversalRenderPipelineAsset_Renderer.

In the Inspector, click Add Renderer Feature/Render Objects. Configure the pass as follows. Note:

  • The name of the pass can be any.
  • You can set the Layer Mask to limit the effect to particular objects only.
  • The LightMode Tags should be as specified. DepthOnly is the name of the pass, which is implemented to only write to the depth buffer.

Depth Pre-Pass

Clone this wiki locally