dither now respects pixel size setting

This commit is contained in:
Valerie Wolfe 2024-04-08 19:32:18 -04:00
parent 5937e2ccee
commit 52c9809c65

View file

@ -61,12 +61,16 @@ const int indexMatrix8x8[64] = int[](0, 32, 8, 40, 2, 34, 10, 42,
63, 31, 55, 23, 61, 29, 53, 21); 63, 31, 55, 23, 61, 29, 53, 21);
float indexValue() { float indexValue() {
int x = int(mod(gl_FragCoord.x, 4)); #if pixelSize > 1
int y = int(mod(gl_FragCoord.y, 4)); vec2 coord = gl_FragCoord.xy / pixelSize;
#else
vec2 coord = gl_FragCoord.xy;
#endif
int x = int(mod(coord.x, 4));
int y = int(mod(coord.y, 4));
return indexMatrix4x4[(x + y * 4)] / 16.0; return indexMatrix4x4[(x + y * 4)] / 16.0;
} }
float hueDistance(float h1, float h2) { float hueDistance(float h1, float h2) {
float diff = abs((h1 - h2)); float diff = abs((h1 - h2));
return min(abs((1.0 - diff)), diff); return min(abs((1.0 - diff)), diff);