PitchHut logo
CRTty
Enhance your kitty terminal with custom shaders effortlessly.
Pitch

CRTty offers a seamless way to inject post-processing shaders into the kitty terminal without modifications or special drivers. Enjoy built-in effects such as CRT and greyscale, alongside the flexibility of custom shaders with live hot-reload functionality. Experience enhanced visuals in your terminal with ease.

Description

CRTty is an innovative post-processing shader framework designed specifically for the kitty terminal, utilizing the LD_PRELOAD technique. This project enables users to seamlessly inject custom fragment shaders into kitty or any EGL/GLX application without needing to modify the application code or use specialized drivers.

Features

  • Built-in Effects: Comes equipped with various effects such as crt, greyscale, and invert to enhance visual output.
  • Live Hot-Reloading: Custom .glsl shaders can be added or modified on-the-fly, allowing real-time updates without restarting kitty.
  • Auto Uniforms for Animation: Automatically provides uniforms like u_time and u_resolution for dynamic visual effects.
  • No App Patching Required: Functions solely through LD_PRELOAD, making it easy to deploy.

Usage Examples

Launch the kitty terminal with the CRT effect:

crtty

List all available effects:

crtty --list

Use a predefined effect or a custom shader:

crtty -s greyscale
crtty -s ./my_shader.glsl
crtty -s examples/retro.glsl

Custom GLSL shaders are straightforward to create. For instance, an animated RGB wave effect can be implemented as follows:

#version 330 core
in vec2 v_uv;
out vec4 o_color;
uniform sampler2D u_input;
uniform float u_time;
uniform vec2 u_resolution;

void main() {
    float wave = sin(v_uv.y * 40.0 + u_time * 3.0) * 0.003;
    vec3 c;
    c.r = texture(u_input, v_uv + vec2(wave, 0.0)).r;
    c.g = texture(u_input, v_uv).g;
    c.b = texture(u_input, v_uv - vec2(wave, 0.0)).b;
    float scan = 0.95 + 0.05 * sin(v_uv.y * u_resolution.y * 3.14 + u_time * 2.0);
    o_color = vec4(c * scan, 1.0);
}

Write Your Own Shader

To create a custom effect, you can develop a new Rust library crate:

cargo new --lib my-shader && cd my-shader

In Cargo.toml, specify the crtty dependency and implement your effect according to the provided Effect trait.

Effect Configuration

Users can configure various CRT effect parameters by editing the ~/.config/crtty.conf file:

enabled=1
scanline_intensity=0.75
phosphor_strength=1.1
curvature=0.04
vignette=0.35
aberration=0.003

Parameters Explained

ParameterRangeDescription
enabled0/1Master switch
scanline_intensity0.0–1.0Controls the darkness of horizontal raster lines
phosphor_strength0.0–3.0Adjusts the bloom intensity
curvature0.0–0.5Determines the barrel distortion
vignette0.0–2.0Manages corner darkening
aberration0.0–0.05Sets the RGB channel offset

With CRTty, enhancing the aesthetic quality of your terminal experience is both flexible and convenient.

0 comments

No comments yet.

Sign in to be the first to comment.