43 position = clamp(position, ivec2(0), size - 1);
44 return textureLod(samp, (vec2(position) + 0.5) / vec2(size), 0.0).rgb;
51 ivec2 position = ivec2(gl_GlobalInvocationID.xy);
52 ivec2 size = imageSize(outputImage);
53 if (any(greaterThanEqual(position, size)))
57 ivec2 block_size = ivec2(max(4,
int(mix(32.0, 8.0,
strength))),
58 max(2,
int(mix(14.0, 4.0,
strength))));
59 ivec2 block = position / block_size;
60 float frame_step = floor(
float(
iFrame) / 3.0);
61 float random_value =
hash12(vec2(block) + vec2(frame_step, -frame_step * 0.37));
62 float block_gate = step(1.0 - 0.72 *
strength, random_value);
64 int horizontal_shift = int((
hash12(vec2(block.y, frame_step)) - 0.5) *
66 int vertical_shift = int((
hash12(vec2(block.x, frame_step + 17.0)) - 0.5) *
68 ivec2 displaced = position + ivec2(horizontal_shift, vertical_shift) * int(block_gate);
70 vec3 shifted =
source_at(displaced, size);
72 float static_noise =
hash12(vec2(position) + frame_step * vec2(13.0, 7.0));
73 vec3 digital_noise = vec3(static_noise,
74 hash12(vec2(position.yx) + frame_step * 11.0),
76 float noise_gate = block_gate * step(0.84,
hash12(vec2(block) + 41.0));
77 vec3 color = mix(source, shifted.brg, block_gate * (0.45 + 0.55 *
strength));
78 color = mix(color, digital_noise, noise_gate * 0.70);
79 imageStore(outputImage, position, vec4(clamp(color, 0.0, 1.0), 1.0));
float hash12(vec2 p)
Evaluates hash12 for this shader effect.