u/Informal_Leading_943

▲ 50 r/shaders+2 crossposts

Hey Everyone,

Ever tried adding a grayscale filter, wave distortion, or chromatic aberration to your Compose Multiplatform app and thought "surely this is one line of code"? Yeah, me too. Spoiler: it wasn't. So I built ShaderX to make it one line of code🎨

What started as "let me add a blur effect" quickly spiraled into a rabbit hole of RuntimeShader on Android, RuntimeEffect on Skia, expect/actual hell, animation loops, shader caching, and the existential question of "why are there 30 files for 10 effects?"

After much suffering (and a surprising amount of fun), ShaderX now ships with:
✨ One-line API — Modifier.shaderEffect(GrayscaleEffect()) works on Android, iOS, Desktop, and Wasm
✨ Operator chaining — GrayscaleEffect() + VignetteEffect() + NativeBlurEffect() because why not
✨ Animated effects — rememberShaderEffect() handles the frame loop so you don't have to
✨ Type-safe parameters — auto-generates UI controls (percentages, pixels, colors, toggles)
✨ Native acceleration — routes blur to platform-optimized APIs instead of compiling shader code
✨ LRU shader cache — because compiling shaders every frame is a crime
✨ Built-in gallery — Grayscale, Sepia, Invert, Vignette, Pixelate, ChromaticAberration, Wave, NativeBlur, and more .

The hardest part wasn't writing shaders — it was making the same SkSL/AGSL source work across platforms with completely different uniform APIs without drowning in boilerplate. Wrote a full breakdown of how I got there (with code samples for building shaders from scratch) in the blog

Medium: https://medium.com/gitconnected/building-gpu-shader-effects-for-compose-multiplatform-from-scratch-to-shaderx-326659c4f47b

Github: https://github.com/Debanshu777/ShaderX

u/Informal_Leading_943 — 14 days ago