Skip to content

Lniri-v.0.1.3

Choose a tag to compare

@Chintanpatel24 Chintanpatel24 released this 05 Sep 12:50
· 53 commits to main since this release
9f278b0

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.frag computed uvScale = 1.0 / (halfSize * 2.0) (1.0 / geo_size). For thin layer surfaces (e.g. 1920x36), uvScale.y caused 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_geo transformation 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$) using refract() 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 maxShiftPx to max(minHalfSize * 0.45, 24.0 * niri_scale) so thin bars can exhibit prominent refraction.

3. Layer Surface Client Clipping

  • Added ClippedSurfaceRenderElement<R> to MappedLayer in src/layer/mapped.rs. Layer surface client buffers are now clipped to geometry-corner-radius, preventing rectangular corners from bleeding over the curved glass bevel.
  • Enabled clip_to_geometry: true in background_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-glass or blur is explicitly configured in layer-rule.

5. Config Presets & Cleanup

  • Removed duplicate lg_physical_refraction uniforms in xray.rs and framebuffer_effect.rs.
  • Updated install.sh to copy src/layer/mapped.rs.
  • Added layer-rule configuration examples to config.kdl and template.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