Установить цветовые каналы для GPU
По умолчанию GPU пишет во все каналы (RGBA). Для некоторых эффектов часть каналов нужно оставить нетронутыми: например, можно отключить запись цвета, чтобы отрисовать бесцветные тени. Другой распространённый случай — полностью отключить запись цвета, чтобы заполнить данными один буфер, не записывая в другие: скажем, заполнить буфер трафарета, не трогая цель рендеринга.
Примеры
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Enable writing only to the RGB channels for this Pass, which disables writing to the alpha channel
ColorMask RGB
// The rest of the code that defines the Pass goes here.
}
}
}
Этот пример кода демонстрирует синтаксис для использования этой команды в блоке SubShader.
Shader "Examples/CommandExample"
{
SubShader
{
// Enable writing only to the RGB channels for this SubShader, which disables writing to the alpha channel
ColorMask RGB
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}
Дополнительные ресурсы
- Команда ColorMask в ссылке ShaderLab