Disable writing to the depth buffer in a shader
Use the ZWrite command to set whether the GPU renders to the depth buffer.
阅读时间1 分钟最后更新于 25 天前
ZWriteDisabling ZWrite can lead to incorrect depth ordering. In this case, you need to sort geometry on the CPU.
Examples
This example code demonstrates the syntax for using this command in a Pass block.
Shader "Examples/CommandExample"{ SubShader { // The rest of the code that defines the SubShader goes here. Pass { // Disables writing to the depth buffer for this Pass ZWrite Off // The rest of the code that defines the Pass goes here. } }}
This example code demonstrates the syntax for using this command in a SubShader block.
Shader "Examples/CommandExample"{ SubShader { // Disables writing to the depth buffer for this SubShader ZWrite Off // The rest of the code that defines the SubShader goes here. Pass { // The rest of the code that defines the Pass goes here. } }}