half4 bits = mod(half4(sk_FragCoord.yxyx), half4(2.0, 2.0, 4.0, 4.0)); bits.zw = step(2.0, bits.zw); bits.xz = abs(bits.xz - bits.yw); value = dot(bits, half4(0.5, 0.25, 0.125, 0.0625)) - 0.46875; } %s = half4(clamp(color.xyz + value * %s, 0.0, color.w), color.w);