diff options
Diffstat (limited to 'shaders/post')
| -rw-r--r-- | shaders/post/crt.glsl | 6 | ||||
| -rw-r--r-- | shaders/post/prefix.glsl | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/shaders/post/crt.glsl b/shaders/post/crt.glsl index 768157ef..970d61ee 100644 --- a/shaders/post/crt.glsl +++ b/shaders/post/crt.glsl @@ -69,9 +69,11 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) { // A beam is brightest on its line and falls off between lines; the // mask is three phosphor stripes a triad. Both average to one, so the // theme keeps its brightness. - float line = 0.5 + 0.5 * cos(fragCoord.y * TAU / SCAN_PERIOD_PX); + // Periods in logical pixels: the same look at any density. + float density = max(1.0, pardesScale); + float line = 0.5 + 0.5 * cos(fragCoord.y * TAU / (SCAN_PERIOD_PX * density)); col *= 1.0 - scanStrength() * (line * line - 0.375) / 0.625; - col *= 1.0 + maskStrength() * cos(fragCoord.x * TAU / MASK_PERIOD_PX + vec3(0.0, TAU / 3.0, 2.0 * TAU / 3.0)); + col *= 1.0 + maskStrength() * cos(fragCoord.x * TAU / (MASK_PERIOD_PX * density) + vec3(0.0, TAU / 3.0, 2.0 * TAU / 3.0)); float vignette = 1.0 - vignetteStrength() * pow(clamp(r2 * 0.5, 0.0, 1.0), 1.6); float hum = 1.0 + humStrength() * sin((uv.y * 1.35 - iTime * HUM_HZ) * TAU); diff --git a/shaders/post/prefix.glsl b/shaders/post/prefix.glsl index e718a98f..7a50936e 100644 --- a/shaders/post/prefix.glsl +++ b/shaders/post/prefix.glsl @@ -41,10 +41,14 @@ layout(set = 3, binding = 0, std140) uniform Globals { // pardes's own: pardesOpaque is 1 when the window is opaque, so a pass // cannot punch holes in it through its alpha; pardesLevel is a bundled -// pass's strength, 1 to 3 (`Crt 3`), and 0 for a user's file. +// pass's strength, 1 to 3 (`Crt 3`), and 0 for a user's file; pardesScale +// is the display's density (2 on a 2x screen), for a pass whose pattern is +// in logical pixels. iResolution, fragCoord and iMouse stay in the display's +// pixels, as ghostty's do. layout(set = 3, binding = 1, std140) uniform PardesPost { float pardesOpaque; float pardesLevel; + float pardesScale; }; // A bundled pass's constant at levels 1, 2 and 3. |
