Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(desktop-gpui): fit glass to Apple with a cubic colour transform and its edge hairline
Richie McIlroy16afb47d0721
diff --git a/apps/desktop-gpui/glass/presets.json b/apps/desktop-gpui/glass/presets.jsonindex 71c9adcb2..40789a0ce 100644--- a/apps/desktop-gpui/glass/presets.json+++ b/apps/desktop-gpui/glass/presets.json@@ -1,82 +1,130 @@{- "regular-light": {- "blur_k": 0.19,- "blur_max": 21,- "rim_k": 0.24,- "rim_max": 24,- "bend": -2,- "lens_curve": 0.4,+ "clear-dark": {+ "bend": -2.366746425628662,+ "blur_k": 0.17999997735023499,+ "blur_max": 20.0,+ "glow": -0.00915201473981142,+ "glow_width": 0.5,+ "hairline": [+ 0.5046544075012207, -0.002066596643999219, 1.037916898727417,+ -0.004036169033497572+ ],+ "lens_curve": 0.3376707434654236,+ "light_angle": 10.696141242980957,+ "line": 0.009427699260413647,+ "line_lit": -0.00020453354227356613,+ "line_width": 0.9371033906936646,+ "opacity": 0.6000000238418579,"poly": [- 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0,- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0+ 0.9841277003288269, -0.28581157326698303, 0.06853790581226349,+ -0.10551261156797409, -0.019449958577752113, -0.06275196373462677,+ 0.12861721217632294, 0.0336744524538517, -0.02680288627743721, 0.0, 0.0,+ 0.0, 0.09590495377779007, -0.025067875161767006, 0.7507156133651733,+ -0.008180275559425354, -0.03581831976771355, -0.010394089855253696,+ -0.01718660071492195, 0.04081161320209503, 0.02539644204080105,+ -0.005516655743122101, 0.0, 0.0, 0.0, 0.09734207391738892,+ -0.07906761765480042, -0.22363290190696716, 1.016892433166504,+ -0.00731066195294261, -0.06583347171545029, -0.11654830724000931,+ 0.04832758754491806, 0.12703412771224976, 0.01597178541123867, 0.0, 0.0,+ 0.0, 0.09707652777433395],- "opacity": 0.6,- "line": 0,- "line_lit": 0,- "line_width": 1,- "light_angle": -2.3,- "glow": 0,- "glow_width": 4,- "hairline": [0.86, -0.12, 0.92, -0.08]+ "rim_k": 0.3009837865829468,+ "rim_max": 26.59674072265625},- "regular-dark": {- "blur_k": 0.19,- "blur_max": 21,- "rim_k": 0.24,- "rim_max": 24,- "bend": -2,- "lens_curve": 0.4,+ "clear-light": {+ "bend": -2.364307403564453,+ "blur_k": 0.17999984323978424,+ "blur_max": 20.0,+ "glow": -0.040041275322437286,+ "glow_width": 0.5,+ "hairline": [+ 0.6467424035072327, -0.017890620976686478, 1.0234696865081787,+ 0.008217902854084969+ ],+ "lens_curve": 0.33955836296081543,+ "light_angle": 8.900734901428223,+ "line": 0.013842251151800156,+ "line_lit": 0.00113571563269943,+ "line_width": 1.1170105934143066,+ "opacity": 0.6000000238418579,"poly": [- 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0,- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0+ 0.8068393468856812, -0.19063682854175568, 0.12205540388822556,+ 0.03810872882604599, 0.05950373411178589, -0.08793330937623978,+ -0.04968729987740517, 0.011197183281183243, -0.03260619565844536, 0.0,+ 0.0, 0.0, 0.27716732025146484, -0.009006494656205177, 0.6790370345115662,+ 0.013659832999110222, -0.02463696524500847, 0.033544085919857025,+ -0.016603535041213036, 0.00851691234856844, 0.0007132220198400319,+ -0.0068999179638922215, 0.0, 0.0, 0.0, 0.278425395488739,+ 0.05969604477286339, -0.09342411160469055, 0.722533643245697,+ -0.04663229361176491, -0.05806506425142288, 0.033827684819698334,+ -0.052240658551454544, 0.10449537634849548, 0.007342542987316847, 0.0,+ 0.0, 0.0, 0.2787947356700897],- "opacity": 0.6,- "line": 0,- "line_lit": 0,- "line_width": 1,- "light_angle": -2.3,- "glow": 0,- "glow_width": 4,- "hairline": [0.86, -0.12, 0.92, -0.08]+ "rim_k": 0.2935454249382019,+ "rim_max": 27.180828094482422},- "clear-light": {- "blur_k": 0.19,- "blur_max": 21,- "rim_k": 0.24,- "rim_max": 24,- "bend": -2,- "lens_curve": 0.4,+ "regular-dark": {+ "bend": -1.0383737087249756,+ "blur_k": 0.1399989128112793,+ "blur_max": 12.0,+ "glow": 0.023018531501293182,+ "glow_width": 47.50996780395508,+ "hairline": [+ 0.265051931142807, 0.09913472086191177, 0.5498596429824829,+ 0.042205967009067535+ ],+ "lens_curve": 0.6115574836730957,+ "light_angle": 3.5436832904815674,+ "line": 0.013988529331982136,+ "line_lit": -5.383496682043187e-5,+ "line_width": 0.516719400882721,+ "opacity": 0.6000000238418579,"poly": [- 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0,- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0+ 1.1429176330566406, -0.10875950753688812, 0.033222246915102005,+ -0.08781613409519196, -0.13997182250022888, -0.032387249171733856,+ -0.3350599706172943, 0.02284449338912964, -0.0969463512301445, 0.0, 0.0,+ 0.0, 0.06109626591205597, -0.14081989228725433, 1.3113867044448853,+ -0.13325585424900055, 0.012389129027724266, -0.6814408302307129,+ 0.0769672617316246, 0.005131110083311796, -0.11113206297159195,+ 0.055657077580690384, 0.0, 0.0, 0.0, 0.06288916617631912,+ -0.14669793844223022, -0.0684649795293808, 1.239702582359314,+ 0.011958428658545017, -0.1758630871772766, -0.09301606565713882,+ 0.12923042476177216, -0.4333122670650482, -0.0655086413025856, 0.0, 0.0,+ 0.0, 0.06273098289966583],- "opacity": 0.6,- "line": 0,- "line_lit": 0,- "line_width": 1,- "light_angle": -2.3,- "glow": 0,- "glow_width": 4,- "hairline": [0.86, -0.12, 0.92, -0.08]+ "rim_k": 0.0955091044306755,+ "rim_max": 43.95122528076172},- "clear-dark": {- "blur_k": 0.19,- "blur_max": 21,- "rim_k": 0.24,- "rim_max": 24,- "bend": -2,- "lens_curve": 0.4,+ "regular-light": {+ "bend": -1.6921217441558838,+ "blur_k": 0.14000000059604645,+ "blur_max": 12.0,+ "glow": -0.06775760650634766,+ "glow_width": 0.5,+ "hairline": [+ 0.6670563817024231, 0.017260314896702766, 0.7883668541908264,+ 0.007549159694463015+ ],+ "lens_curve": 0.576151967048645,+ "light_angle": 2.86551833152771,+ "line": 0.012727930210530758,+ "line_lit": 0.0012256903573870659,+ "line_width": 1.5420403480529785,+ "opacity": 0.6000000238418579,"poly": [- 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0,- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0+ 0.7772780656814575, -0.45734652876853943, 0.2029036283493042,+ -0.1445373296737671, 0.028123168274760246, -0.15287674963474274,+ 0.20918069779872894, 0.03389207646250725, -0.0789894387125969, 0.0, 0.0,+ 0.0, 0.5196360945701599, -0.05892333388328552, 0.5539849996566772,+ -0.04516340047121048, -0.038535263389348984, -0.03162488341331482,+ 0.007563223596662283, 0.03239148110151291, -0.00026807302492670715,+ 0.0019051238195970654, 0.0, 0.0, 0.0, 0.5209547877311707,+ 0.16917257010936737, -0.3096109628677368, 0.619947612285614,+ -0.12055128067731857, -0.14295552670955658, -0.1775696575641632,+ -0.13636651635169983, 0.48980438709259033, 0.027854571118950844, 0.0, 0.0,+ 0.0, 0.5214924812316895],- "opacity": 0.6,- "line": 0,- "line_lit": 0,- "line_width": 1,- "light_angle": -2.3,- "glow": 0,- "glow_width": 4,- "hairline": [0.86, -0.12, 0.92, -0.08]+ "rim_k": 0.21131862699985504,+ "rim_max": 16.063199996948242}}diff --git a/apps/desktop-gpui/glass/src/model.rs b/apps/desktop-gpui/glass/src/model.rsindex 9f1f7fabc..32d9ec138 100644--- a/apps/desktop-gpui/glass/src/model.rs+++ b/apps/desktop-gpui/glass/src/model.rs@@ -1,12 +1,28 @@use crate::{Rgba, Shape};/// Terms of the colour transform, per output channel:-/// `r, g, b, r², g², b², rg, gb, rb, 1` of the blurred backdrop (0-1 sRGB).-pub const POLY_TERMS: usize = 10;+/// `r, g, b, r², g², b², rg, gb, rb, r³, g³, b³, 1` of the blurred backdrop+/// (0-1 sRGB). The cubes let it follow Apple's tone curve along the grey+/// axis, which a quadratic misses by several levels at mid grey.+pub const POLY_TERMS: usize = 13;pub fn poly_features(c: [f32; 3]) -> [f32; POLY_TERMS] {let [r, g, b] = c;- [r, g, b, r * r, g * g, b * b, r * g, g * b, r * b, 1.]+ [+ r,+ g,+ b,+ r * r,+ g * g,+ b * b,+ r * g,+ g * b,+ r * b,+ r * r * r,+ g * g * g,+ b * b * b,+ 1.,+ ]}/// A glass material, fitted against Apple's glass. Blur and lensing scale@@ -62,7 +78,7 @@ mod serde_poly {let values = Vec::<f32>::deserialize(d)?;values.try_into()- .map_err(|_| serde::de::Error::custom("poly needs 30 coefficients"))+ .map_err(|_| serde::de::Error::custom("poly needs 39 coefficients"))}}diff --git a/apps/desktop-gpui/glass/tests/presets.rs b/apps/desktop-gpui/glass/tests/presets.rsnew file mode 100644index 000000000..ac2e1d93e--- /dev/null+++ b/apps/desktop-gpui/glass/tests/presets.rs@@ -0,0 +1,114 @@+use cap_glass::{+ PRESETS_JSON, Rgba, Shape,+ model::{self, GlassMaterial},+ scenes,+};++fn presets() -> serde_json::Value {+ serde_json::from_str(PRESETS_JSON).unwrap()+}++fn material(name: &str) -> GlassMaterial {+ serde_json::from_value(presets()[name].clone()).unwrap()+}++fn centre_over(material: &GlassMaterial, gray: f32) -> f32 {+ let backdrop = Rgba::solid(960, 600, [gray, gray, gray, 255.]);+ let shape = scenes::SHAPES[1];+ let out = model::render(material, &[shape], &backdrop);+ out.get(+ (shape.x + shape.width / 2.) as usize,+ (shape.y + shape.height / 2.) as usize,+ )[0]+}++/// What Apple's glass turns a flat black, mid-grey and white backdrop into,+/// read off the reference captures (macOS 27, Apple M4 Max).+#[test]+fn presets_match_apple_over_flat_backdrops() {+ for (name, black, gray, white) in [+ ("regular-light", 133., 188., 240.),+ ("regular-dark", 20., 110., 114.),+ ("clear-light", 71., 158., 244.),+ ("clear-dark", 25., 116., 207.),+ ] {+ let material = material(name);+ for (backdrop, expected) in [(0., black), (128., gray), (255., white)] {+ let got = centre_over(&material, backdrop);+ eprintln!("{name} {backdrop} -> {got:.1} (apple {expected})");+ assert!(+ (got - expected).abs() <= 3.,+ "{name} over {backdrop}: {got} vs Apple's {expected}"+ );+ }+ }+}++#[test]+fn every_preset_is_complete() {+ let all = presets();+ let names: Vec<&str> = all.as_object().unwrap().keys().map(String::as_str).collect();+ assert_eq!(+ names,+ ["clear-dark", "clear-light", "regular-dark", "regular-light"]+ );+ for name in names {+ let material = material(name);+ let style = material.resolve(420., 240.);+ assert!(style.blur > 0. && style.lens_rim > 0., "{name}");+ }+}++#[test]+fn blur_and_lensing_scale_with_the_shorter_side_up_to_their_caps() {+ let material = material("clear-light");+ let small = material.resolve(300., 48.);+ let large = material.resolve(900., 600.);+ assert!((small.blur - material.blur_k * 48.).abs() < 1e-4);+ assert_eq!(large.blur, material.blur_max);+ assert!(small.lens_rim < large.lens_rim);+ let doubled = small.scaled(2.);+ assert_eq!(doubled.blur, small.blur * 2.);+ assert_eq!(doubled.lens_rim, small.lens_rim * 2.);+ assert_eq!(doubled.rim_bend, small.rim_bend * 2.);+}++#[test]+fn the_rounded_rect_distance_field_is_signed_and_clamps_its_radius() {+ let shape = Shape {+ x: 0.,+ y: 0.,+ width: 100.,+ height: 40.,+ radius: 80.,+ };+ assert!((shape.sdf(50., 20.) + 20.).abs() < 1e-4);+ assert!((shape.sdf(50., -5.) - 5.).abs() < 1e-4);+ assert!((shape.sdf(0., 20.)).abs() < 1e-4);+ assert!(shape.sdf(1., 1.) > 0., "a corner beyond the clamped radius is outside");+ let (nx, ny) = shape.normal(50., 1.);+ assert!(nx.abs() < 1e-3 && (ny + 1.).abs() < 1e-3);+}++#[test]+fn scenes_render_deterministically_at_any_scale() {+ for name in scenes::NAMES {+ let one = scenes::render(name, 1.).unwrap();+ assert_eq!((one.width, one.height), (960, 600));+ let two = scenes::render(name, 2.).unwrap();+ assert_eq!((two.width, two.height), (1920, 1200));+ assert_eq!(one.pixels, scenes::render(name, 1.).unwrap().pixels);+ }+ assert!(scenes::render("nope", 1.).is_none());+}++#[test]+fn glass_leaves_pixels_beyond_its_hairline_alone() {+ let material = material("regular-light");+ let backdrop = scenes::render("checker", 1.).unwrap();+ let shape = scenes::SHAPES[1];+ let out = model::render(&material, &[shape], &backdrop);+ for (x, y) in [(455usize, 180usize), (885, 180), (670, 55), (670, 305)] {+ assert_eq!(out.get(x, y), backdrop.get(x, y), "({x}, {y})");+ }+}diff --git a/apps/desktop-gpui/patches/zed-glass.patch b/apps/desktop-gpui/patches/zed-glass.patchindex a42b32020..959e646d6 100644--- a/apps/desktop-gpui/patches/zed-glass.patch+++ b/apps/desktop-gpui/patches/zed-glass.patch@@ -1,5 +1,5 @@diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs-index 6cc3562..6ea0576 100644+index 6cc3562..c49648d 100644--- a/crates/gpui/src/scene.rs+++ b/crates/gpui/src/scene.rs@@ -52,7 +52,7 @@ pub struct Scene {@@ -22,7 +22,7 @@ index 6cc3562..6ea0576 100644#[derive(Debug, Copy, Clone)]#[repr(C)]#[expect(missing_docs)]-@@ -624,6 +624,53 @@ pub struct BackdropBlur {+@@ -624,6 +624,78 @@ pub struct BackdropBlur {pub bounds: Bounds<ScaledPixels>,pub content_mask: ContentMask<ScaledPixels>,pub corner_radii: Corners<ScaledPixels>,@@ -35,16 +35,16 @@ index 6cc3562..6ea0576 100644+///+/// Per pixel: the blurred backdrop is sampled along the edge normal by+/// `rim_bend` within the `lens_rim`-wide rim (falling off with-+/// `lens_curve`) and transformed by a second-order polynomial: each output-+/// channel `c` is `poly[c * 10..]` dotted with `r, g, b, r², g², b², rg, gb,-+/// rb, 1`. An edge line then scales the colour by `1 + line + line_lit`++/// `lens_curve`) and transformed by a cubic polynomial: each output channel++/// `c` is `poly[c * 13..]` dotted with `r, g, b, r², g², b², rg, gb, rb, r³,++/// g³, b³, 1`. An edge line then scales the colour by `1 + line + line_lit`+/// times how much the edge faces `light_x`/`light_y` (decaying over+/// `line_width`), and an inner glow adds `glow` (decaying over+/// `glow_width`). Over a transparent backdrop the glass is `opacity` opaque.+/// The pixel ring just outside the edge gets a hairline,+/// `clamp(min(under, a * under + b), 0, 1)`, with `a` and `b` blended from+/// `hairline[0..2]` on vertical edges to `hairline[2..4]` on horizontal ones.-+#[derive(Debug, Default, Copy, Clone, PartialEq)]++#[derive(Debug, Copy, Clone, PartialEq)]+#[repr(C)]+#[expect(missing_docs)]+pub struct GlassStyle {@@ -52,7 +52,7 @@ index 6cc3562..6ea0576 100644+ pub lens_rim: f32,+ pub lens_curve: f32,+ pub rim_bend: f32,-+ pub poly: [f32; 30],++ pub poly: [f32; 39],+ pub opacity: f32,+ pub line: f32,+ pub line_lit: f32,@@ -62,6 +62,31 @@ index 6cc3562..6ea0576 100644+ pub glow: f32,+ pub glow_width: f32,+ pub hairline: [f32; 4],++ /// Keeps the struct a multiple of 8 bytes, which WGSL's storage layout++ /// requires of `BackdropBlur`.++ pub pad: f32,++}++++impl Default for GlassStyle {++ fn default() -> Self {++ Self {++ enabled: 0,++ lens_rim: 0.,++ lens_curve: 0.,++ rim_bend: 0.,++ poly: [0.; 39],++ opacity: 0.,++ line: 0.,++ line_lit: 0.,++ line_width: 0.,++ light_x: 0.,++ light_y: 0.,++ glow: 0.,++ glow_width: 0.,++ hairline: [0.; 4],++ pad: 0.,++ }++ }+}++impl GlassStyle {@@ -148,7 +173,7 @@ index 70e9a0b..79415df 100644"Underline".into(),"UnderlineInputIndex".into(),diff --git a/crates/gpui_macos/src/metal_renderer.rs b/crates/gpui_macos/src/metal_renderer.rs-index 4be15aa..f4c608d 100644+index 4be15aa..56248f3 100644--- a/crates/gpui_macos/src/metal_renderer.rs+++ b/crates/gpui_macos/src/metal_renderer.rs@@ -979,7 +979,7 @@ impl MetalRenderer {@@ -213,7 +238,7 @@ index 4be15aa..f4c608d 100644});scene.pop_layer();}-@@ -2741,6 +2750,197 @@ mod backdrop_blur_tests {+@@ -2741,6 +2750,215 @@ mod backdrop_blur_tests {);}@@ -228,10 +253,16 @@ index 4be15aa..f4c608d 100644+ }++ fn test_glass() -> GlassStyle {-+ let mut poly = [0.; 30];-+ poly[..10].copy_from_slice(&[0.6, 0.15, 0.05, -0.2, 0.1, 0.0, 0.05, 0.0, 0.02, 0.22]);-+ poly[10..20].copy_from_slice(&[0.05, 0.5, 0.1, 0.0, -0.15, 0.05, 0.0, 0.04, 0.0, 0.2]);-+ poly[20..].copy_from_slice(&[0.12, 0.05, 0.55, 0.0, 0.0, -0.1, 0.02, 0.0, 0.03, 0.18]);++ let mut poly = [0.; 39];++ poly[..13].copy_from_slice(&[++ 0.6, 0.15, 0.05, -0.2, 0.1, 0.0, 0.05, 0.0, 0.02, 0.1, 0.0, -0.02, 0.22,++ ]);++ poly[13..26].copy_from_slice(&[++ 0.05, 0.5, 0.1, 0.0, -0.15, 0.05, 0.0, 0.04, 0.0, 0.0, 0.08, 0.0, 0.2,++ ]);++ poly[26..].copy_from_slice(&[++ 0.12, 0.05, 0.55, 0.0, 0.0, -0.1, 0.02, 0.0, 0.03, -0.03, 0.0, 0.06, 0.18,++ ]);+ GlassStyle {+ enabled: 1,+ lens_rim: 28.,@@ -247,6 +278,7 @@ index 4be15aa..f4c608d 100644+ glow: 0.04,+ glow_width: 6.,+ hairline: [0.86, -0.12, 0.92, -0.08],++ pad: 0.,+ }+ }+@@ -384,14 +416,25 @@ index 4be15aa..f4c608d 100644+ let s = sample(px + nx * glass.rim_bend * rim, py + ny * glass.rim_bend * rim);+ let c = [s[0] / 255., s[1] / 255., s[2] / 255.];+ let features = [-+ c[0], c[1], c[2], c[0] * c[0], c[1] * c[1], c[2] * c[2], c[0] * c[1],-+ c[1] * c[2], c[0] * c[2], 1.,++ c[0],++ c[1],++ c[2],++ c[0] * c[0],++ c[1] * c[1],++ c[2] * c[2],++ c[0] * c[1],++ c[1] * c[2],++ c[0] * c[2],++ c[0] * c[0] * c[0],++ c[1] * c[1] * c[1],++ c[2] * c[2] * c[2],++ 1.,+ ];+ let facing = nx * glass.light_x + ny * glass.light_y;+ let line = (-edge / glass.line_width).exp() * (glass.line + glass.line_lit * facing);+ let glow = (-edge / glass.glow_width).exp() * glass.glow;+ std::array::from_fn(|i| {-+ let value: f32 = (0..10).map(|t| glass.poly[i * 10 + t] * features[t]).sum();++ let value: f32 = (0..13).map(|t| glass.poly[i * 13 + t] * features[t]).sum();+ let value = (value * (1. + line) + glow).clamp(0., 1.) * 255.;+ under[i] + (value - under[i]) * coverage+ })@@ -412,7 +455,7 @@ index 4be15aa..f4c608d 100644fn two_blurs_of_different_sizes_in_one_frame() {if metal::Device::system_default().is_none() {diff --git a/crates/gpui_macos/src/shaders.metal b/crates/gpui_macos/src/shaders.metal-index e087c0d..40c50bd 100644+index e087c0d..de1333f 100644--- a/crates/gpui_macos/src/shaders.metal+++ b/crates/gpui_macos/src/shaders.metal@@ -1354,9 +1354,17 @@ vertex BackdropBlurVertexOutput backdrop_blur_vertex(@@ -435,17 +478,18 @@ index e087c0d..40c50bd 100644blur.content_mask.bounds);return BackdropBlurVertexOutput{device_position,-@@ -1364,26 +1372,77 @@ vertex BackdropBlurVertexOutput backdrop_blur_vertex(+@@ -1364,26 +1372,78 @@ vertex BackdropBlurVertexOutput backdrop_blur_vertex({clip_distance.x, clip_distance.y, clip_distance.z, clip_distance.w}};}+float3 glass_shade(GlassStyle glass, float3 c, float edge, float2 normal) {-+ float features[10] = {c.r, c.g, c.b, c.r * c.r, c.g * c.g, c.b * c.b,-+ c.r * c.g, c.g * c.b, c.r * c.b, 1.};++ float features[13] = {c.r, c.g, c.b, c.r * c.r, c.g * c.g, c.b * c.b,++ c.r * c.g, c.g * c.b, c.r * c.b, c.r * c.r * c.r,++ c.g * c.g * c.g, c.b * c.b * c.b, 1.};+ float3 color = float3(0.);-+ for (int term = 0; term < 10; term++) {++ for (int term = 0; term < 13; term++) {+ color += features[term] *-+ float3(glass.poly[term], glass.poly[10 + term], glass.poly[20 + term]);++ float3(glass.poly[term], glass.poly[13 + term], glass.poly[26 + term]);+ }+ float facing = dot(normal, float2(glass.light_x, glass.light_y));+ float line = exp(-edge / glass.line_width) * (glass.line + glass.line_lit * facing);@@ -525,10 +569,10 @@ index e087c0d..40c50bd 100644+ return mix(under, float4(glass * alpha, alpha), coverage);}diff --git a/crates/gpui_wgpu/src/shaders.wgsl b/crates/gpui_wgpu/src/shaders.wgsl-index 011be71..47a16cd 100644+index 011be71..bf2175c 100644--- a/crates/gpui_wgpu/src/shaders.wgsl+++ b/crates/gpui_wgpu/src/shaders.wgsl-@@ -1399,3 +1399,194 @@ fn fs_surface(input: SurfaceVarying) -> @location(0) vec4<f32> {+@@ -1399,3 +1399,195 @@ fn fs_surface(input: SurfaceVarying) -> @location(0) vec4<f32> {return ycbcr_to_RGB * y_cb_cr;}@@ -540,7 +584,7 @@ index 011be71..47a16cd 100644+ lens_rim: f32,+ lens_curve: f32,+ rim_bend: f32,-+ poly: array<f32, 30>,++ poly: array<f32, 39>,+ opacity: f32,+ line_strength: f32,+ line_lit: f32,@@ -550,6 +594,7 @@ index 011be71..47a16cd 100644+ glow: f32,+ glow_width: f32,+ hairline: array<f32, 4>,++ pad: f32,+}++struct BackdropBlur {@@ -710,11 +755,11 @@ index 011be71..47a16cd 100644+ let alpha = mix(backdrop.a, 1.0, glass.opacity);++ let c = color;-+ let features = array<f32, 10>(c.r, c.g, c.b, c.r * c.r, c.g * c.g, c.b * c.b,-+ c.r * c.g, c.g * c.b, c.r * c.b, 1.0);++ let features = array<f32, 13>(c.r, c.g, c.b, c.r * c.r, c.g * c.g, c.b * c.b,++ c.r * c.g, c.g * c.b, c.r * c.b, c.r * c.r * c.r, c.g * c.g * c.g, c.b * c.b * c.b, 1.0);+ color = vec3<f32>(0.0);-+ for (var term = 0; term < 10; term++) {-+ color += features[term] * vec3<f32>(glass.poly[term], glass.poly[10 + term], glass.poly[20 + term]);++ for (var term = 0; term < 13; term++) {++ color += features[term] * vec3<f32>(glass.poly[term], glass.poly[13 + term], glass.poly[26 + term]);+ }+ let facing = dot(normal, vec2<f32>(glass.light_x, glass.light_y));+ let line_term = exp(-edge / glass.line_width) * (glass.line_strength + glass.line_lit * facing);@@ -1828,10 +1873,10 @@ index e4b605b..1a88981 100644}}diff --git a/crates/gpui_windows/src/shaders.hlsl b/crates/gpui_windows/src/shaders.hlsl-index 78b1ada..24bd265 100644+index 78b1ada..11465d8 100644--- a/crates/gpui_windows/src/shaders.hlsl+++ b/crates/gpui_windows/src/shaders.hlsl-@@ -1289,3 +1289,198 @@ float4 polychrome_sprite_fragment(PolychromeSpriteFragmentInput input): SV_Targe+@@ -1289,3 +1289,200 @@ float4 polychrome_sprite_fragment(PolychromeSpriteFragmentInput input): SV_Targecolor.a *= sprite.opacity * saturate(0.5 - distance) * edge_fade_alpha(input.position.xy, sprite.fade);return color;}@@ -1849,7 +1894,7 @@ index 78b1ada..24bd265 100644+ float lens_rim;+ float lens_curve;+ float rim_bend;-+ float poly[30];++ float poly[39];+ float opacity;+ float line_strength;+ float line_lit;@@ -1859,6 +1904,7 @@ index 78b1ada..24bd265 100644+ float glow;+ float glow_width;+ float hairline[4];++ float pad;+};++struct BackdropBlur {@@ -2015,13 +2061,14 @@ index 78b1ada..24bd265 100644+ float3 color = backdrop.a > 0. ? backdrop.rgb / backdrop.a : float3(0., 0., 0.);+ float alpha = lerp(backdrop.a, 1., glass.opacity);+-+ float features[10] = {color.r, color.g, color.b, color.r * color.r, color.g * color.g,++ float features[13] = {color.r, color.g, color.b, color.r * color.r, color.g * color.g,+ color.b * color.b, color.r * color.g, color.g * color.b,-+ color.r * color.b, 1.};++ color.r * color.b, color.r * color.r * color.r,++ color.g * color.g * color.g, color.b * color.b * color.b, 1.};+ color = float3(0., 0., 0.);+ [unroll]-+ for (int term = 0; term < 10; term++) {-+ color += features[term] * float3(glass.poly[term], glass.poly[10 + term], glass.poly[20 + term]);++ for (int term = 0; term < 13; term++) {++ color += features[term] * float3(glass.poly[term], glass.poly[13 + term], glass.poly[26 + term]);+ }+ float facing = dot(normal, float2(glass.light_x, glass.light_y));+ float line_term = exp(-edge / glass.line_width) * (glass.line_strength + glass.line_lit * facing);diff --git a/apps/desktop-gpui/src/ui/glass.rs b/apps/desktop-gpui/src/ui/glass.rsindex 4b37e28e1..937d65fff 100644--- a/apps/desktop-gpui/src/ui/glass.rs+++ b/apps/desktop-gpui/src/ui/glass.rs@@ -70,6 +70,7 @@ pub fn gpui_style(style: &PaneStyle) -> gpui::GlassStyle {glow: style.glow,glow_width: style.glow_width,hairline: style.hairline,+ pad: 0.,}}