Enables or disables alpha-to-coverage mode on the GPU.
Alpha-to-coverage mode can reduce the excessive aliasing that occurs when you use multisample anti-aliasing (MSAA) with shaders that use alpha testing, such as vegetation shaders. To do this, it modifies the multisample coverage mask proportionally to the alpha value in the output of the fragment shader result.
This command is intended for use with MSAA. If you enable alpha-to-coverage mode when you are not using MSAA, the results can be unpredictable; different graphics APIs and GPUs handle this differently.
Feature name | 빌트인 렌더 파이프라인 | 유니버설 렌더 파이프라인(URP) | 고해상도 렌더 파이프라인(HDRP) | Custom SRP |
---|---|---|---|---|
AlphaToMask | 지원 | 지원 | 지원 | 지원 |
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 | 기능 |
---|---|---|
AlphaToMask <state> |
AlphaToMask Off |
Enables or disables alpha-to-coverage mode. |
파라미터 | 값 | 기능 |
---|---|---|
state | On |
Enables alpha-to-coverage mode. |
Off |
Disables alpha-to-coverage mode. |
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Enable alpha-to-coverage mode for this Pass
AlphaToMask On
// 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
{
// Enable alpha-to-coverage mode for this SubShader
AlphaToMask On
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}