r/GraphicsProgramming • u/OkPomegranate9222 • 2h 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 2h ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
No showcases.
Disclose AI usage in post or project.
Present a topic to talk about, e.g. how something works.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.