Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(cursor): rebuild Studio Ink and Pop Coral 3D models after the new sheet
Claude09b5d20fd73e
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rsindex d9774f8bd..bcc7f1671 100644--- a/crates/compositor/src/compositor_linux.rs+++ b/crates/compositor/src/compositor_linux.rs@@ -5740,12 +5740,29 @@ mod tests {assert!(failures.is_empty(), "{failures:#?}");}- /// Star Sprout garde le trait marine de son dessin (`design/cursors/star-sprout`) : sur la- /// fleche comme sur la main, le modele est pour une bonne part marine (le plateau, le jonc du- /// trait, les rainures entre les doigts), autour de la couleur du corps, menthe ou ivoire, et- /// son etoile jaune est devant.+ /// Les thèmes cerclés gardent le trait de leur dessin (`design/cursors/<thème>`) : sur la+ /// fleche comme sur la main, le modele est pour une bonne part de la couleur du trait (le+ /// plateau, le jonc, les rainures entre les doigts), autour de la couleur du corps, et montre+ /// ce qu'il porte devant : l'etoile jaune de Star Sprout, le calque et les tirets jaunes de la+ /// fleche de Pop Coral, les tirets corail de sa main.#[test]- fn the_star_sprout_models_keep_the_navy_outline_of_their_art() {+ fn the_rimmed_models_keep_the_outline_of_their_art() {+ type Rgb = [i32; 3];+ let navy = |[r, g, b]: Rgb| b > r + 20 && r < 110 && g < 130;+ let black = |[r, g, b]: Rgb| r.max(g).max(b) < 70;+ let mint = |[r, g, b]: Rgb| g > 200 && g > r + 15 && b > 150;+ let ivory = |[r, g, b]: Rgb| r > 200 && g > 190 && b > 160 && r - b < 70;+ let coral = |[r, g, b]: Rgb| r > 200 && g < 150 && b < 140;+ let yellow = |[r, g, b]: Rgb| r > 200 && g > 150 && b < 120;+ // (thème, état, trait, corps, ornement, parts minimales du trait, du corps, de l'ornement)+ let cases: [(&str, &str, &dyn Fn(Rgb) -> bool, &dyn Fn(Rgb) -> bool, &dyn Fn(Rgb) -> bool, [f32; 3]); 6] = [+ ("studio-ink", "arrow", &black, &ivory, &|_| false, [0.3, 0.15, 0.0]),+ ("studio-ink", "pointer", &black, &ivory, &|_| false, [0.2, 0.3, 0.0]),+ ("pop-coral", "arrow", &navy, &coral, &yellow, [0.2, 0.2, 0.05]),+ ("pop-coral", "pointer", &navy, &yellow, &coral, [0.2, 0.3, 0.02]),+ ("star-sprout", "arrow", &navy, &mint, &yellow, [0.25, 0.2, 0.03]),+ ("star-sprout", "pointer", &navy, &ivory, &yellow, [0.25, 0.2, 0.03]),+ ];let Some(gpu) = gpu() else { return };let comp = Compositor::new_sized(&gpu, 1280, 720).expect("Compositor::new_sized");let (y, uv) = model_screen_planes(false);@@ -5755,34 +5772,31 @@ mod tests {let extruded = model_scene_json("null", Some(true), "default", true, 5.0);let hidden = model_scene_json("null", Some(true), "default", false, 5.0);let bare = compose_model(&comp, &blue, &hidden, &model_track("arrow", false, 0.5));- let mint = |[r, g, b]: [i32; 3]| g > 200 && g > r + 15 && b > 150;- let ivory = |[r, g, b]: [i32; 3]| r > 200 && g > 190 && b > 160 && r - b < 70;let mut failures = Vec::new();- for state in ["arrow", "pointer"] {+ for (theme, state, rim, body, extra, [min_rim, min_body, min_extra]) in cases {let still = model_track(state, false, 0.5);let json = extruded- .replace(&format!(r#"/{state}.png","#), &format!(r#"/{state}.png","sculpt":"star-sprout/{state}","#));+ .replace(&format!(r#"/{state}.png","#), &format!(r#"/{state}.png","sculpt":"{theme}/{state}","#));let (hover, hover_b) = (compose_model(&comp, &blue, &json, &still), compose_model(&comp, &orange, &json, &still));let mask = model_opaque(&hover, &hover_b, &bare);- let (mut total, mut navy, mut body, mut yellow) = (0usize, 0usize, 0usize, 0usize);+ let (mut total, mut counts) = (0usize, [0usize; 3]);for (i, _) in mask.iter().enumerate().filter(|(_, m)| **m) {let p = [hover[i * 4] as i32, hover[i * 4 + 1] as i32, hover[i * 4 + 2] as i32];total += 1;- navy += (p[2] > p[0] + 20 && p[0] < 110 && p[1] < 130) as usize;- yellow += (p[0] > 200 && p[0] > p[2] + 80) as usize;- body += usize::from(if state == "arrow" { mint(p) } else { ivory(p) });+ for (k, class) in [rim, body, extra].iter().enumerate() {+ counts[k] += usize::from(class(p));+ }}- let share = |k: usize| k as f32 / total.max(1) as f32;- let (navy, body, yellow) = (share(navy), share(body), share(yellow));- println!("star-sprout/{state} : {total} px, marine {navy:.3}, corps {body:.3}, etoile {yellow:.3}");- if !(0.25..0.7).contains(&navy) {- failures.push(format!("{state}: {navy:.3} de marine, le trait du dessin a disparu ou tout mange"));+ let [rim_share, body_share, extra_share] = counts.map(|k| k as f32 / total.max(1) as f32);+ println!("{theme}/{state} : {total} px, trait {rim_share:.3}, corps {body_share:.3}, ornement {extra_share:.3}");+ if !(min_rim..0.7).contains(&rim_share) {+ failures.push(format!("{theme}/{state}: {rim_share:.3} de trait, il a disparu ou tout mange"));}- if body < 0.2 {- failures.push(format!("{state}: {body:.3} de couleur du corps"));+ if body_share < min_body {+ failures.push(format!("{theme}/{state}: {body_share:.3} de couleur du corps"));}- if yellow < 0.03 {- failures.push(format!("{state}: {yellow:.3} d'etoile jaune"));+ if extra_share < min_extra {+ failures.push(format!("{theme}/{state}: {extra_share:.3} d'ornement"));}}assert!(failures.is_empty(), "{failures:#?}");diff --git a/crates/compositor/src/sculpt.rs b/crates/compositor/src/sculpt.rsindex 9edc9d307..8687b1db7 100644--- a/crates/compositor/src/sculpt.rs+++ b/crates/compositor/src/sculpt.rs@@ -28,13 +28,17 @@ const Z_LOW: f32 = 0.05;/// Le plus haut : les yeux de l'étoile de Star Sprout, sur la flèche comme sur la manchette.const Z_HIGH_ARROW: f32 = 0.31;const Z_HIGH_HAND: f32 = 0.4;-/// Boîtes des deux formes dans le prototype (x0, x1, haut), qui contiennent leurs variantes :-/// couche violette des voxels, cristal compris. Leur hauteur est celle du sprite, 1 / SCULPT_SCALE :-/// le mode 15 tient le plus grand côté de la boîte pour 1 (`sprite_size`).+/// Boîtes des modèles dans le prototype (x0, x1, haut). Leur hauteur est celle du sprite,+/// 1 / SCULPT_SCALE : le mode 15 tient le plus grand côté de la boîte pour 1 (`sprite_size`).+/// Celles du cristal et des voxels ; puis les thèmes cerclés, que leur trait élargit et que+/// débordent l'étoile et les feuilles (Star Sprout), les tirets du clic et le calque jaune (Pop+/// Coral), le pouce.const BOX_ARROW: [f32; 3] = [-0.1, 0.75, 0.09];const BOX_HAND: [f32; 3] = [-0.27, 0.73, 0.07];-/// Star Sprout déborde de ces boîtes : l'étoile et ses feuilles à droite de la flèche, le pouce à-/// gauche de la main, le liseré marine autour de tout.+const BOX_INK_ARROW: [f32; 3] = [-0.08, 0.6, 0.03];+const BOX_INK_HAND: [f32; 3] = [-0.36, 0.6, 0.03];+const BOX_CORAL_ARROW: [f32; 3] = [-0.35, 0.6, 0.06];+const BOX_CORAL_HAND: [f32; 3] = [-0.34, 0.62, 0.04];const BOX_SPROUT_ARROW: [f32; 3] = [-0.08, 0.87, 0.03];const BOX_SPROUT_HAND: [f32; 3] = [-0.33, 0.56, 0.03];@@ -43,12 +47,12 @@ const THEMES: [&str; 5] = ["studio-ink", "prism-glow", "pop-coral", "pixel-candy/// Le haut de la silhouette (y du prototype) : la couche violette des voxels dépasse la pointe/// d'une cellule, la pointe arrondie de la flèche et le sommet de sa table taillée dépassent le-/// hotspot de 0,03, le bout de l'index y est ; Star Sprout tient son hotspot au bord de son-/// liseré marine, comme son PNG.+/// hotspot de 0,03, le bout de l'index y est ; les thèmes cerclés tiennent leur hotspot au bord+/// de leur trait, comme leur PNG.fn silhouette_top(theme: usize, arrow: bool) -> f32 {match (THEMES[theme], arrow) {("pixel-candy", _) => 0.0625,- ("star-sprout", _) => 0.0,+ ("studio-ink" | "pop-coral" | "star-sprout", _) => 0.0,(_, true) => 0.03,(_, false) => 0.0,}@@ -57,6 +61,10 @@ fn silhouette_top(theme: usize, arrow: bool) -> f32 {/// La boîte du modèle (x0, x1, haut) dans le prototype.fn model_box(theme: usize, arrow: bool) -> [f32; 3] {match (THEMES[theme], arrow) {+ ("studio-ink", true) => BOX_INK_ARROW,+ ("studio-ink", false) => BOX_INK_HAND,+ ("pop-coral", true) => BOX_CORAL_ARROW,+ ("pop-coral", false) => BOX_CORAL_HAND,("star-sprout", true) => BOX_SPROUT_ARROW,("star-sprout", false) => BOX_SPROUT_HAND,(_, true) => BOX_ARROW,diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlslindex 2d0dcf980..9c6d1cd2d 100644--- a/crates/compositor/src/shaders.hlsl+++ b/crates/compositor/src/shaders.hlsl@@ -587,13 +587,12 @@ static const float MODEL_CONTACT_ALPHA = 0.5;// curseur 1, x à droite, y VERS LE HAUT, z vers la caméra, l'écran en z = 0 et le modèle posé à// SCULPT_HOVER au-dessus. `sculpt_point` y amène un point du repère du modèle. Identifiant :// 1 + 2 × thème + forme ; thèmes 0 Studio Ink, 1 Prism Glow, 2 Pop Coral, 3 Pixel Candy,-// 4 Star Sprout ; formes 0 flèche, 1 main. Id des matières : 1 corps, 2 liseré ou manchette,-// 3 étoile, 4 feuilles, 5 marine de Star Sprout (trait et yeux), 6 face des voxels, 7 couche-// violette, 8 cristal.+// 4 Star Sprout ; formes 0 flèche, 1 main. Id des matières : 1 corps, 2 bande, calque ou+// manchette, 3 tirets ou étoile, 4 feuilles, 5 trait des thèmes cerclés (et yeux), 6 face des+// voxels, 7 couche violette, 8 cristal.static const float SCULPT_SCALE = 0.85;static const float SCULPT_HOVER = 0.05;static const float SCULPT_VOX = 0.0625;-static const float SCULPT_AR_ROUND = 0.03;static const float SCULPT_HAND_ZC = 0.185;// Hauteur, dans le prototype, du z = 0 du modèle : le dessus de la pointe de la flèche, l'axe du// bout de l'index.@@ -620,13 +619,6 @@ float2 s_opu(float2 a, float2 b)return a.x < b.x ? a : b;}-float s_capsule(float3 p, float3 a, float3 b, float r)-{- float3 pa = p - a, ba = b - a;- float h = saturate(dot(pa, ba) / dot(ba, ba));- return length(pa - ba * h) - r;-}-float s_round_box(float3 p, float3 b, float r){float3 q = abs(p) - b + r;@@ -705,74 +697,67 @@ float s_vesica(float2 p, float r, float d)return (p.y - b) * d > p.x * b ? length(p - float2(0.0, b)) : length(p + float2(d, 0.0)) - r;}-// La flèche en volume : extrusion arrondie, bombée d'un dôme qui plafonne avant l'axe médian de-// la silhouette (un dôme qui monterait encore y plierait le dessus).-float s_arrow_solid(float3 p, float h, float re, float dome)-{- float d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- float hh = h + dome * smoothstep(0.0, 0.07, -d2);- return s_extrude(d2, p.z - (SCULPT_HOVER + h + dome), hh, re);-}--// Le liseré de Studio Ink : un jonc posé sur le dessus, en retrait du bord.-float s_piping(float3 p, float ztop)-{- float d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- return length(float2(d2 + 0.075, p.z - ztop)) - 0.017;-}--// Le gant : l'index levé, trois doigts repliés, le pouce, fondus dans la paume.-float s_glove(float3 p, float zc)-{- float index = s_capsule(p, float3(0.0, -0.10, zc), float3(0.0, -0.52, zc), 0.098);- float palm = s_round_box(p - float3(0.185, -0.70, zc), float3(0.255, 0.19, 0.105), 0.1);- float f1 = s_capsule(p, float3(0.17, -0.57, zc + 0.012), float3(0.17, -0.41, zc + 0.045), 0.086);- float f2 = s_capsule(p, float3(0.31, -0.59, zc + 0.01), float3(0.31, -0.45, zc + 0.04), 0.08);- float f3 = s_capsule(p, float3(0.435, -0.625, zc + 0.005), float3(0.435, -0.52, zc + 0.03), 0.07);- float thumb = s_capsule(p, float3(0.03, -0.77, zc + 0.03), float3(-0.165, -0.60, zc + 0.065), 0.082);- float d = s_smin(palm, min(f1, min(f2, f3)), 0.035);- d = s_smin(d, index, 0.05);- return s_smin(d, thumb, 0.05);-}--// La manchette, ronde autour du poignet (elliptique en xz) : le gant y entre.-float s_cuff(float3 p, float zc)-{- float3 q = p - float3(0.185, -0.925, zc);- float2 ab = float2(0.272, 0.12);- float e = (length(q.xz / ab) - 1.0) * min(ab.x, ab.y);- return s_extrude(e, q.y, 0.07, 0.06);-}--// Star Sprout suit son dessin (`design/cursors/star-sprout/source.png`) et le rendu 3D de-// référence posé à côté : le trait marine du dessin n'est pas jeté, il devient la matière qui-// porte tout. Chaque pièce (la flèche ou le gant, la manchette, les feuilles, l'étoile) est un-// plateau marine sous sa silhouette, un jonc marine posé sur le trait et un coussin de couleur-// bombé dans le trait ; la manchette, les feuilles puis l'étoile se posent devant le corps.-// SPROUT_POLY : la couleur de la flèche (le trait l'élargit de 0,06, sa pointe arrondie touche le-// hotspot), puis la paume du gant, arrondie de 0,05 (un sommet coupe un côté en deux : sept-// chacun).-static const float2 SPROUT_POLY[14] = {+// Les thèmes CERCLÉS (Studio Ink, Pop Coral, Star Sprout) suivent la planche 3D de référence+// (`design/cursors/3d-concept.png`) : le trait de leur dessin 2D n'est pas jeté, il devient la+// matière qui porte tout. Chaque pièce (la flèche, le gant, la manchette, les feuilles, l'étoile)+// est un plateau sous sa silhouette, un jonc sur le trait et un coussin de couleur bombé dedans.+// RIM_POLY : sept sommets par polygone (un sommet coupe un côté en deux quand il en faut six).+// D'abord la couleur de la flèche, commune aux trois thèmes (le trait l'élargit de 0,06, sa pointe+// arrondie touche le hotspot), puis les paumes de Star Sprout, de Studio Ink et de Pop Coral,+// arrondies de 0,05.+static const float2 RIM_POLY[28] = {float2(0.0, -0.06), float2(0.0, -0.7712), float2(0.165, -0.6325), float2(0.313, -0.9318),float2(0.4234, -0.8557), float2(0.2672, -0.5686), float2(0.456, -0.5393),float2(-0.173, -0.5237), float2(-0.016, -0.75), float2(0.329, -0.75), float2(0.411, -0.592),- float2(0.411, -0.43), float2(0.19, -0.435), float2(-0.03, -0.44)+ float2(0.411, -0.43), float2(0.19, -0.435), float2(-0.03, -0.44),+ float2(-0.1825, -0.6215), float2(0.0037, -0.9195), float2(0.3462, -0.9195), float2(0.467, -0.6906),+ float2(0.467, -0.49), float2(0.2, -0.49), float2(-0.03, -0.49),+ float2(-0.1807, -0.5534), float2(0.0194, -0.872), float2(0.3485, -0.872), float2(0.47, -0.6795),+ float2(0.47, -0.49), float2(0.2, -0.49), float2(-0.03, -0.49)};-// Distance signée au polygone de SPROUT_POLY qui commence en `base` (cf. `s_arrow2`).-float s_sprout_poly(float2 p, int base)+// Les trois gants, mesurés sur leur dessin (g : 0 Star Sprout, 1 Studio Ink, 2 Pop Coral), neuf+// lignes chacun : les segments de l'index, des trois doigts repliés et du pouce, ceux des trois+// fentes entre les doigts, puis le V entre le pouce et l'index (un point du bord du pouce et la+// normale qui entre dans le V). RIM_GLOVE_R, trois lignes par gant : les rayons des quatre doigts ;+// ceux du pouce et des trois fentes ; le bord de l'index que longe le V, le fond du V, le trait.+static const float4 RIM_GLOVE[27] = {+ float4(0.0, -0.1077, 0.0, -0.6), float4(0.1493, -0.3279, 0.1493, -0.6),+ float4(0.2863, -0.3654, 0.2863, -0.6), float4(0.4193, -0.4043, 0.4193, -0.6),+ float4(-0.2, -0.478, -0.075, -0.625), float4(0.0788, -0.25, 0.0788, -0.3992),+ float4(0.2188, -0.3, 0.2188, -0.4234), float4(0.3552, -0.33, 0.3552, -0.4534),+ float4(-0.0845, -0.5386, 0.762, 0.648),+ float4(0.0, -0.1186, 0.0, -0.65), float4(0.1614, -0.3838, 0.1614, -0.65),+ float4(0.3177, -0.427, 0.3177, -0.65), float4(0.4645, -0.4848, 0.4645, -0.65),+ float4(-0.215, -0.535, -0.1208, -0.6864), float4(0.0832, -0.3, 0.0832, -0.48),+ float4(0.2414, -0.35, 0.2414, -0.482), float4(0.3959, -0.41, 0.3959, -0.533),+ float4(-0.122, -0.5718, 0.867, 0.498),+ float4(0.0, -0.122, 0.0, -0.65), float4(0.172, -0.387, 0.172, -0.65),+ float4(0.3267, -0.427, 0.3267, -0.65), float4(0.4727, -0.4867, 0.4727, -0.65),+ float4(-0.199, -0.483, -0.102, -0.645), float4(0.0927, -0.3, 0.0927, -0.476),+ float4(0.2493, -0.35, 0.2493, -0.478), float4(0.402, -0.41, 0.402, -0.52),+ float4(-0.0993, -0.5267, 0.858, 0.514)+};+static const float4 RIM_GLOVE_R[9] = {+ float4(0.0552, 0.047, 0.045, 0.0375), float4(0.052, 0.0235, 0.0225, 0.0225), float4(0.0552, -0.548, 0.0525, 0.0),+ float4(0.064, 0.0585, 0.0585, 0.0515), float4(0.06, 0.0197, 0.0178, 0.0172), float4(0.0648, -0.6, 0.058, 0.0),+ float4(0.066, 0.0553, 0.0553, 0.0507), float4(0.063, 0.024, 0.022, 0.02), float4(0.0647, -0.555, 0.056, 0.0)+};++// Distance signée au polygone de RIM_POLY qui commence en `base` (cf. `s_arrow2`).+float s_rim_poly(float2 p, int base){- float d = dot(p - SPROUT_POLY[base], p - SPROUT_POLY[base]);+ float d = dot(p - RIM_POLY[base], p - RIM_POLY[base]);float s = 1.0;int j = base + 6;[loop] for (int i = base; i < base + 7; i++){- float2 e = SPROUT_POLY[j] - SPROUT_POLY[i];- float2 w = p - SPROUT_POLY[i];+ float2 e = RIM_POLY[j] - RIM_POLY[i];+ float2 w = p - RIM_POLY[i];float2 b = w - e * saturate(dot(w, e) / dot(e, e));d = min(d, dot(b, b));- bool c0 = p.y >= SPROUT_POLY[i].y;- bool c1 = p.y < SPROUT_POLY[j].y;+ bool c0 = p.y >= RIM_POLY[i].y;+ bool c1 = p.y < RIM_POLY[j].y;bool c2 = e.x * w.y > e.y * w.x;if ((c0 && c1 && c2) || (!c0 && !c1 && !c2)){@@ -783,36 +768,42 @@ float s_sprout_poly(float2 p, int base)return s * sqrt(d);}-// Le gant de Star Sprout dans le plan, autour de sa paume `palm` : (silhouette, couleur). La-// silhouette unit la paume, l'index levé, trois doigts repliés et le pouce ; la couleur en est-// creusée des rainures du dessin, trois fentes entre les doigts et le V entre le pouce et l'index.-float2 s_sprout_glove(float2 p, float palm)-{- float index = sd_segment(p, float2(0.0, -0.1077), float2(0.0, -0.6)) - 0.0552;- float middle = sd_segment(p, float2(0.1493, -0.3279), float2(0.1493, -0.6)) - 0.047;- float ring = sd_segment(p, float2(0.2863, -0.3654), float2(0.2863, -0.6)) - 0.045;- float pinky = sd_segment(p, float2(0.4193, -0.4043), float2(0.4193, -0.6)) - 0.0375;- float thumb = sd_segment(p, float2(-0.2, -0.478), float2(-0.075, -0.625)) - 0.052;- float sil = s_smin(palm, min(min(index, middle), min(min(ring, pinky), thumb)), 0.03);- float g = sd_segment(p, float2(0.0788, -0.25), float2(0.0788, -0.3992)) - 0.0235;- g = min(g, sd_segment(p, float2(0.2188, -0.3), float2(0.2188, -0.4234)) - 0.0225);- g = min(g, sd_segment(p, float2(0.3552, -0.33), float2(0.3552, -0.4534)) - 0.0225);- float v = max(max(-dot(p - float2(-0.0845, -0.5386), float2(0.762, 0.648)), p.x + 0.0552), -0.548 - p.y);- return float2(sil, max(sil, -min(g, v)));-}--// Une pièce de Star Sprout : (distance, matière). `d` : sa couleur dans le plan, `sil` : la même-// avant les rainures. Le plateau marine monte de SCULPT_HOVER à `zt` sous la silhouette élargie-// du trait `w`. Le jonc, un tore de rayon w/2 à la hauteur `zt`, suit le milieu du trait : dans-// une rainure plus étroite que le trait il n'en reste que la crête, un muret entre les doigts.-// Le coussin de la matière `mat` sort du plateau, haut de `h` au bord, bombé sur 0,045 puis de-// `bump` ; sa hauteur variable penche le champ, d'où la distance minorée (× 0,8).-float2 s_piece(float d, float sil, float z, float w, float zt, float h, float bump, float mat)+// Le gant `g` dans le plan, autour de sa paume `palm` : (silhouette, couleur). La silhouette unit+// la paume, l'index levé, trois doigts repliés et le pouce ; la couleur en est creusée des+// rainures du dessin, trois fentes entre les doigts et le V entre le pouce et l'index.+float2 s_rim_glove(float2 p, int g, float palm)+{+ float4 r0 = RIM_GLOVE_R[3 * g];+ float4 r1 = RIM_GLOVE_R[3 * g + 1];+ float4 r2 = RIM_GLOVE_R[3 * g + 2];+ int i = 9 * g;+ float f = min(sd_segment(p, RIM_GLOVE[i].xy, RIM_GLOVE[i].zw) - r0.x,+ sd_segment(p, RIM_GLOVE[i + 1].xy, RIM_GLOVE[i + 1].zw) - r0.y);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 2].xy, RIM_GLOVE[i + 2].zw) - r0.z);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 3].xy, RIM_GLOVE[i + 3].zw) - r0.w);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 4].xy, RIM_GLOVE[i + 4].zw) - r1.x);+ float grooves = min(sd_segment(p, RIM_GLOVE[i + 5].xy, RIM_GLOVE[i + 5].zw) - r1.y,+ sd_segment(p, RIM_GLOVE[i + 6].xy, RIM_GLOVE[i + 6].zw) - r1.z);+ grooves = min(grooves, sd_segment(p, RIM_GLOVE[i + 7].xy, RIM_GLOVE[i + 7].zw) - r1.w);+ float sil = s_smin(palm, f, 0.03);+ float4 v = RIM_GLOVE[i + 8];+ float wedge = max(max(-dot(p - v.xy, v.zw), p.x + r2.x), r2.y - p.y);+ return float2(sil, max(sil, -min(grooves, wedge)));+}++// Une pièce cerclée : (distance, matière). `d` : le bord intérieur du trait dans le plan, `sil` :+// le même avant les rainures, `dc` : le coussin. Le plateau (matière 5) monte de SCULPT_HOVER à+// `zt` sous la silhouette élargie du trait `w`. Le jonc (matière 5), un tore de rayon w/2 à la+// hauteur `zt`, suit le milieu du trait : dans une rainure plus étroite que le trait il n'en reste+// que la crête, un muret entre les doigts. Le coussin de la matière `mat` sort du plateau, haut de+// `h` au bord, bombé sur 0,045 puis de `bump` ; sa hauteur variable penche le champ, d'où la+// distance minorée (× 0,8).+float2 s_piece(float d, float dc, float sil, float z, float w, float zt, float h, float bump, float mat){float tray = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + zt), 0.5 * (zt - SCULPT_HOVER), 0.012);float bead = length(float2(d - 0.5 * w, z - zt)) - 0.5 * w;- float u = saturate(-d / 0.045);- float cushion = 0.8 * s_extrude(d, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);+ float u = saturate(-dc / 0.045);+ float cushion = 0.8 * s_extrude(dc, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));}@@ -824,46 +815,102 @@ float s_bump(float2 p, float2 c, float r)return k * k;}-// Star Sprout (thème 4) : la flèche menthe, ou le gant ivoire et sa manchette menthe ; puis-// l'étoile jaune, ses deux feuilles et ses yeux, lus dans le repère de l'étoile (centre `c`,-// tournée de `ang`, en unités de son rayon `rs`). Matières : 1 corps, 2 manchette, 3 étoile,-// 4 feuilles, 5 marine (plateaux, joncs, yeux).-float2 s_star_sprout(float3 p, int shape)+// Un tiret du clic de Pop Coral : capsule inégale de a (rayon ra) à b (rayon rb), exacte.+float s_dash(float2 p, float2 a, float2 b, float ra, float rb)+{+ p -= a;+ b -= a;+ float hb = dot(b, b);+ float2 q = float2(abs(dot(p, float2(b.y, -b.x))), dot(p, b)) / hb;+ float2 c = float2(sqrt(hb - (ra - rb) * (ra - rb)), ra - rb);+ float k = c.x * q.y - c.y * q.x;+ if (k < 0.0)+ {+ return sqrt(hb * dot(q, q)) - ra;+ }+ if (k > c.x)+ {+ return sqrt(hb * (dot(q, q) + 1.0 - 2.0 * q.y)) - rb;+ }+ return dot(c, q) - ra;+}++// Les thèmes cerclés. La flèche : Star Sprout menthe, Pop Coral corail, et Studio Ink noir, dont le+// trait se partage en un jonc noir au bord et une bande ivoire en relief, le champ restant le+// dessus du plateau. Le gant ivoire, jaune ou ivoire. Puis ce que chacun ajoute devant : le calque+// jaune de la flèche et les tirets du clic de Pop Coral ; la manchette, l'étoile, ses feuilles et+// ses yeux de Star Sprout, lus dans le repère de l'étoile (centre `c`, tournée, en unités de son+// rayon `rs`). Matières : 1 corps, 2 bande ivoire, calque jaune ou manchette, 3 tirets ou étoile,+// 4 feuilles, 5 le trait (plateaux, joncs, yeux).+float2 s_rimmed(float3 p, int theme, int shape){bool arrow = shape == 0;- float poly = s_sprout_poly(p.xy, arrow ? 0 : 7);+ int g = theme == 4 ? 0 : (theme == 0 ? 1 : 2);+ float poly = s_rim_poly(p.xy, arrow ? 0 : 7 * g + 7);float2 body = float2(poly, poly);float w = 0.06, zt = 0.17, h = 0.03;float bump = 0.022 * s_bump(p.xy, float2(0.15, -0.45), 0.3);- float2 c = float2(0.6118, -0.8079);- float rs = 0.1678, ang = 0.2443, zs = 0.23;if (!arrow){- body = s_sprout_glove(p.xy, poly - 0.05);- w = 0.0525;+ body = s_rim_glove(p.xy, g, poly - 0.05);+ w = RIM_GLOVE_R[3 * g + 2].z;zt = 0.185;h = 0.028;bump = 0.03 * s_bump(p.xy, float2(0.19, -0.62), 0.28);- c = float2(0.15, -0.885);- rs = 0.128;- ang = 0.0;- zs = 0.285;}- float2 r = s_piece(body.y, body.x, p.z, w, zt, h, bump, 1.0);+ float dc = body.y;+ if (arrow && theme == 0)+ {+ // Studio Ink : pas de coussin, le jonc sur le bord extérieur du trait.+ body -= 0.015;+ w = 0.045;+ dc = 1.0;+ }+ float2 r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);+ if (theme == 0)+ {+ if (arrow)+ {+ float band = s_extrude(abs(poly + 0.0075) - 0.0225, p.z - zt, 0.028, 0.012);+ r = s_opu(r, float2(band, 2.0));+ }+ return r;+ }+ if (theme == 2)+ {+ float dash;+ if (arrow)+ {+ // Le calque jaune, décalé en bas à gauche, derrière le plateau.+ float back = s_rim_poly(p.xy + float2(0.025, 0.05), 0) - 0.06;+ r = s_opu(r, float2(s_extrude(back, p.z - 0.09, 0.04, 0.03), 2.0));+ dash = min(s_dash(p.xy, float2(-0.1179, -0.1374), float2(-0.1799, -0.0443), 0.028, 0.045),+ s_dash(p.xy, float2(-0.1347, -0.2493), float2(-0.248, -0.2056), 0.026, 0.042));+ }+ else+ {+ dash = min(s_dash(p.xy, float2(0.216, -0.1695), float2(0.2593, -0.0685), 0.028, 0.042),+ s_dash(p.xy, float2(0.3054, -0.2339), float2(0.3949, -0.1652), 0.0275, 0.041));+ }+ return s_opu(r, float2(s_extrude(dash, p.z - 0.16, 0.035, 0.03), 3.0));+ }if (!arrow){// La manchette : un rectangle arrondi, cintré en sourire comme au dessin.float2 cq = p.xy - float2(0.1541, -0.9047);float2 bq = abs(float2(cq.x, cq.y - 0.2066 * cq.x * cq.x)) - float2(0.214, 0.0361);float cuff = length(max(bq, 0.0)) + min(max(bq.x, bq.y), 0.0) - 0.03;- r = s_opu(r, s_piece(cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));+ r = s_opu(r, s_piece(cuff, cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));}- float2 q = s_rot(p.xy - c, ang) / rs;+ float2 c = arrow ? float2(0.6118, -0.8079) : float2(0.15, -0.885);+ float rs = arrow ? 0.1678 : 0.128;+ float zs = arrow ? 0.23 : 0.285;+ float2 q = s_rot(p.xy - c, arrow ? 0.2443 : 0.0) / rs;float star = (s_star5(q, 0.82, 0.55) - 0.18) * rs;float leaves = min(s_vesica(s_rot(q - float2(-0.33, 1.38), -0.925), 0.4296, 0.2626),s_vesica(s_rot(q - float2(0.53, 1.37), 0.873), 0.4296, 0.2626)) * rs;- r = s_opu(r, s_piece(leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));- r = s_opu(r, s_piece(star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, float2(0.0, 0.0), 1.0), 3.0));+ r = s_opu(r, s_piece(leaves, leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));+ r = s_opu(r, s_piece(star, star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, float2(0.0, 0.0), 1.0), 3.0));// Les yeux : deux ovales marine qui affleurent du coussin.float3 e = float3(abs(q.x) - 0.25, q.y - 0.08, (p.z - zs - 0.056) / rs);return s_opu(r, float2(s_ellipsoid(e, float3(0.075, 0.13, 0.1)) * rs, 5.0));@@ -1073,28 +1120,8 @@ float2 sculpt_proto(float3 p, int theme, int shape){return float2(shape == 0 ? s_gem_arrow(p) : s_crystal_hand(p), 8.0);}- // Un seul appel pour les deux formes (FXC recopie chaque appel).- if (theme == 4)- {- return s_star_sprout(p, shape);- }- if (shape == 0)- {- float h = 0.075, re = 0.03, dome = 0.0;- if (theme == 2)- {- h = 0.07;- re = 0.06;- dome = 0.035;- }- float2 r = float2(s_arrow_solid(p, h, re, dome), 1.0);- if (theme == 0)- {- r = s_opu(r, float2(s_piping(p, SCULPT_HOVER + 2.0 * h - 0.004), 2.0));- }- return r;- }- return s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));+ // Un seul appel pour les trois thèmes cerclés et leurs deux formes (FXC recopie chaque appel).+ return s_rimmed(p, theme, shape);}// Repère du modèle -> prototype. L'écrasement du clic ne raccourcit que z, autour du hotspot.@@ -1114,8 +1141,8 @@ float sculpt_units()// Le curseur sculpté en `q` (repère du modèle) : distance et id de matière. `occ` : ce qui porte// l'ombre sur l'écran. La borne des plans d'une gemme et le champ des voxels sont de mauvaises// distances loin de la surface : la pénombre s'y strie, ou s'arrête net au bord de la boîte des-// voxels. Le cristal porte donc l'ombre de la forme lisse de Pop Coral, les voxels celle de leur-// contour extrudé sur toute leur hauteur.+// voxels. Le cristal porte donc l'ombre de la forme cerclée de Studio Ink, sans ornement, les+// voxels celle de leur contour extrudé sur toute leur hauteur.float2 sculpt_eval(float3 q, bool occ){int id = sculpt_id() - 1;@@ -1130,7 +1157,7 @@ float2 sculpt_eval(float3 q, bool occ)}else{- r = sculpt_proto(p, occ && theme == 1 ? 2 : theme, shape);+ r = sculpt_proto(p, occ && theme == 1 ? 0 : theme, shape);}return float2(r.x * sculpt_units(), r.y);}@@ -1269,16 +1296,18 @@ SculptMat sculpt_material(float mat, float3 p, int theme, int shape)bool primary = mat < 1.5;if (theme == 0){- if (shape == 0 && primary) return s_mat(s_lin(0.10, 0.10, 0.115), 0.3, 0.2, 0.0, 0.9);- if (shape == 0) return s_mat(s_lin(0.94, 0.91, 0.84), 0.45, 0.4, 0.2, 0.3);- if (primary) return s_mat(s_lin(0.95, 0.92, 0.85), 0.55, 0.35, 0.35, 0.25);- return s_mat(s_lin(0.17, 0.18, 0.22), 0.35, 0.6, 0.0, 0.6);+ // Ivoire (le gant, la bande de la flèche) ; noir satiné, presque sans reflet : un reflet+ // large sur le champ plat de la flèche le virait au gris.+ if (mat < 2.5) return s_mat(s_lin(0.95, 0.92, 0.85), 0.3, 0.6, 0.35, 0.25);+ return s_mat(s_lin(0.1, 0.1, 0.11), 0.55, 0.05, 0.0, 0.1);}if (theme == 2){- if (shape == 0) return s_mat(s_lin(1.0, 0.40, 0.30), 0.5, 0.45, 0.4, 0.25);- if (primary) return s_mat(s_lin(1.0, 0.79, 0.16), 0.5, 0.45, 0.4, 0.25);- return s_mat(s_lin(0.18, 0.20, 0.29), 0.4, 0.5, 0.0, 0.4);+ // Corail : la flèche et les tirets de la main ; jaune : le gant, le calque et les tirets de+ // la flèche ; le trait marine.+ if ((primary && shape == 0) || (mat > 2.5 && mat < 3.5 && shape == 1)) return s_mat(s_lin(1.0, 0.40, 0.30), 0.35, 0.55, 0.35, 0.25);+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.10), 0.35, 0.55, 0.35, 0.25);+ return s_mat(s_lin(0.09, 0.13, 0.45), 0.6, 0.25, 0.05, 0.1);}if (theme == 4){diff --git a/crates/compositor/src/shaders.metal b/crates/compositor/src/shaders.metalindex 9ae9d7887..77476dbd5 100644--- a/crates/compositor/src/shaders.metal+++ b/crates/compositor/src/shaders.metal@@ -590,7 +590,6 @@ inline int sculpt_id(constant Layer &layer)constant float SCULPT_SCALE = 0.85;constant float SCULPT_HOVER = 0.05;constant float SCULPT_VOX = 0.0625;-constant float SCULPT_AR_ROUND = 0.03;constant float SCULPT_HAND_ZC = 0.185;constant float SCULPT_ZREF_ARROW = 0.2;constant float SCULPT_ZREF_HAND = 0.185;@@ -613,13 +612,6 @@ inline float2 s_opu(float2 a, float2 b)return a.x < b.x ? a : b;}-static float s_capsule(float3 p, float3 a, float3 b, float r)-{- float3 pa = p - a, ba = b - a;- float h = saturate(dot(pa, ba) / dot(ba, ba));- return length(pa - ba * h) - r;-}-static float s_round_box(float3 p, float3 b, float r){float3 q = abs(p) - b + r;@@ -695,61 +687,55 @@ static float s_vesica(float2 p, float r, float d)return (p.y - b) * d > p.x * b ? length(p - float2(0.0, b)) : length(p + float2(d, 0.0)) - r;}-static float s_arrow_solid(float3 p, float h, float re, float dome)-{- float d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- float hh = h + dome * smoothstep(0.0, 0.07, -d2);- return s_extrude(d2, p.z - (SCULPT_HOVER + h + dome), hh, re);-}--static float s_piping(float3 p, float ztop)-{- float d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- return length(float2(d2 + 0.075, p.z - ztop)) - 0.017;-}--static float s_glove(float3 p, float zc)-{- float index = s_capsule(p, float3(0.0, -0.10, zc), float3(0.0, -0.52, zc), 0.098);- float palm = s_round_box(p - float3(0.185, -0.70, zc), float3(0.255, 0.19, 0.105), 0.1);- float f1 = s_capsule(p, float3(0.17, -0.57, zc + 0.012), float3(0.17, -0.41, zc + 0.045), 0.086);- float f2 = s_capsule(p, float3(0.31, -0.59, zc + 0.01), float3(0.31, -0.45, zc + 0.04), 0.08);- float f3 = s_capsule(p, float3(0.435, -0.625, zc + 0.005), float3(0.435, -0.52, zc + 0.03), 0.07);- float thumb = s_capsule(p, float3(0.03, -0.77, zc + 0.03), float3(-0.165, -0.60, zc + 0.065), 0.082);- float d = s_smin(palm, min(f1, min(f2, f3)), 0.035);- d = s_smin(d, index, 0.05);- return s_smin(d, thumb, 0.05);-}--static float s_cuff(float3 p, float zc)-{- float3 q = p - float3(0.185, -0.925, zc);- float2 ab = float2(0.272, 0.12);- float e = (length(q.xz / ab) - 1.0) * min(ab.x, ab.y);- return s_extrude(e, q.y, 0.07, 0.06);-}--// Star Sprout (cf. HLSL) : la fleche menthe et sa paume, polygones du dessin 2D.-constant float2 SPROUT_POLY[14] = {+// Curseurs cercles (cf. HLSL) : Studio Ink, Pop Coral, Star Sprout.+constant float2 RIM_POLY[28] = {float2(0.0, -0.06), float2(0.0, -0.7712), float2(0.165, -0.6325), float2(0.313, -0.9318),float2(0.4234, -0.8557), float2(0.2672, -0.5686), float2(0.456, -0.5393),float2(-0.173, -0.5237), float2(-0.016, -0.75), float2(0.329, -0.75), float2(0.411, -0.592),- float2(0.411, -0.43), float2(0.19, -0.435), float2(-0.03, -0.44)+ float2(0.411, -0.43), float2(0.19, -0.435), float2(-0.03, -0.44),+ float2(-0.1825, -0.6215), float2(0.0037, -0.9195), float2(0.3462, -0.9195), float2(0.467, -0.6906),+ float2(0.467, -0.49), float2(0.2, -0.49), float2(-0.03, -0.49),+ float2(-0.1807, -0.5534), float2(0.0194, -0.872), float2(0.3485, -0.872), float2(0.47, -0.6795),+ float2(0.47, -0.49), float2(0.2, -0.49), float2(-0.03, -0.49)+};++constant float4 RIM_GLOVE[27] = {+ float4(0.0, -0.1077, 0.0, -0.6), float4(0.1493, -0.3279, 0.1493, -0.6),+ float4(0.2863, -0.3654, 0.2863, -0.6), float4(0.4193, -0.4043, 0.4193, -0.6),+ float4(-0.2, -0.478, -0.075, -0.625), float4(0.0788, -0.25, 0.0788, -0.3992),+ float4(0.2188, -0.3, 0.2188, -0.4234), float4(0.3552, -0.33, 0.3552, -0.4534),+ float4(-0.0845, -0.5386, 0.762, 0.648),+ float4(0.0, -0.1186, 0.0, -0.65), float4(0.1614, -0.3838, 0.1614, -0.65),+ float4(0.3177, -0.427, 0.3177, -0.65), float4(0.4645, -0.4848, 0.4645, -0.65),+ float4(-0.215, -0.535, -0.1208, -0.6864), float4(0.0832, -0.3, 0.0832, -0.48),+ float4(0.2414, -0.35, 0.2414, -0.482), float4(0.3959, -0.41, 0.3959, -0.533),+ float4(-0.122, -0.5718, 0.867, 0.498),+ float4(0.0, -0.122, 0.0, -0.65), float4(0.172, -0.387, 0.172, -0.65),+ float4(0.3267, -0.427, 0.3267, -0.65), float4(0.4727, -0.4867, 0.4727, -0.65),+ float4(-0.199, -0.483, -0.102, -0.645), float4(0.0927, -0.3, 0.0927, -0.476),+ float4(0.2493, -0.35, 0.2493, -0.478), float4(0.402, -0.41, 0.402, -0.52),+ float4(-0.0993, -0.5267, 0.858, 0.514)};-static float s_sprout_poly(float2 p, int base)+constant float4 RIM_GLOVE_R[9] = {+ float4(0.0552, 0.047, 0.045, 0.0375), float4(0.052, 0.0235, 0.0225, 0.0225), float4(0.0552, -0.548, 0.0525, 0.0),+ float4(0.064, 0.0585, 0.0585, 0.0515), float4(0.06, 0.0197, 0.0178, 0.0172), float4(0.0648, -0.6, 0.058, 0.0),+ float4(0.066, 0.0553, 0.0553, 0.0507), float4(0.063, 0.024, 0.022, 0.02), float4(0.0647, -0.555, 0.056, 0.0)+};++static float s_rim_poly(float2 p, int base){- float d = dot(p - SPROUT_POLY[base], p - SPROUT_POLY[base]);+ float d = dot(p - RIM_POLY[base], p - RIM_POLY[base]);float s = 1.0;int j = base + 6;for (int i = base; i < base + 7; i++){- float2 e = SPROUT_POLY[j] - SPROUT_POLY[i];- float2 w = p - SPROUT_POLY[i];+ float2 e = RIM_POLY[j] - RIM_POLY[i];+ float2 w = p - RIM_POLY[i];float2 b = w - e * saturate(dot(w, e) / dot(e, e));d = min(d, dot(b, b));- bool c0 = p.y >= SPROUT_POLY[i].y;- bool c1 = p.y < SPROUT_POLY[j].y;+ bool c0 = p.y >= RIM_POLY[i].y;+ bool c1 = p.y < RIM_POLY[j].y;bool c2 = e.x * w.y > e.y * w.x;if ((c0 && c1 && c2) || (!c0 && !c1 && !c2)){@@ -760,27 +746,32 @@ static float s_sprout_poly(float2 p, int base)return s * sqrt(d);}-static float2 s_sprout_glove(float2 p, float palm)+static float2 s_rim_glove(float2 p, int g, float palm){- float index = sd_segment(p, float2(0.0, -0.1077), float2(0.0, -0.6)) - 0.0552;- float middle = sd_segment(p, float2(0.1493, -0.3279), float2(0.1493, -0.6)) - 0.047;- float ring = sd_segment(p, float2(0.2863, -0.3654), float2(0.2863, -0.6)) - 0.045;- float pinky = sd_segment(p, float2(0.4193, -0.4043), float2(0.4193, -0.6)) - 0.0375;- float thumb = sd_segment(p, float2(-0.2, -0.478), float2(-0.075, -0.625)) - 0.052;- float sil = s_smin(palm, min(min(index, middle), min(min(ring, pinky), thumb)), 0.03);- float g = sd_segment(p, float2(0.0788, -0.25), float2(0.0788, -0.3992)) - 0.0235;- g = min(g, sd_segment(p, float2(0.2188, -0.3), float2(0.2188, -0.4234)) - 0.0225);- g = min(g, sd_segment(p, float2(0.3552, -0.33), float2(0.3552, -0.4534)) - 0.0225);- float v = max(max(-dot(p - float2(-0.0845, -0.5386), float2(0.762, 0.648)), p.x + 0.0552), -0.548 - p.y);- return float2(sil, max(sil, -min(g, v)));+ float4 r0 = RIM_GLOVE_R[3 * g];+ float4 r1 = RIM_GLOVE_R[3 * g + 1];+ float4 r2 = RIM_GLOVE_R[3 * g + 2];+ int i = 9 * g;+ float f = min(sd_segment(p, RIM_GLOVE[i].xy, RIM_GLOVE[i].zw) - r0.x,+ sd_segment(p, RIM_GLOVE[i + 1].xy, RIM_GLOVE[i + 1].zw) - r0.y);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 2].xy, RIM_GLOVE[i + 2].zw) - r0.z);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 3].xy, RIM_GLOVE[i + 3].zw) - r0.w);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 4].xy, RIM_GLOVE[i + 4].zw) - r1.x);+ float grooves = min(sd_segment(p, RIM_GLOVE[i + 5].xy, RIM_GLOVE[i + 5].zw) - r1.y,+ sd_segment(p, RIM_GLOVE[i + 6].xy, RIM_GLOVE[i + 6].zw) - r1.z);+ grooves = min(grooves, sd_segment(p, RIM_GLOVE[i + 7].xy, RIM_GLOVE[i + 7].zw) - r1.w);+ float sil = s_smin(palm, f, 0.03);+ float4 v = RIM_GLOVE[i + 8];+ float wedge = max(max(-dot(p - v.xy, v.zw), p.x + r2.x), r2.y - p.y);+ return float2(sil, max(sil, -min(grooves, wedge)));}-static float2 s_piece(float d, float sil, float z, float w, float zt, float h, float bump, float mat)+static float2 s_piece(float d, float dc, float sil, float z, float w, float zt, float h, float bump, float mat){float tray = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + zt), 0.5 * (zt - SCULPT_HOVER), 0.012);float bead = length(float2(d - 0.5 * w, z - zt)) - 0.5 * w;- float u = saturate(-d / 0.045);- float cushion = 0.8 * s_extrude(d, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);+ float u = saturate(-dc / 0.045);+ float cushion = 0.8 * s_extrude(dc, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));}@@ -790,41 +781,91 @@ inline float s_bump(float2 p, float2 c, float r)return k * k;}-static float2 s_star_sprout(float3 p, int shape)+static float s_dash(float2 p, float2 a, float2 b, float ra, float rb)+{+ p -= a;+ b -= a;+ float hb = dot(b, b);+ float2 q = float2(abs(dot(p, float2(b.y, -b.x))), dot(p, b)) / hb;+ float2 c = float2(sqrt(hb - (ra - rb) * (ra - rb)), ra - rb);+ float k = c.x * q.y - c.y * q.x;+ if (k < 0.0)+ {+ return sqrt(hb * dot(q, q)) - ra;+ }+ if (k > c.x)+ {+ return sqrt(hb * (dot(q, q) + 1.0 - 2.0 * q.y)) - rb;+ }+ return dot(c, q) - ra;+}++static float2 s_rimmed(float3 p, int theme, int shape){bool arrow = shape == 0;- float poly = s_sprout_poly(p.xy, arrow ? 0 : 7);+ int g = theme == 4 ? 0 : (theme == 0 ? 1 : 2);+ float poly = s_rim_poly(p.xy, arrow ? 0 : 7 * g + 7);float2 body = float2(poly, poly);float w = 0.06, zt = 0.17, h = 0.03;float bump = 0.022 * s_bump(p.xy, float2(0.15, -0.45), 0.3);- float2 c = float2(0.6118, -0.8079);- float rs = 0.1678, ang = 0.2443, zs = 0.23;if (!arrow){- body = s_sprout_glove(p.xy, poly - 0.05);- w = 0.0525;+ body = s_rim_glove(p.xy, g, poly - 0.05);+ w = RIM_GLOVE_R[3 * g + 2].z;zt = 0.185;h = 0.028;bump = 0.03 * s_bump(p.xy, float2(0.19, -0.62), 0.28);- c = float2(0.15, -0.885);- rs = 0.128;- ang = 0.0;- zs = 0.285;}- float2 r = s_piece(body.y, body.x, p.z, w, zt, h, bump, 1.0);+ float dc = body.y;+ if (arrow && theme == 0)+ {+ body -= 0.015;+ w = 0.045;+ dc = 1.0;+ }+ float2 r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);+ if (theme == 0)+ {+ if (arrow)+ {+ float band = s_extrude(abs(poly + 0.0075) - 0.0225, p.z - zt, 0.028, 0.012);+ r = s_opu(r, float2(band, 2.0));+ }+ return r;+ }+ if (theme == 2)+ {+ float dash;+ if (arrow)+ {+ float back = s_rim_poly(p.xy + float2(0.025, 0.05), 0) - 0.06;+ r = s_opu(r, float2(s_extrude(back, p.z - 0.09, 0.04, 0.03), 2.0));+ dash = min(s_dash(p.xy, float2(-0.1179, -0.1374), float2(-0.1799, -0.0443), 0.028, 0.045),+ s_dash(p.xy, float2(-0.1347, -0.2493), float2(-0.248, -0.2056), 0.026, 0.042));+ }+ else+ {+ dash = min(s_dash(p.xy, float2(0.216, -0.1695), float2(0.2593, -0.0685), 0.028, 0.042),+ s_dash(p.xy, float2(0.3054, -0.2339), float2(0.3949, -0.1652), 0.0275, 0.041));+ }+ return s_opu(r, float2(s_extrude(dash, p.z - 0.16, 0.035, 0.03), 3.0));+ }if (!arrow){float2 cq = p.xy - float2(0.1541, -0.9047);float2 bq = abs(float2(cq.x, cq.y - 0.2066 * cq.x * cq.x)) - float2(0.214, 0.0361);float cuff = length(max(bq, 0.0)) + min(max(bq.x, bq.y), 0.0) - 0.03;- r = s_opu(r, s_piece(cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));+ r = s_opu(r, s_piece(cuff, cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));}- float2 q = s_rot(p.xy - c, ang) / rs;+ float2 c = arrow ? float2(0.6118, -0.8079) : float2(0.15, -0.885);+ float rs = arrow ? 0.1678 : 0.128;+ float zs = arrow ? 0.23 : 0.285;+ float2 q = s_rot(p.xy - c, arrow ? 0.2443 : 0.0) / rs;float star = (s_star5(q, 0.82, 0.55) - 0.18) * rs;float leaves = min(s_vesica(s_rot(q - float2(-0.33, 1.38), -0.925), 0.4296, 0.2626),s_vesica(s_rot(q - float2(0.53, 1.37), 0.873), 0.4296, 0.2626)) * rs;- r = s_opu(r, s_piece(leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));- r = s_opu(r, s_piece(star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, float2(0.0), 1.0), 3.0));+ r = s_opu(r, s_piece(leaves, leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));+ r = s_opu(r, s_piece(star, star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, float2(0.0), 1.0), 3.0));float3 e = float3(abs(q.x) - 0.25, q.y - 0.08, (p.z - zs - 0.056) / rs);return s_opu(r, float2(s_ellipsoid(e, float3(0.075, 0.13, 0.1)) * rs, 5.0));}@@ -1008,27 +1049,7 @@ static float2 sculpt_proto(float3 p, int theme, int shape){return float2(shape == 0 ? s_gem_arrow(p) : s_crystal_hand(p), 8.0);}- if (theme == 4)- {- return s_star_sprout(p, shape);- }- if (shape == 0)- {- float h = 0.075, re = 0.03, dome = 0.0;- if (theme == 2)- {- h = 0.07;- re = 0.06;- dome = 0.035;- }- float2 body = float2(s_arrow_solid(p, h, re, dome), 1.0);- if (theme == 0)- {- body = s_opu(body, float2(s_piping(p, SCULPT_HOVER + 2.0 * h - 0.004), 2.0));- }- return body;- }- return s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));+ return s_rimmed(p, theme, shape);}inline float3 sculpt_point(float3 q, constant Layer &layer)@@ -1056,7 +1077,7 @@ static float2 sculpt_eval(float3 q, bool occ, constant Layer &layer)}else{- r = sculpt_proto(p, occ && theme == 1 ? 2 : theme, shape);+ r = sculpt_proto(p, occ && theme == 1 ? 0 : theme, shape);}return float2(r.x * sculpt_units(layer), r.y);}@@ -1178,16 +1199,14 @@ static SculptMat sculpt_material(float mat, float3 p, int theme, int shape)bool primary = mat < 1.5;if (theme == 0){- if (shape == 0 && primary) return s_mat(s_lin(0.10, 0.10, 0.115), 0.3, 0.2, 0.0, 0.9);- if (shape == 0) return s_mat(s_lin(0.94, 0.91, 0.84), 0.45, 0.4, 0.2, 0.3);- if (primary) return s_mat(s_lin(0.95, 0.92, 0.85), 0.55, 0.35, 0.35, 0.25);- return s_mat(s_lin(0.17, 0.18, 0.22), 0.35, 0.6, 0.0, 0.6);+ if (mat < 2.5) return s_mat(s_lin(0.95, 0.92, 0.85), 0.3, 0.6, 0.35, 0.25);+ return s_mat(s_lin(0.1, 0.1, 0.11), 0.55, 0.05, 0.0, 0.1);}if (theme == 2){- if (shape == 0) return s_mat(s_lin(1.0, 0.40, 0.30), 0.5, 0.45, 0.4, 0.25);- if (primary) return s_mat(s_lin(1.0, 0.79, 0.16), 0.5, 0.45, 0.4, 0.25);- return s_mat(s_lin(0.18, 0.20, 0.29), 0.4, 0.5, 0.0, 0.4);+ if ((primary && shape == 0) || (mat > 2.5 && mat < 3.5 && shape == 1)) return s_mat(s_lin(1.0, 0.40, 0.30), 0.35, 0.55, 0.35, 0.25);+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.10), 0.35, 0.55, 0.35, 0.25);+ return s_mat(s_lin(0.09, 0.13, 0.45), 0.6, 0.25, 0.05, 0.1);}if (theme == 4){diff --git a/crates/compositor/src/vk_shaders/layer.wgsl b/crates/compositor/src/vk_shaders/layer.wgslindex 3358f221c..616476b59 100644--- a/crates/compositor/src/vk_shaders/layer.wgsl+++ b/crates/compositor/src/vk_shaders/layer.wgsl@@ -610,7 +610,6 @@ fn sculpt_id() -> i32 {const SCULPT_SCALE: f32 = 0.85;const SCULPT_HOVER: f32 = 0.05;const SCULPT_VOX: f32 = 0.0625;-const SCULPT_AR_ROUND: f32 = 0.03;const SCULPT_HAND_ZC: f32 = 0.185;const SCULPT_ZREF_ARROW: f32 = 0.2;const SCULPT_ZREF_HAND: f32 = 0.185;@@ -630,13 +629,6 @@ fn s_opu(a: vec2<f32>, b: vec2<f32>) -> vec2<f32> {return select(b, a, a.x < b.x);}-fn s_capsule(p: vec3<f32>, a: vec3<f32>, b: vec3<f32>, r: f32) -> f32 {- let pa = p - a;- let ba = b - a;- let h = saturate(dot(pa, ba) / dot(ba, ba));- return length(pa - ba * h) - r;-}-fn s_round_box(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 {let q = abs(p) - b + vec3<f32>(r);return length(max(q, vec3<f32>(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0) - r;@@ -704,55 +696,53 @@ fn s_vesica(p0: vec2<f32>, r: f32, d: f32) -> f32 {return select(length(p + vec2<f32>(d, 0.0)) - r, length(p - vec2<f32>(0.0, b)), (p.y - b) * d > p.x * b);}-fn s_arrow_solid(p: vec3<f32>, h: f32, re: f32, dome: f32) -> f32 {- let d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- let hh = h + dome * smoothstep(0.0, 0.07, -d2);- return s_extrude(d2, p.z - (SCULPT_HOVER + h + dome), hh, re);-}--fn s_piping(p: vec3<f32>, ztop: f32) -> f32 {- let d2 = s_arrow2(p.xy) - SCULPT_AR_ROUND;- return length(vec2<f32>(d2 + 0.075, p.z - ztop)) - 0.017;-}--fn s_glove(p: vec3<f32>, zc: f32) -> f32 {- let index = s_capsule(p, vec3<f32>(0.0, -0.10, zc), vec3<f32>(0.0, -0.52, zc), 0.098);- let palm = s_round_box(p - vec3<f32>(0.185, -0.70, zc), vec3<f32>(0.255, 0.19, 0.105), 0.1);- let f1 = s_capsule(p, vec3<f32>(0.17, -0.57, zc + 0.012), vec3<f32>(0.17, -0.41, zc + 0.045), 0.086);- let f2 = s_capsule(p, vec3<f32>(0.31, -0.59, zc + 0.01), vec3<f32>(0.31, -0.45, zc + 0.04), 0.08);- let f3 = s_capsule(p, vec3<f32>(0.435, -0.625, zc + 0.005), vec3<f32>(0.435, -0.52, zc + 0.03), 0.07);- let thumb = s_capsule(p, vec3<f32>(0.03, -0.77, zc + 0.03), vec3<f32>(-0.165, -0.60, zc + 0.065), 0.082);- var d = s_smin(palm, min(f1, min(f2, f3)), 0.035);- d = s_smin(d, index, 0.05);- return s_smin(d, thumb, 0.05);-}--fn s_cuff(p: vec3<f32>, zc: f32) -> f32 {- let q = p - vec3<f32>(0.185, -0.925, zc);- let ab = vec2<f32>(0.272, 0.12);- let e = (length(q.xz / ab) - 1.0) * min(ab.x, ab.y);- return s_extrude(e, q.y, 0.07, 0.06);-}--// Star Sprout (cf. HLSL) : la fleche menthe et sa paume, polygones du dessin 2D.-const SPROUT_POLY = array<vec2<f32>, 14>(+// Curseurs cercles (cf. HLSL) : Studio Ink, Pop Coral, Star Sprout.+const RIM_POLY = array<vec2<f32>, 28>(vec2<f32>(0.0, -0.06), vec2<f32>(0.0, -0.7712), vec2<f32>(0.165, -0.6325), vec2<f32>(0.313, -0.9318),vec2<f32>(0.4234, -0.8557), vec2<f32>(0.2672, -0.5686), vec2<f32>(0.456, -0.5393),vec2<f32>(-0.173, -0.5237), vec2<f32>(-0.016, -0.75), vec2<f32>(0.329, -0.75), vec2<f32>(0.411, -0.592),- vec2<f32>(0.411, -0.43), vec2<f32>(0.19, -0.435), vec2<f32>(-0.03, -0.44)+ vec2<f32>(0.411, -0.43), vec2<f32>(0.19, -0.435), vec2<f32>(-0.03, -0.44),+ vec2<f32>(-0.1825, -0.6215), vec2<f32>(0.0037, -0.9195), vec2<f32>(0.3462, -0.9195), vec2<f32>(0.467, -0.6906),+ vec2<f32>(0.467, -0.49), vec2<f32>(0.2, -0.49), vec2<f32>(-0.03, -0.49),+ vec2<f32>(-0.1807, -0.5534), vec2<f32>(0.0194, -0.872), vec2<f32>(0.3485, -0.872), vec2<f32>(0.47, -0.6795),+ vec2<f32>(0.47, -0.49), vec2<f32>(0.2, -0.49), vec2<f32>(-0.03, -0.49)+);++const RIM_GLOVE = array<vec4<f32>, 27>(+ vec4<f32>(0.0, -0.1077, 0.0, -0.6), vec4<f32>(0.1493, -0.3279, 0.1493, -0.6),+ vec4<f32>(0.2863, -0.3654, 0.2863, -0.6), vec4<f32>(0.4193, -0.4043, 0.4193, -0.6),+ vec4<f32>(-0.2, -0.478, -0.075, -0.625), vec4<f32>(0.0788, -0.25, 0.0788, -0.3992),+ vec4<f32>(0.2188, -0.3, 0.2188, -0.4234), vec4<f32>(0.3552, -0.33, 0.3552, -0.4534),+ vec4<f32>(-0.0845, -0.5386, 0.762, 0.648),+ vec4<f32>(0.0, -0.1186, 0.0, -0.65), vec4<f32>(0.1614, -0.3838, 0.1614, -0.65),+ vec4<f32>(0.3177, -0.427, 0.3177, -0.65), vec4<f32>(0.4645, -0.4848, 0.4645, -0.65),+ vec4<f32>(-0.215, -0.535, -0.1208, -0.6864), vec4<f32>(0.0832, -0.3, 0.0832, -0.48),+ vec4<f32>(0.2414, -0.35, 0.2414, -0.482), vec4<f32>(0.3959, -0.41, 0.3959, -0.533),+ vec4<f32>(-0.122, -0.5718, 0.867, 0.498),+ vec4<f32>(0.0, -0.122, 0.0, -0.65), vec4<f32>(0.172, -0.387, 0.172, -0.65),+ vec4<f32>(0.3267, -0.427, 0.3267, -0.65), vec4<f32>(0.4727, -0.4867, 0.4727, -0.65),+ vec4<f32>(-0.199, -0.483, -0.102, -0.645), vec4<f32>(0.0927, -0.3, 0.0927, -0.476),+ vec4<f32>(0.2493, -0.35, 0.2493, -0.478), vec4<f32>(0.402, -0.41, 0.402, -0.52),+ vec4<f32>(-0.0993, -0.5267, 0.858, 0.514)+);++const RIM_GLOVE_R = array<vec4<f32>, 9>(+ vec4<f32>(0.0552, 0.047, 0.045, 0.0375), vec4<f32>(0.052, 0.0235, 0.0225, 0.0225), vec4<f32>(0.0552, -0.548, 0.0525, 0.0),+ vec4<f32>(0.064, 0.0585, 0.0585, 0.0515), vec4<f32>(0.06, 0.0197, 0.0178, 0.0172), vec4<f32>(0.0648, -0.6, 0.058, 0.0),+ vec4<f32>(0.066, 0.0553, 0.0553, 0.0507), vec4<f32>(0.063, 0.024, 0.022, 0.02), vec4<f32>(0.0647, -0.555, 0.056, 0.0));-fn s_sprout_poly(p: vec2<f32>, base: i32) -> f32 {- var d = dot(p - SPROUT_POLY[base], p - SPROUT_POLY[base]);+fn s_rim_poly(p: vec2<f32>, base: i32) -> f32 {+ var d = dot(p - RIM_POLY[base], p - RIM_POLY[base]);var s = 1.0;var j = base + 6;for (var i = base; i < base + 7; i++) {- let e = SPROUT_POLY[j] - SPROUT_POLY[i];- let w = p - SPROUT_POLY[i];+ let e = RIM_POLY[j] - RIM_POLY[i];+ let w = p - RIM_POLY[i];let b = w - e * saturate(dot(w, e) / dot(e, e));d = min(d, dot(b, b));- let c0 = p.y >= SPROUT_POLY[i].y;- let c1 = p.y < SPROUT_POLY[j].y;+ let c0 = p.y >= RIM_POLY[i].y;+ let c1 = p.y < RIM_POLY[j].y;let c2 = e.x * w.y > e.y * w.x;if (c0 && c1 && c2) || (!c0 && !c1 && !c2) {s = -s;@@ -762,25 +752,30 @@ fn s_sprout_poly(p: vec2<f32>, base: i32) -> f32 {return s * sqrt(d);}-fn s_sprout_glove(p: vec2<f32>, palm: f32) -> vec2<f32> {- let index = sd_segment(p, vec2<f32>(0.0, -0.1077), vec2<f32>(0.0, -0.6)) - 0.0552;- let middle = sd_segment(p, vec2<f32>(0.1493, -0.3279), vec2<f32>(0.1493, -0.6)) - 0.047;- let ring = sd_segment(p, vec2<f32>(0.2863, -0.3654), vec2<f32>(0.2863, -0.6)) - 0.045;- let pinky = sd_segment(p, vec2<f32>(0.4193, -0.4043), vec2<f32>(0.4193, -0.6)) - 0.0375;- let thumb = sd_segment(p, vec2<f32>(-0.2, -0.478), vec2<f32>(-0.075, -0.625)) - 0.052;- let sil = s_smin(palm, min(min(index, middle), min(min(ring, pinky), thumb)), 0.03);- var g = sd_segment(p, vec2<f32>(0.0788, -0.25), vec2<f32>(0.0788, -0.3992)) - 0.0235;- g = min(g, sd_segment(p, vec2<f32>(0.2188, -0.3), vec2<f32>(0.2188, -0.4234)) - 0.0225);- g = min(g, sd_segment(p, vec2<f32>(0.3552, -0.33), vec2<f32>(0.3552, -0.4534)) - 0.0225);- let v = max(max(-dot(p - vec2<f32>(-0.0845, -0.5386), vec2<f32>(0.762, 0.648)), p.x + 0.0552), -0.548 - p.y);- return vec2<f32>(sil, max(sil, -min(g, v)));-}--fn s_piece(d: f32, sil: f32, z: f32, w: f32, zt: f32, h: f32, bump: f32, mat: f32) -> vec2<f32> {+fn s_rim_glove(p: vec2<f32>, g: i32, palm: f32) -> vec2<f32> {+ let r0 = RIM_GLOVE_R[3 * g];+ let r1 = RIM_GLOVE_R[3 * g + 1];+ let r2 = RIM_GLOVE_R[3 * g + 2];+ let i = 9 * g;+ var f = min(sd_segment(p, RIM_GLOVE[i].xy, RIM_GLOVE[i].zw) - r0.x,+ sd_segment(p, RIM_GLOVE[i + 1].xy, RIM_GLOVE[i + 1].zw) - r0.y);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 2].xy, RIM_GLOVE[i + 2].zw) - r0.z);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 3].xy, RIM_GLOVE[i + 3].zw) - r0.w);+ f = min(f, sd_segment(p, RIM_GLOVE[i + 4].xy, RIM_GLOVE[i + 4].zw) - r1.x);+ var grooves = min(sd_segment(p, RIM_GLOVE[i + 5].xy, RIM_GLOVE[i + 5].zw) - r1.y,+ sd_segment(p, RIM_GLOVE[i + 6].xy, RIM_GLOVE[i + 6].zw) - r1.z);+ grooves = min(grooves, sd_segment(p, RIM_GLOVE[i + 7].xy, RIM_GLOVE[i + 7].zw) - r1.w);+ let sil = s_smin(palm, f, 0.03);+ let v = RIM_GLOVE[i + 8];+ let wedge = max(max(-dot(p - v.xy, v.zw), p.x + r2.x), r2.y - p.y);+ return vec2<f32>(sil, max(sil, -min(grooves, wedge)));+}++fn s_piece(d: f32, dc: f32, sil: f32, z: f32, w: f32, zt: f32, h: f32, bump: f32, mat: f32) -> vec2<f32> {let tray = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + zt), 0.5 * (zt - SCULPT_HOVER), 0.012);let bead = length(vec2<f32>(d - 0.5 * w, z - zt)) - 0.5 * w;- let u = saturate(-d / 0.045);- let cushion = 0.8 * s_extrude(d, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);+ let u = saturate(-dc / 0.045);+ let cushion = 0.8 * s_extrude(dc, z - zt, h + 0.022 * u * (2.0 - u) + bump, 0.75 * h);return s_opu(vec2<f32>(min(tray, bead), 5.0), vec2<f32>(cushion, mat));}@@ -789,43 +784,81 @@ fn s_bump(p: vec2<f32>, c: vec2<f32>, r: f32) -> f32 {return k * k;}-fn s_star_sprout(p: vec3<f32>, shape: i32) -> vec2<f32> {+fn s_dash(p: vec2<f32>, a: vec2<f32>, b0: vec2<f32>, ra: f32, rb: f32) -> f32 {+ let q0 = p - a;+ let b = b0 - a;+ let hb = dot(b, b);+ let q = vec2<f32>(abs(dot(q0, vec2<f32>(b.y, -b.x))), dot(q0, b)) / hb;+ let c = vec2<f32>(sqrt(hb - (ra - rb) * (ra - rb)), ra - rb);+ let k = c.x * q.y - c.y * q.x;+ if k < 0.0 {+ return sqrt(hb * dot(q, q)) - ra;+ }+ if k > c.x {+ return sqrt(hb * (dot(q, q) + 1.0 - 2.0 * q.y)) - rb;+ }+ return dot(c, q) - ra;+}++fn s_rimmed(p: vec3<f32>, theme: i32, shape: i32) -> vec2<f32> {let arrow = shape == 0;- let poly = s_sprout_poly(p.xy, select(7, 0, arrow));+ let g = select(select(2, 1, theme == 0), 0, theme == 4);+ let poly = s_rim_poly(p.xy, select(7 * g + 7, 0, arrow));var body = vec2<f32>(poly, poly);var w = 0.06;var zt = 0.17;var h = 0.03;var bump = 0.022 * s_bump(p.xy, vec2<f32>(0.15, -0.45), 0.3);- var c = vec2<f32>(0.6118, -0.8079);- var rs = 0.1678;- var ang = 0.2443;- var zs = 0.23;if !arrow {- body = s_sprout_glove(p.xy, poly - 0.05);- w = 0.0525;+ body = s_rim_glove(p.xy, g, poly - 0.05);+ w = RIM_GLOVE_R[3 * g + 2].z;zt = 0.185;h = 0.028;bump = 0.03 * s_bump(p.xy, vec2<f32>(0.19, -0.62), 0.28);- c = vec2<f32>(0.15, -0.885);- rs = 0.128;- ang = 0.0;- zs = 0.285;}- var r = s_piece(body.y, body.x, p.z, w, zt, h, bump, 1.0);+ var dc = body.y;+ if arrow && theme == 0 {+ body = body - vec2<f32>(0.015);+ w = 0.045;+ dc = 1.0;+ }+ var r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);+ if theme == 0 {+ if arrow {+ let band = s_extrude(abs(poly + 0.0075) - 0.0225, p.z - zt, 0.028, 0.012);+ r = s_opu(r, vec2<f32>(band, 2.0));+ }+ return r;+ }+ if theme == 2 {+ var dash: f32;+ if arrow {+ let back = s_rim_poly(p.xy + vec2<f32>(0.025, 0.05), 0) - 0.06;+ r = s_opu(r, vec2<f32>(s_extrude(back, p.z - 0.09, 0.04, 0.03), 2.0));+ dash = min(s_dash(p.xy, vec2<f32>(-0.1179, -0.1374), vec2<f32>(-0.1799, -0.0443), 0.028, 0.045),+ s_dash(p.xy, vec2<f32>(-0.1347, -0.2493), vec2<f32>(-0.248, -0.2056), 0.026, 0.042));+ } else {+ dash = min(s_dash(p.xy, vec2<f32>(0.216, -0.1695), vec2<f32>(0.2593, -0.0685), 0.028, 0.042),+ s_dash(p.xy, vec2<f32>(0.3054, -0.2339), vec2<f32>(0.3949, -0.1652), 0.0275, 0.041));+ }+ return s_opu(r, vec2<f32>(s_extrude(dash, p.z - 0.16, 0.035, 0.03), 3.0));+ }if !arrow {let cq = p.xy - vec2<f32>(0.1541, -0.9047);let bq = abs(vec2<f32>(cq.x, cq.y - 0.2066 * cq.x * cq.x)) - vec2<f32>(0.214, 0.0361);let cuff = length(max(bq, vec2<f32>(0.0))) + min(max(bq.x, bq.y), 0.0) - 0.03;- r = s_opu(r, s_piece(cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));+ r = s_opu(r, s_piece(cuff, cuff, cuff, p.z, 0.0477, 0.225, 0.025, 0.0, 2.0));}- let q = s_rot(p.xy - c, ang) / rs;+ let c = select(vec2<f32>(0.15, -0.885), vec2<f32>(0.6118, -0.8079), arrow);+ let rs = select(0.128, 0.1678, arrow);+ let zs = select(0.285, 0.23, arrow);+ let q = s_rot(p.xy - c, select(0.0, 0.2443, arrow)) / rs;let star = (s_star5(q, 0.82, 0.55) - 0.18) * rs;let l1 = s_rot(q - vec2<f32>(-0.33, 1.38), -0.925);let l2 = s_rot(q - vec2<f32>(0.53, 1.37), 0.873);let leaves = min(s_vesica(l1, 0.4296, 0.2626), s_vesica(l2, 0.4296, 0.2626)) * rs;- r = s_opu(r, s_piece(leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));- r = s_opu(r, s_piece(star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, vec2<f32>(0.0), 1.0), 3.0));+ r = s_opu(r, s_piece(leaves, leaves, leaves, p.z, 0.038, zs - 0.02, 0.018, 0.0, 4.0));+ r = s_opu(r, s_piece(star, star, star, p.z, 0.038, zs, 0.022, 0.018 * s_bump(q, vec2<f32>(0.0), 1.0), 3.0));let e = vec3<f32>(abs(q.x) - 0.25, q.y - 0.08, (p.z - zs - 0.056) / rs);return s_opu(r, vec2<f32>(s_ellipsoid(e, vec3<f32>(0.075, 0.13, 0.1)) * rs, 5.0));}@@ -986,25 +1019,7 @@ fn sculpt_proto(p: vec3<f32>, theme: i32, shape: i32) -> vec2<f32> {if theme == 1 {return vec2<f32>(select(s_crystal_hand(p), s_gem_arrow(p), shape == 0), 8.0);}- if theme == 4 {- return s_star_sprout(p, shape);- }- if shape == 0 {- var h = 0.075;- var re = 0.03;- var dome = 0.0;- if theme == 2 {- h = 0.07;- re = 0.06;- dome = 0.035;- }- let body = vec2<f32>(s_arrow_solid(p, h, re, dome), 1.0);- if theme == 0 {- return s_opu(body, vec2<f32>(s_piping(p, SCULPT_HOVER + 2.0 * h - 0.004), 2.0));- }- return body;- }- return s_opu(vec2<f32>(s_glove(p, SCULPT_HAND_ZC), 1.0), vec2<f32>(s_cuff(p, SCULPT_HAND_ZC), 2.0));+ return s_rimmed(p, theme, shape);}fn sculpt_point(q: vec3<f32>) -> vec3<f32> {@@ -1027,7 +1042,7 @@ fn sculpt_eval(q: vec3<f32>, occ: bool) -> vec2<f32> {let dz = abs(p.z - (SCULPT_HOVER + 0.07)) - 0.07;r = vec2<f32>(length(max(vec2<f32>(d2, dz), vec2<f32>(0.0))) + min(max(d2, dz), 0.0), 7.0);} else {- r = sculpt_proto(p, select(theme, 2, occ && theme == 1), shape);+ r = sculpt_proto(p, select(theme, 0, occ && theme == 1), shape);}return vec2<f32>(r.x * sculpt_units(), r.y);}@@ -1121,25 +1136,19 @@ fn s_pixel_colour(p: vec3<f32>, shape: i32) -> vec3<f32> {fn sculpt_material(mat: f32, p: vec3<f32>, theme: i32, shape: i32) -> SculptMat {let primary = mat < 1.5;if theme == 0 {- if shape == 0 && primary {- return SculptMat(s_lin(0.10, 0.10, 0.115), 0.3, 0.2, 0.0, 0.9);- }- if shape == 0 {- return SculptMat(s_lin(0.94, 0.91, 0.84), 0.45, 0.4, 0.2, 0.3);- }- if primary {- return SculptMat(s_lin(0.95, 0.92, 0.85), 0.55, 0.35, 0.35, 0.25);+ if mat < 2.5 {+ return SculptMat(s_lin(0.95, 0.92, 0.85), 0.3, 0.6, 0.35, 0.25);}- return SculptMat(s_lin(0.17, 0.18, 0.22), 0.35, 0.6, 0.0, 0.6);+ return SculptMat(s_lin(0.1, 0.1, 0.11), 0.55, 0.05, 0.0, 0.1);}if theme == 2 {- if shape == 0 {- return SculptMat(s_lin(1.0, 0.40, 0.30), 0.5, 0.45, 0.4, 0.25);+ if (primary && shape == 0) || (mat > 2.5 && mat < 3.5 && shape == 1) {+ return SculptMat(s_lin(1.0, 0.40, 0.30), 0.35, 0.55, 0.35, 0.25);}- if primary {- return SculptMat(s_lin(1.0, 0.79, 0.16), 0.5, 0.45, 0.4, 0.25);+ if mat < 3.5 {+ return SculptMat(s_lin(1.0, 0.80, 0.10), 0.35, 0.55, 0.35, 0.25);}- return SculptMat(s_lin(0.18, 0.20, 0.29), 0.4, 0.5, 0.0, 0.4);+ return SculptMat(s_lin(0.09, 0.13, 0.45), 0.6, 0.25, 0.05, 0.1);}if theme == 4 {if primary && shape == 0 {diff --git a/design/cursors/3d-concept.png b/design/cursors/3d-concept.pngindex fc828101b..4b7a01c98 100644Binary files a/design/cursors/3d-concept.png and b/design/cursors/3d-concept.png differdiff --git a/design/cursors/3d-direction.md b/design/cursors/3d-direction.mdindex e8f4f205b..4deee0245 100644--- a/design/cursors/3d-direction.md+++ b/design/cursors/3d-direction.md@@ -12,18 +12,21 @@ compositor's beveled extrusion.| Theme | Arrow model | Hand model || --- | --- | --- |-| Studio Ink | Matte black body with an ivory piping set in from the edge. | Ivory glove with a dark cuff. |+| Studio Ink | Black rim, a raised ivory band, a recessed satin black field. | Ivory glove cushion in a black rim, black ridges between the fingers. || Prism Glow | Cut crystal: flat facets, a polygonal silhouette, cyan to violet dispersion. | The same glove cut into faceted fingers and palm. |-| Pop Coral | Soft coral rubber with rounded edges and a gentle dome. | Plump yellow rubber glove with a navy cuff. |+| Pop Coral | Coral cushion in a navy rim, a yellow layer behind it offset down-left, two yellow click dashes. | Yellow glove cushion in a navy rim, two coral click dashes. || Pixel Candy | Beveled voxels: a pink face with mint and pale pink edges, purple blocks one step behind. | Voxel glove with the same colours and purple back layer. || Star Sprout | Glossy mint cushion framed by the navy outline of its drawing, carrying a star with a face and two leaves. | Ivory glove cushion in the same navy frame, navy ridges between the fingers, a mint cuff and the same star. |-Star Sprout is the one theme that keeps its drawn outline. It follows its 2D art-(`star-sprout/source.png`) and the 3D reference `star-sprout/3d-reference.png`:-each piece (the arrow or the glove, the cuff, the leaves, the star) is a navy-tray under its silhouette, a rounded navy bead along the stroke and a puffy-colour cushion inside it. The cuff, the leaves and the star stand in front of-the body; the star's eyes are two navy ovals.+Studio Ink, Pop Coral and Star Sprout keep their drawn outline, as in+`3d-concept.png` (and `star-sprout/3d-reference.png` for the Star Sprout hand).+Each piece is a tray in the outline colour under its silhouette, a rounded bead+along the stroke and a puffy colour cushion inside it; the grooves between the+fingers become ridges of the outline colour. The three arrows share one polygon+and the three gloves one construction, each glove measured on its own drawing+(`RIM_POLY`, `RIM_GLOVE`). What stands in front is theme-specific: Studio Ink's+ivory band, Pop Coral's yellow layer and click dashes, Star Sprout's cuff, star,+leaves and eyes.All models share one close lamp: a gradient and a highlight even on flat faces,soft self shadows, ambient occlusion and a studio environment in thediff --git a/design/cursors/README.md b/design/cursors/README.mdindex 59322ec7f..bf564c1a4 100644--- a/design/cursors/README.md+++ b/design/cursors/README.md@@ -26,6 +26,7 @@ receive the shared 3D extrusion.`contact-sheet.png` shows the sprites enlarged on a light background;`dark-32px.png` shows them at their 32-pixel reference size on a dark background.-The 3D modeling direction and concept image are in `3d-direction.md` and-`3d-concept.png`; Star Sprout's own 3D reference is `star-sprout/3d-reference.png`.+The 3D modeling direction and the reference sheet the models follow are in+`3d-direction.md` and `3d-concept.png`; `star-sprout/3d-reference.png` is a closer+view of the Star Sprout hand.The consolidated acceptance list is in `requirements.md`.diff --git a/design/cursors/requirements.md b/design/cursors/requirements.mdindex b9507a2e2..44f189fc7 100644--- a/design/cursors/requirements.md+++ b/design/cursors/requirements.md@@ -28,7 +28,7 @@ their 3D models.- A rounded extrusion of the PNG silhouette remains the fallback for cursorstates that do not have a dedicated theme model. The five replacement packsadd style-specific volume: a glove with separate fingers, cut crystal facets,- puffy rubber, beveled voxels, and cushions set in a navy rim.+ beveled voxels, and cushions set in the rim of their drawn outline.- Model the arrow and hand separately for every theme. Do not apply onecontour, material, or roundness rule to all designs.- Preserve the cursor hotspot through hover, tilt, yaw, click, and size changes.@@ -40,9 +40,9 @@ their 3D models.| Theme | Arrow | Hand || --- | --- | --- |-| Studio Ink | Matte black sculpted body; ivory mark becomes a piping set in from the edge. | Ivory glove with a convex palm and separate fingers; remove the dark outline. |+| Studio Ink | Black rim, raised ivory band, recessed satin black field. | Ivory glove cushion; the black outline stays as a physical rim, with black ridges between the fingers. || Prism Glow | Translucent faceted crystal; no navy ink contour. | Crystal palm and distinct faceted fingers; no navy ink contour. |-| Pop Coral | Rounded coral rubber; omit the yellow offset and navy rim. | Plump yellow rubber glove; no navy outline, accents become physical details. |+| Pop Coral | Coral cushion in a navy rim; the yellow offset becomes a layer behind it; the click dashes become physical pieces. | Yellow glove cushion in a navy rim; the coral click dashes become physical pieces. || Pixel Candy | Keep the stepped voxel form; purple is side/back blocks, not a flat outline. | Stepped voxel fingers and palm; preserve purple as physical side/back blocks. || Star Sprout | Puffy mint cushion; the navy outline stays as a physical rim (a navy tray and a rounded bead) around it, the star and its leaves in front, each in its own navy rim. | Puffy ivory glove in the same navy rim, with navy ridges between the fingers; separate mint cuff framed in navy; the star and leaves in front, as in `star-sprout/3d-reference.png`. |@@ -53,9 +53,10 @@ becomes an inlay, side material, separate piece, or disappears.## Review references- `contact-sheet.png`: 2D PNG themes.-- `3d-concept.png`: visual direction only, not rendered by the app.-- `star-sprout/3d-reference.png`: the 3D reference Star Sprout's models follow- (navy rim kept, puffy cushions); also not rendered by the app.+- `3d-concept.png`: the 3D reference sheet the ten models follow, not+ rendered by the app.+- `star-sprout/3d-reference.png`: a closer view of the Star Sprout hand; also+ not rendered by the app.- `3d-direction.md`: per-theme modeling notes.- `README.md`: source PNG and preparation workflow.diff --git a/docs/3d-effects-v2.md b/docs/3d-effects-v2.mdindex ec06d91f5..732a9561b 100644--- a/docs/3d-effects-v2.md+++ b/docs/3d-effects-v2.md@@ -288,11 +288,10 @@ du bord (0,48 au pire), sous 1 texel au-delà (le flou arrondit les crêtes).### B.3 bis Les curseurs sculptésLa flèche et la main des cinq thèmes d'origine sont **modélisées à la main**, en fonctions de-distance signée écrites dans les trois shaders (`sculpt_proto`, `sculpt_material`) : capsules et-unions lissées pour les gants, extrusion arrondie et bombée pour les flèches, voxels biseautés-pour Pixel Candy, polyèdres taillés pour le cristal de Prism Glow, et pour Star Sprout des pièces-qui gardent le trait marine de son dessin : un plateau et un jonc marine, un coussin de couleur-dedans (`s_star_sprout`). Le PNG du thème reste l'art en+distance signée écrites dans les trois shaders (`sculpt_proto`, `sculpt_material`) : voxels+biseautés pour Pixel Candy, polyèdres taillés pour le cristal de Prism Glow, et pour Studio Ink,+Pop Coral et Star Sprout des pièces qui gardent le trait de leur dessin : un plateau et un jonc de+la couleur du trait, un coussin de couleur dedans (`s_rimmed`). Le PNG du thème reste l'art en2D. En 3D, la scène nomme le modèle ; `sculpt.rs` en tient la boîte, qui pose le hotspot (pointede la flèche, bout de l'index), règle la garde au sol et borne la boîte de dessin. Emplacement ducbuffer : `trail_a` = [modèle, épaisseur sous z = 0, hauteur au-dessus, 0] (`cursor_model_cb`).@@ -302,11 +301,11 @@ cbuffer : `trail_a` = [modèle, épaisseur sous z = 0, hauteur au-dessus, 0] (`cla matière ; occlusion ambiante, ombre propre douce vers la lampe, studio dans les reflets,liseré de Fresnel ; tone map Khronos PBR Neutral.- **Ombre sur l'écran** : celle de B.3. Le cristal et les voxels donnent de mauvaises distances- loin de leur surface (bornes de plans, champ de grille) : l'ombre prend la forme lisse de Pop- Coral pour le cristal et le contour extrudé pour les voxels.+ loin de leur surface (bornes de plans, champ de grille) : l'ombre prend la forme cerclée de+ Studio Ink, sans ornement, pour le cristal et le contour extrudé pour les voxels.- **Coût de compilation** : FXC recopie chaque appel. La marche, les normales, l'occlusion et les- ombres forment donc une seule boucle à étapes avec un seul appel au modèle, et Star Sprout un- seul appel pour ses deux formes.+ ombres forment donc une seule boucle à étapes avec un seul appel au modèle, et les thèmes+ cerclés un seul appel pour leurs deux formes.### B.4 La caméra et l'ancrage