ColorMask command in ShaderLab reference
Reference for the ColorMask command in ShaderLab.
阅读时间1 分钟最后更新于 1 个月前
Sets the color channel writing mask, which prevents the GPU from writing to channels in the render target.
Render pipeline compatibility
Feature name | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom SRP | Built-in Render Pipeline |
|---|---|---|---|---|
| ColorMask | Yes | Yes | Yes | Yes |
Syntax
This command makes a change to the render state. Use it in a block to set the render state for that Pass, or use it in a block to set the render state for all Passes in that SubShader.
PassSubShaderSignature | Example syntax | Function |
|---|---|---|
| | Write to the given channels of the default render target. |
| | As above, but for a given render target. |
Parameters
Parameter | Value | Function |
|---|---|---|
| render target | Integer, 0 through 7. | The render target index. |
| channels | | Disables color writes to the R, G, B, and A channels. |
| Enables color writes to the red channel. | |
| Enables color writes to the green channel. | |
| Enables color writes to the blue channel. | |
| Enables color writes to the alpha channel. | |
Any combination of | Enables color writes to the given channels. |