Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ZClip command in ShaderLab reference

Reference for the ZClip command in ShaderLab.
Read time 1 minuteLast updated 25 days ago

Important
The Built-In Render Pipeline is deprecated and will be made obsolete in a future release.
It remains supported, including bug fixes and maintenance, through the full Unity 6.7 LTS lifecycle.
Sets the GPU's depth clip mode, which determines how the GPU handles fragments that are outside of the near and far planes.

Render pipeline compatibility

Feature name

Universal Render Pipeline (URP)

High Definition Render Pipeline (HDRP)

Custom SRP

Built-in Render Pipeline

ZClipYesYesYesYes

Syntax

This command makes a change to the render state. Use it in a
Pass
block to set the render state for that Pass, or use it in a
SubShader
block to set the render state for all Passes in that SubShader.

Signature

Example syntax

Function

ZClip [enabled]ZClip TrueSets the depth clip mode.

Parameters

Parameter

Value

Function

enabledTrueSets the depth clip mode to clip.

This is the default setting.
FalseSets the depth clip mode to clamp.

Fragments closer than the near plane are at the near plane exactly, and fragments further away than the far plane are at the far plane exactly.

Additional resources