Lniri-v.0.1.3
Summary
This PR enables the liquid-glass effect on layer-rule surfaces (such as mistbar, waybar, docks, and launchers) and upgrades the shader optics to look significantly more fluid, organic, and realistic.
1. Fix UV Scaling & Aspect-Ratio Distortion on Layer Surfaces
- Previously,
clipped_surface.fragcomputeduvScale = 1.0 / (halfSize * 2.0)(1.0 / geo_size). For thin layer surfaces (e.g.1920x36),uvScale.ycaused a ~30× (3000%) vertical stretch distortion, overshooting screen UV bounds and clamping to edge/black pixels. - Fix: Derived exact isotropic pixel density from the
input_to_geotransformation matrix (texPixels = max(vec2(length(dU) * winSize.x, length(dV) * winSize.y), vec2(1.0)); uvScale = 1.0 / texPixels;). This guarantees true 1:1 physical pixel refraction in both X and Y across any surface aspect ratio.
2. Organic Fluid Optics & Snell Cauchy Dispersion
-
Genuine 3-Channel Snell Dispersion: Computed separate refracted ray vectors for Red, Green, and Blue wavelengths (
$IOR_R, IOR_G, IOR_B$ ) usingrefract()following Cauchy dispersion, splitting spectrum colors realistically across steep liquid curvatures. -
Fluid Meniscus & Cohesive Body Surface Tension: Added organic meniscus curvature combined with gentle interior fluid dome displacement (
fluidBody), making the glass look like cohesive liquid water rather than a rigid flat sheet. -
Liquid Fresnel Grazing-Angle Sheen: Added grazing-angle Fresnel reflectance along the meniscus curve in
glassOutline, producing an organic wet sheen without painted white borders. -
Layer Surface Displacement Clamping: Raised
maxShiftPxtomax(minHalfSize * 0.45, 24.0 * niri_scale)so thin bars can exhibit prominent refraction.
3. Layer Surface Client Clipping
- Added
ClippedSurfaceRenderElement<R>toMappedLayerinsrc/layer/mapped.rs. Layer surface client buffers are now clipped togeometry-corner-radius, preventing rectangular corners from bleeding over the curved glass bevel. - Enabled
clip_to_geometry: trueinbackground_effect::render_for_tile.
4. Empty Client Blur Region Fix
- When a layer client (e.g., Qt/AGS bar) registers an empty blur protocol region, Lniri no longer aborts the effect if
liquid-glassorbluris explicitly configured inlayer-rule.
5. Config Presets & Cleanup
- Removed duplicate
lg_physical_refractionuniforms inxray.rsandframebuffer_effect.rs. - Updated
install.shto copysrc/layer/mapped.rs. - Added
layer-ruleconfiguration examples toconfig.kdlandtemplate.md.
Verification
- Verified with
cargo check --bin niri(passed with 0 warnings/errors). - Compiled release binary via
cargo build --release --bin niri(passed). - Verified binary runtime with
lniri --version.
What's Changed
- feat: add layer-rule support for liquid-glass and enhance organic fluid optics by @Chintanpatel24 in #6
Full Changelog: 0.1.2...0.1.3