summaryrefslogtreecommitdiff
path: root/shaders/post/grain.glsl
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 10:46:03 -0300
committerGabriel Schneider <[email protected]>2026-11-05 15:12:36 -0300
commit11204e1206f7f7ffeaa861c1a442a312e563d3ed (patch)
treef788736bf5b6a56694563b664b5db73bc54bff72 /shaders/post/grain.glsl
parentc9b9dad8469f5d654c31d688d7e2d93da8325f39 (diff)
downloadpardes-11204e1206f7f7ffeaa861c1a442a312e563d3ed.tar.gz
pardes-11204e1206f7f7ffeaa861c1a442a312e563d3ed.zip
effects out, the post chain: Crt, Bloom, Vignette, Grain, Shader and ShaderAnimation go with src/gui/Post.zig, src/ShaderBuild.zig (the run-time glslc spawn and its watched files), shaders/post/, post.vert, bloom-down and bloom-up and their prebuilt .spv, the window's scene texture and its post-chain-only redraw (level A), the disable_scene_effects tape site and Pardes.disableSceneEffects; EffectCode goes with src/effect_sources.zig, which only embedded the effects' sources (/virtual keeps src/); the corner-click test keeps its point without a chain, the window monkey loses its Bloom axis; macOS's post-processor (ScenePostprocessor.swift, crt.ci.metal, pardes_scene) is a change of its own
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'shaders/post/grain.glsl')
-rw-r--r--shaders/post/grain.glsl32
1 files changed, 0 insertions, 32 deletions
diff --git a/shaders/post/grain.glsl b/shaders/post/grain.glsl
deleted file mode 100644
index 61c51492..00000000
--- a/shaders/post/grain.glsl
+++ /dev/null
@@ -1,32 +0,0 @@
-// Grain: the page's own ground takes a fine, still grain, like paper. Only
-// pixels of the page's colour (iBackgroundColor) are grained: no glyph, no
-// selection, no tag or rule, and nothing in pardesSpare. The grain averages
-// to the page, is a logical pixel big (pardesScale), and never moves, so it
-// costs no frames. At most 1.5, 3 and 5 of 255 at levels 1 to 3, and never
-// more than pardesCap, which keeps the text on it at its own contrast or 4.5.
-// It is a Shadertoy file: pardes puts its prefix before it.
-
-float amplitude() { return min(pardesByLevel(1.5, 3.0, 5.0) / 255.0, pardesCap); }
-
-// An integer hash of the grain cell: white, with no pattern to see.
-float hash(uvec2 p) {
- uint h = p.x * 1664525u + p.y * 1013904223u;
- h ^= h >> 16;
- h *= 2246822519u;
- h ^= h >> 13;
- h *= 3266489917u;
- h ^= h >> 16;
- return float(h) / 4294967295.0;
-}
-
-void mainImage(out vec4 fragColor, in vec2 fragCoord) {
- vec2 uv = fragCoord / iResolution.xy;
- vec4 frame = texture(iChannel0, uv);
- fragColor = frame;
- vec3 page = iBackgroundColor.rgb;
- if (any(greaterThan(abs(frame.rgb - page), vec3(0.75 / 255.0))) || pardesSpared(fragCoord)) return;
- uvec2 cell = uvec2(fragCoord / max(1.0, pardesScale));
- // Two hashes summed: a triangular spread, softer than a flat one.
- float n = hash(cell) + hash(cell + uvec2(7919u, 104729u)) - 1.0;
- fragColor = vec4(clamp(page + n * amplitude(), 0.0, 1.0), frame.a);
-}