r/GraphicsProgramming • u/OkPomegranate9222 • 18h ago
Source Code Reverse-engineering macOS Liquid Glass into an independent Linux EGL/GLSL offscreen renderer (SDF unions, mip blur, and retargetable springs)
I have been working through the graphics pipeline of an open-source Linux EGL/GLSL 4.5 offscreen renderer (liquid-glass-renderer) that reconstructs macOS-style refractive glass effects, and wanted to open a technical discussion on how the passes are structured and where driver differences show up.
How the pipeline works:
- SDF generation & smooth unions: Shapes are evaluated either from analytic rounded-rect/superellipse parameters or input rasters into a distance + normal field, then combined via GPU smooth-union passes (smin) so adjacent shapes blend cleanly without CPU geometry tessellation.
- Blur mip pyramid (agx2): Before refraction, the backdrop is downsampled through a multi-pass blur pyramid so thick or high-diffusion surfaces sample lower mip levels instead of running an expensive per-pixel wide kernel.
- Refraction & chromatic aberration: The SDF gradient (surface normal) offsets backdrop UVs along the bevel, with separate per-channel dispersion offsets for RGB chromatic aberration.
- Edge highlights, edge color bleed & shadows: Separate material passes evaluate bevel specular highlights and edge bleed using the SDF distance band, then composite over either the original backdrop or the accumulated buffer depending on the glass group order.
- Partial backdrop updates: In the Rust core (LiveScene), dirty pixel rects trigger localized re-evaluation, though refractive UV offsets near patch boundaries still require expanding the damaged region so refracted neighbors stay consistent.
Topics I would love to discuss with graphics folks here:
- For multi-level backdrop blur behind refractive UI elements, how do you balance mip-pyramid artifacts/ringing against frame-time budgets on mobile/integrated GPUs (e.g. Mesa Intel / llvmpipe)?
- Have you run into precision or NaN/overflow edge cases in GLSL smooth-union SDFs when shapes overlap deeply?
- Any tips on minimizing texture/FBO churn when host apps update only small regions of a live desktop backdrop?
Source code for reference if anyone wants to inspect the GLSL shaders: https://github.com/SaMaili/liquid-glass-renderer
AI disclosure: AI assistance was used to help draft and format this Reddit post.
•
u/AutoModerator 18h ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/SnappySausage 15h ago
Looks cool. Wouldn't mind seeing some more projects centered on UI/UX on linux. Always feels that's where it has lagged a bit, even though you can set up things as you want if you put in enough time and effort.
1
u/CodyDuncan1260 6h ago
Definine "ringing"? And why are artifacts and frame times in contention?
AI can be useful for helping with drafts, but certain models, especially Claude Opus, are optimized for information density. That's not strictly a bad thing, but it makes reading extremely difficult.
If I'm going into reading a published paper, I'm going to expect a ton of information density, especially in jargon terms. I am prepared to parse that slowly, read through references, build up notes, just to understand the first few opening paragraphs.
Certain models made for task solving are trained on such papers and technical documents. Let's them go further with fewer tokens, which users see as a win. But, it writes like this, and makes it really quite heavy to parse.
Finally, it doesn't help when a model decides to use an odd synonym. I saw one post talking about performance use "price" when they meant "measure" in terms of comparing benchmark results. "ringing" makes me wonder if it's the same type of artifact.
My request to OP: rewrite for humans who aren't planning to spend the next hour brushing up their 2D shape rendering terms. I'm certain this is fine for the parts of us that handle that day to day, but for the rest of us it'd be a kindness to express the idea more simply and expansively. Write as you understand it, not the AI assistant, and I'm certain I and more of the rest of us could understand it better.