~kris/dots

srice

srice/.config/picom/shaders/epic_70mm.glsl -rw-r--r-- 2.0 KiB
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#version 330

/*
   70mm Epic (1960s-1970s) — picom shader
   Clean, expansive, smooth. Lawrence of Arabia, 2001: A Space Odyssey.
   Large format Eastmancolor with Hable filmic tone curve.
*/

in vec2 texcoord;
uniform sampler2D tex;

const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);

float hash(vec2 p) {
    vec3 p3 = fract(vec3(p.xyx) * .1031);
    p3 += dot(p3, p3.yzx + 33.33);
    return fract((p3.x + p3.y) * p3.z);
}

// Hable/Uncharted 2 filmic tone curve
// Gentle toe, long shoulder — wide dynamic range feel
vec3 hablePartial(vec3 x) {
    float A = 0.22;  // Shoulder strength (gentler than default)
    float B = 0.30;  // Linear strength
    float C = 0.10;  // Linear angle
    float D = 0.20;  // Toe strength
    float E = 0.01;  // Toe numerator
    float F = 0.30;  // Toe denominator
    return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
}

float vignette(vec2 uv) {
    vec2 d = uv - 0.5;
    float dist = length(d);
    // Light vignette — large format lenses well-corrected
    return 1.0 - smoothstep(0.45, 1.2, dist) * 0.12;
}

vec4 window_shader() {
    vec2 texsize = textureSize(tex, 0);
    vec4 pixColor = texture2D(tex, texcoord / texsize, 0);
    vec3 color = pixColor.rgb;

    // Subtle warm bias (tungsten stock + 85 filter)
    mat3 colorMatrix = mat3(
        1.08,  0.03, -0.02,
       -0.02,  1.02,  0.0,
       -0.03, -0.02,  1.00
    );
    color = colorMatrix * color;

    // Hable filmic tone curve
    vec3 curr = hablePartial(color * 2.0);
    vec3 W = vec3(11.2);
    vec3 whiteScale = vec3(1.0) / hablePartial(W);
    color = curr * whiteScale;

    // Moderate saturation boost 1.15x
    float luma = dot(color, LUMA);
    color = mix(vec3(luma), color, 1.15);

    // Very fine grain — large format, minimal grain
    vec2 screenPos = gl_FragCoord.xy;
    float grain = (hash(screenPos * 0.8) - 0.5) * 0.015;
    color += grain;

    // Light vignette
    vec2 normalizedCoord = texcoord / texsize;
    color *= vignette(normalizedCoord);

    return vec4(clamp(color, 0.0, 1.0), 1.0);
}