Add the Dither Functions.cginc
file to the shader in the "Shader Settings" panel
Add a code node
Add the properties scoord
as a float2
and alpha
as a float
Set the code body to
// screen space position in pixels
float2 spos = (scoord / 2 + float2(0.5, 0.5));
// 0 for clip and 1 for opaque
return ceil(isDithered(spos, alpha));
Add mask
as a sampler2D
and maskScale
as float
Set the code body to
// screen space position in pixels
float2 spos = (scoord / 2 + float2(0.5, 0.5));
// 0 for clip and 1 for opaque
return ceil(isDithered(spos, alpha, mask, maskScale));