Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(cursor): rebuild the Star Sprout 3D models after its reference render

Claudee40a09ca1a58
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rs
index 198e6e637..d9774f8bd 100644
--- a/crates/compositor/src/compositor_linux.rs
+++ b/crates/compositor/src/compositor_linux.rs
@@ -5740,6 +5740,54 @@ 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.
+ #[test]
+ fn the_star_sprout_models_keep_the_navy_outline_of_their_art() {
+ 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);
+ let blue = FakeFrame::from_planes(&gpu, 640, 360, &y, &uv);
+ let (y, uv) = model_screen_planes(true);
+ let orange = FakeFrame::from_planes(&gpu, 640, 360, &y, &uv);
+ 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"] {
+ let still = model_track(state, false, 0.5);
+ let json = extruded
+ .replace(&format!(r#"/{state}.png","#), &format!(r#"/{state}.png","sculpt":"star-sprout/{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);
+ 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) });
+ }
+ 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"));
+ }
+ if body < 0.2 {
+ failures.push(format!("{state}: {body:.3} de couleur du corps"));
+ }
+ if yellow < 0.03 {
+ failures.push(format!("{state}: {yellow:.3} d'etoile jaune"));
+ }
+ }
+ assert!(failures.is_empty(), "{failures:#?}");
+ }
+
/// Pendant de `tests/cursor_tap_render.rs` (Windows) : sous un lissage qui traine loin
/// derriere la souris, la pointe du modele se pose sur la pastille rouge du clic, et l'anneau
/// de l'impact (mode 16) l'entoure, a plat et incline.
diff --git a/crates/compositor/src/sculpt.rs b/crates/compositor/src/sculpt.rs
index de9c4e65a..9edc9d307 100644
--- a/crates/compositor/src/sculpt.rs
+++ b/crates/compositor/src/sculpt.rs
@@ -1,8 +1,9 @@
//! Curseurs sculptés : la flèche et la main des cinq thèmes d'origine, modelées en volumes dans les
//! shaders (mode 15, `sculpt_proto`) au lieu d'extruder leur PNG — capsules et unions lissées,
-//! extrusions arrondies, voxels, polyèdres taillés. Ce module en tient ce que la géométrie doit
-//! savoir côté CPU : l'identifiant que lit le shader, et la boîte du modèle (`SpriteShape`) qui pose
-//! le hotspot, règle la garde au sol et borne la boîte de dessin.
+//! extrusions arrondies, voxels, polyèdres taillés, pièces cerclées du trait de leur dessin (Star
+//! Sprout). Ce module en tient ce que la géométrie doit savoir côté CPU : l'identifiant que lit le
+//! shader, et la boîte du modèle (`SpriteShape`) qui pose le hotspot, règle la garde au sol et
+//! borne la boîte de dessin.
//!
//! Les formes sont écrites dans le repère du PROTOTYPE où elles ont été dessinées : hauteur du
//! curseur 1, x à droite, y VERS LE HAUT, z vers la caméra, l'écran en z = 0. Les constantes
@@ -24,29 +25,45 @@ const ZREF_ARROW: f32 = 0.2;
const ZREF_HAND: f32 = 0.185;
/// Le dessous de tous les modèles, dans le prototype.
const Z_LOW: f32 = 0.05;
-/// Le plus haut : la table de la flèche taillée, l'étoile de Star Sprout sur la manchette.
-const Z_HIGH_ARROW: f32 = 0.29;
+/// 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 cinq variantes :
-/// couche violette des voxels, étoile, cristal compris. Leur hauteur est celle du sprite, 1 / SCULPT_SCALE :
+/// 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`).
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_SPROUT_ARROW: [f32; 3] = [-0.08, 0.87, 0.03];
+const BOX_SPROUT_HAND: [f32; 3] = [-0.33, 0.56, 0.03];
/// Dans l'ordre des identifiants du shader.
const THEMES: [&str; 5] = ["studio-ink", "prism-glow", "pop-coral", "pixel-candy", "star-sprout"];
/// 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.
+/// 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.
fn silhouette_top(theme: usize, arrow: bool) -> f32 {
match (THEMES[theme], arrow) {
("pixel-candy", _) => 0.0625,
+ ("star-sprout", _) => 0.0,
(_, true) => 0.03,
(_, false) => 0.0,
}
}
+/// 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) {
+ ("star-sprout", true) => BOX_SPROUT_ARROW,
+ ("star-sprout", false) => BOX_SPROUT_HAND,
+ (_, true) => BOX_ARROW,
+ (_, false) => BOX_HAND,
+ }
+}
+
/// Le curseur sculpté que nomme la scène (`"<thème>/<état>"`, cf. `resolveCursorSprites`), sous
/// la forme que le mode 15 attend. `None` pour un nom inconnu : l'appelant extrude le sprite.
pub fn sculpted_shape(name: &str) -> Option<SpriteShape> {
@@ -57,7 +74,7 @@ pub fn sculpted_shape(name: &str) -> Option<SpriteShape> {
"pointer" => false,
_ => return None,
};
- let [x0, x1, y1] = if arrow { BOX_ARROW } else { BOX_HAND };
+ let [x0, x1, y1] = model_box(theme, arrow);
let (zref, z_high) = if arrow { (ZREF_ARROW, Z_HIGH_ARROW) } else { (ZREF_HAND, Z_HIGH_HAND) };
let s = SCULPT_SCALE;
// Repère du modèle : y vers le bas, le coin haut-gauche de la boîte est donc (x0, y1).
diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlsl
index 30fbf1bd5..2d0dcf980 100644
--- a/crates/compositor/src/shaders.hlsl
+++ b/crates/compositor/src/shaders.hlsl
@@ -588,7 +588,8 @@ static const float MODEL_CONTACT_ALPHA = 0.5;
// 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 yeux, 6 face des voxels, 7 couche violette, 8 cristal.
+// 3 étoile, 4 feuilles, 5 marine de Star Sprout (trait 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;
@@ -695,6 +696,15 @@ float s_star5(float2 p, float r, float rf)
return length(p - ba * h) * sign(p.y * ba.x - p.x * ba.y);
}
+// Lentille : deux disques de rayon r aux centres à ±d sur x, une feuille pointue à ses deux bouts
+// (0, ±sqrt(r² - d²)).
+float s_vesica(float2 p, float r, float d)
+{
+ p = abs(p);
+ float b = sqrt(r * r - d * 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)
@@ -734,20 +744,129 @@ float s_cuff(float3 p, float zc)
return s_extrude(e, q.y, 0.07, 0.06);
}
-// L'étoile de Star Sprout, face à la caméra, centrée en c : son visage et ses deux feuilles.
-float2 s_sprout(float3 p, float3 c)
+// 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] = {
+ 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)
+};
+
+// Distance signée au polygone de SPROUT_POLY qui commence en `base` (cf. `s_arrow2`).
+float s_sprout_poly(float2 p, int base)
{
- float3 q = p - c;
- float st2 = s_star5(q.xy, 0.125, 0.52) - 0.022;
- float2 r = float2(s_extrude(st2, q.z, 0.038, 0.034), 3.0);
- float3 e = float3(abs(q.x) - 0.032, q.y + 0.005, q.z - 0.036);
- r = s_opu(r, float2(length(e) - 0.0135, 5.0));
- float3 l1 = q - float3(-0.04, 0.15, 0.0);
- l1.xy = s_rot(l1.xy, -0.6);
- float3 l2 = q - float3(0.045, 0.155, 0.0);
- l2.xy = s_rot(l2.xy, 0.7);
- float leaves = min(s_ellipsoid(l1, float3(0.03, 0.058, 0.02)), s_ellipsoid(l2, float3(0.03, 0.058, 0.02)));
- return s_opu(r, float2(leaves, 4.0));
+ float d = dot(p - SPROUT_POLY[base], p - SPROUT_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 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 c2 = e.x * w.y > e.y * w.x;
+ if ((c0 && c1 && c2) || (!c0 && !c1 && !c2))
+ {
+ s = -s;
+ }
+ j = i;
+ }
+ 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)
+{
+ 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);
+ return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));
+}
+
+// Bosse de rayon r en c, 1 au centre et 0 au bord : un coussin bombé sans pli. Une hauteur tirée
+// de la distance au bord plierait le coussin sur l'axe médian de sa silhouette.
+float s_bump(float2 p, float2 c, float r)
+{
+ float k = saturate(1.0 - dot(p - c, p - c) / (r * 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)
+{
+ bool arrow = shape == 0;
+ float poly = s_sprout_poly(p.xy, arrow ? 0 : 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;
+ 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);
+ 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));
+ }
+ float2 q = s_rot(p.xy - c, ang) / 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));
+ // 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));
}
// Pixel Candy : une ligne par entier, bit c = colonne c, ligne 0 juste sous la pointe. La flèche
@@ -954,8 +1073,11 @@ float2 sculpt_proto(float3 p, int theme, int shape)
{
return float2(shape == 0 ? s_gem_arrow(p) : s_crystal_hand(p), 8.0);
}
- float2 body;
- float3 star;
+ // 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;
@@ -965,27 +1087,14 @@ float2 sculpt_proto(float3 p, int theme, int shape)
re = 0.06;
dome = 0.035;
}
- if (theme == 4)
- {
- h = 0.07;
- re = 0.055;
- dome = 0.025;
- }
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));
}
- body = r;
- star = float3(0.57, -0.86, SCULPT_HOVER + 2.0 * h + dome);
- }
- else
- {
- body = s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));
- star = float3(0.185, -0.93, SCULPT_HAND_ZC + 0.15);
+ return r;
}
- // L'étoile de Star Sprout : un seul appel pour les deux formes (FXC recopie chaque appel).
- return theme == 4 ? s_opu(body, s_sprout(p, star)) : body;
+ return s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));
}
// Repère du modèle -> prototype. L'écrasement du clic ne raccourcit que z, autour du hotspot.
@@ -1173,12 +1282,13 @@ SculptMat sculpt_material(float mat, float3 p, int theme, int shape)
}
if (theme == 4)
{
- if (primary && shape == 0) return s_mat(s_lin(0.62, 0.91, 0.78), 0.22, 0.8, 0.25, 0.6);
- if (primary) return s_mat(s_lin(0.96, 0.94, 0.88), 0.5, 0.35, 0.35, 0.25);
- if (mat < 2.5) return s_mat(s_lin(0.62, 0.91, 0.78), 0.25, 0.7, 0.25, 0.5);
- if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.20), 0.3, 0.6, 0.3, 0.4);
- if (mat < 4.5) return s_mat(s_lin(0.38, 0.80, 0.55), 0.35, 0.5, 0.35, 0.3);
- return s_mat(s_lin(0.16, 0.12, 0.10), 0.2, 0.8, 0.0, 0.5);
+ // Coussins laqués ; le marine satiné, un reflet large et sombre plutôt qu'un filet blanc.
+ if (primary && shape == 0) return s_mat(s_lin(0.68, 0.93, 0.80), 0.25, 0.7, 0.3, 0.3);
+ if (primary) return s_mat(s_lin(0.97, 0.95, 0.90), 0.3, 0.6, 0.35, 0.25);
+ if (mat < 2.5) return s_mat(s_lin(0.52, 0.87, 0.78), 0.25, 0.7, 0.3, 0.3);
+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.75, 0.25), 0.25, 0.7, 0.3, 0.3);
+ if (mat < 4.5) return s_mat(s_lin(0.62, 0.92, 0.72), 0.3, 0.6, 0.3, 0.35);
+ return s_mat(s_lin(0.07, 0.15, 0.33), 0.7, 0.15, 0.05, 0.08);
}
if (mat < 6.5) return s_mat(s_pixel_colour(p, shape), 0.45, 0.35, 0.15, 0.2);
return s_mat(s_lin(0.36, 0.18, 0.54), 0.45, 0.35, 0.1, 0.2);
diff --git a/crates/compositor/src/shaders.metal b/crates/compositor/src/shaders.metal
index 6c019c3ec..9ae9d7887 100644
--- a/crates/compositor/src/shaders.metal
+++ b/crates/compositor/src/shaders.metal
@@ -688,6 +688,13 @@ static float s_star5(float2 p, float r, float rf)
return length(p - ba * h) * sign(p.y * ba.x - p.x * ba.y);
}
+static float s_vesica(float2 p, float r, float d)
+{
+ p = abs(p);
+ float b = sqrt(r * r - d * 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;
@@ -722,17 +729,104 @@ static float s_cuff(float3 p, float zc)
return s_extrude(e, q.y, 0.07, 0.06);
}
-static float2 s_sprout(float3 p, float3 c)
+// Star Sprout (cf. HLSL) : la fleche menthe et sa paume, polygones du dessin 2D.
+constant float2 SPROUT_POLY[14] = {
+ 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)
+};
+
+static float s_sprout_poly(float2 p, int base)
+{
+ float d = dot(p - SPROUT_POLY[base], p - SPROUT_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 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 c2 = e.x * w.y > e.y * w.x;
+ if ((c0 && c1 && c2) || (!c0 && !c1 && !c2))
+ {
+ s = -s;
+ }
+ j = i;
+ }
+ return s * sqrt(d);
+}
+
+static 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)));
+}
+
+static float2 s_piece(float d, 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);
+ return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));
+}
+
+inline float s_bump(float2 p, float2 c, float r)
{
- float3 q = p - c;
- float st2 = s_star5(q.xy, 0.125, 0.52) - 0.022;
- float2 r = float2(s_extrude(st2, q.z, 0.038, 0.034), 3.0);
- float3 e = float3(abs(q.x) - 0.032, q.y + 0.005, q.z - 0.036);
- r = s_opu(r, float2(length(e) - 0.0135, 5.0));
- float3 l1 = float3(s_rot(q.xy - float2(-0.04, 0.15), -0.6), q.z);
- float3 l2 = float3(s_rot(q.xy - float2(0.045, 0.155), 0.7), q.z);
- float leaves = min(s_ellipsoid(l1, float3(0.03, 0.058, 0.02)), s_ellipsoid(l2, float3(0.03, 0.058, 0.02)));
- return s_opu(r, float2(leaves, 4.0));
+ float k = saturate(1.0 - dot(p - c, p - c) / (r * r));
+ return k * k;
+}
+
+static float2 s_star_sprout(float3 p, int shape)
+{
+ bool arrow = shape == 0;
+ float poly = s_sprout_poly(p.xy, arrow ? 0 : 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;
+ 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);
+ 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));
+ }
+ float2 q = s_rot(p.xy - c, ang) / 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));
+ 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));
}
// Pixel Candy : une ligne par entier, bit c = colonne c (cf. HLSL et `sculpt.rs`).
@@ -914,8 +1008,10 @@ static float2 sculpt_proto(float3 p, int theme, int shape)
{
return float2(shape == 0 ? s_gem_arrow(p) : s_crystal_hand(p), 8.0);
}
- float2 body;
- float3 star;
+ if (theme == 4)
+ {
+ return s_star_sprout(p, shape);
+ }
if (shape == 0)
{
float h = 0.075, re = 0.03, dome = 0.0;
@@ -925,25 +1021,14 @@ static float2 sculpt_proto(float3 p, int theme, int shape)
re = 0.06;
dome = 0.035;
}
- if (theme == 4)
- {
- h = 0.07;
- re = 0.055;
- dome = 0.025;
- }
- body = float2(s_arrow_solid(p, h, re, dome), 1.0);
+ 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));
}
- star = float3(0.57, -0.86, SCULPT_HOVER + 2.0 * h + dome);
- }
- else
- {
- body = s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));
- star = float3(0.185, -0.93, SCULPT_HAND_ZC + 0.15);
+ return body;
}
- return theme == 4 ? s_opu(body, s_sprout(p, star)) : body;
+ return s_opu(float2(s_glove(p, SCULPT_HAND_ZC), 1.0), float2(s_cuff(p, SCULPT_HAND_ZC), 2.0));
}
inline float3 sculpt_point(float3 q, constant Layer &layer)
@@ -1106,12 +1191,12 @@ static SculptMat sculpt_material(float mat, float3 p, int theme, int shape)
}
if (theme == 4)
{
- if (primary && shape == 0) return s_mat(s_lin(0.62, 0.91, 0.78), 0.22, 0.8, 0.25, 0.6);
- if (primary) return s_mat(s_lin(0.96, 0.94, 0.88), 0.5, 0.35, 0.35, 0.25);
- if (mat < 2.5) return s_mat(s_lin(0.62, 0.91, 0.78), 0.25, 0.7, 0.25, 0.5);
- if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.20), 0.3, 0.6, 0.3, 0.4);
- if (mat < 4.5) return s_mat(s_lin(0.38, 0.80, 0.55), 0.35, 0.5, 0.35, 0.3);
- return s_mat(s_lin(0.16, 0.12, 0.10), 0.2, 0.8, 0.0, 0.5);
+ if (primary && shape == 0) return s_mat(s_lin(0.68, 0.93, 0.80), 0.25, 0.7, 0.3, 0.3);
+ if (primary) return s_mat(s_lin(0.97, 0.95, 0.90), 0.3, 0.6, 0.35, 0.25);
+ if (mat < 2.5) return s_mat(s_lin(0.52, 0.87, 0.78), 0.25, 0.7, 0.3, 0.3);
+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.75, 0.25), 0.25, 0.7, 0.3, 0.3);
+ if (mat < 4.5) return s_mat(s_lin(0.62, 0.92, 0.72), 0.3, 0.6, 0.3, 0.35);
+ return s_mat(s_lin(0.07, 0.15, 0.33), 0.7, 0.15, 0.05, 0.08);
}
if (mat < 6.5) return s_mat(s_pixel_colour(p, shape), 0.45, 0.35, 0.15, 0.2);
return s_mat(s_lin(0.36, 0.18, 0.54), 0.45, 0.35, 0.1, 0.2);
diff --git a/crates/compositor/src/vk_shaders/layer.wgsl b/crates/compositor/src/vk_shaders/layer.wgsl
index 2eb46a9b3..3358f221c 100644
--- a/crates/compositor/src/vk_shaders/layer.wgsl
+++ b/crates/compositor/src/vk_shaders/layer.wgsl
@@ -698,6 +698,12 @@ fn s_star5(p0: vec2<f32>, r: f32, rf: f32) -> f32 {
return length(p - ba * h) * sign(p.y * ba.x - p.x * ba.y);
}
+fn s_vesica(p0: vec2<f32>, r: f32, d: f32) -> f32 {
+ let p = abs(p0);
+ let b = sqrt(r * r - d * d);
+ 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);
@@ -728,16 +734,100 @@ fn s_cuff(p: vec3<f32>, zc: f32) -> f32 {
return s_extrude(e, q.y, 0.07, 0.06);
}
-fn s_sprout(p: vec3<f32>, c: vec3<f32>) -> vec2<f32> {
- let q = p - c;
- let st2 = s_star5(q.xy, 0.125, 0.52) - 0.022;
- var r = vec2<f32>(s_extrude(st2, q.z, 0.038, 0.034), 3.0);
- let e = vec3<f32>(abs(q.x) - 0.032, q.y + 0.005, q.z - 0.036);
- r = s_opu(r, vec2<f32>(length(e) - 0.0135, 5.0));
- let l1 = vec3<f32>(s_rot(q.xy - vec2<f32>(-0.04, 0.15), -0.6), q.z);
- let l2 = vec3<f32>(s_rot(q.xy - vec2<f32>(0.045, 0.155), 0.7), q.z);
- let leaves = min(s_ellipsoid(l1, vec3<f32>(0.03, 0.058, 0.02)), s_ellipsoid(l2, vec3<f32>(0.03, 0.058, 0.02)));
- return s_opu(r, vec2<f32>(leaves, 4.0));
+// Star Sprout (cf. HLSL) : la fleche menthe et sa paume, polygones du dessin 2D.
+const SPROUT_POLY = array<vec2<f32>, 14>(
+ 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)
+);
+
+fn s_sprout_poly(p: vec2<f32>, base: i32) -> f32 {
+ var d = dot(p - SPROUT_POLY[base], p - SPROUT_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 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 c2 = e.x * w.y > e.y * w.x;
+ if (c0 && c1 && c2) || (!c0 && !c1 && !c2) {
+ s = -s;
+ }
+ j = i;
+ }
+ 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> {
+ 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);
+ return s_opu(vec2<f32>(min(tray, bead), 5.0), vec2<f32>(cushion, mat));
+}
+
+fn s_bump(p: vec2<f32>, c: vec2<f32>, r: f32) -> f32 {
+ let k = saturate(1.0 - dot(p - c, p - c) / (r * r));
+ return k * k;
+}
+
+fn s_star_sprout(p: vec3<f32>, shape: i32) -> vec2<f32> {
+ let arrow = shape == 0;
+ let poly = s_sprout_poly(p.xy, select(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;
+ 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);
+ 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));
+ }
+ let q = s_rot(p.xy - c, ang) / 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));
+ 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));
}
// Pixel Candy : une ligne par entier, bit c = colonne c (cf. HLSL et `sculpt.rs`).
@@ -896,8 +986,9 @@ 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);
}
- var body: vec2<f32>;
- var star: vec3<f32>;
+ if theme == 4 {
+ return s_star_sprout(p, shape);
+ }
if shape == 0 {
var h = 0.075;
var re = 0.03;
@@ -907,24 +998,13 @@ fn sculpt_proto(p: vec3<f32>, theme: i32, shape: i32) -> vec2<f32> {
re = 0.06;
dome = 0.035;
}
- if theme == 4 {
- h = 0.07;
- re = 0.055;
- dome = 0.025;
- }
- body = vec2<f32>(s_arrow_solid(p, h, re, dome), 1.0);
+ let body = vec2<f32>(s_arrow_solid(p, h, re, dome), 1.0);
if theme == 0 {
- body = s_opu(body, vec2<f32>(s_piping(p, SCULPT_HOVER + 2.0 * h - 0.004), 2.0));
+ return s_opu(body, vec2<f32>(s_piping(p, SCULPT_HOVER + 2.0 * h - 0.004), 2.0));
}
- star = vec3<f32>(0.57, -0.86, SCULPT_HOVER + 2.0 * h + dome);
- } else {
- body = s_opu(vec2<f32>(s_glove(p, SCULPT_HAND_ZC), 1.0), vec2<f32>(s_cuff(p, SCULPT_HAND_ZC), 2.0));
- star = vec3<f32>(0.185, -0.93, SCULPT_HAND_ZC + 0.15);
- }
- if theme == 4 {
- return s_opu(body, s_sprout(p, star));
+ return body;
}
- 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));
}
fn sculpt_point(q: vec3<f32>) -> vec3<f32> {
@@ -1063,21 +1143,21 @@ fn sculpt_material(mat: f32, p: vec3<f32>, theme: i32, shape: i32) -> SculptMat
}
if theme == 4 {
if primary && shape == 0 {
- return SculptMat(s_lin(0.62, 0.91, 0.78), 0.22, 0.8, 0.25, 0.6);
+ return SculptMat(s_lin(0.68, 0.93, 0.80), 0.25, 0.7, 0.3, 0.3);
}
if primary {
- return SculptMat(s_lin(0.96, 0.94, 0.88), 0.5, 0.35, 0.35, 0.25);
+ return SculptMat(s_lin(0.97, 0.95, 0.90), 0.3, 0.6, 0.35, 0.25);
}
if mat < 2.5 {
- return SculptMat(s_lin(0.62, 0.91, 0.78), 0.25, 0.7, 0.25, 0.5);
+ return SculptMat(s_lin(0.52, 0.87, 0.78), 0.25, 0.7, 0.3, 0.3);
}
if mat < 3.5 {
- return SculptMat(s_lin(1.0, 0.80, 0.20), 0.3, 0.6, 0.3, 0.4);
+ return SculptMat(s_lin(1.0, 0.75, 0.25), 0.25, 0.7, 0.3, 0.3);
}
if mat < 4.5 {
- return SculptMat(s_lin(0.38, 0.80, 0.55), 0.35, 0.5, 0.35, 0.3);
+ return SculptMat(s_lin(0.62, 0.92, 0.72), 0.3, 0.6, 0.3, 0.35);
}
- return SculptMat(s_lin(0.16, 0.12, 0.10), 0.2, 0.8, 0.0, 0.5);
+ return SculptMat(s_lin(0.07, 0.15, 0.33), 0.7, 0.15, 0.05, 0.08);
}
if mat < 6.5 {
return SculptMat(s_pixel_colour(p, shape), 0.45, 0.35, 0.15, 0.2);
diff --git a/design/cursors/3d-direction.md b/design/cursors/3d-direction.md
index 6333c23d0..e8f4f205b 100644
--- a/design/cursors/3d-direction.md
+++ b/design/cursors/3d-direction.md
@@ -16,7 +16,14 @@ compositor's beveled extrusion.
| 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. |
| 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 ceramic carrying a star with a face and two leaves. | Ivory glove with a mint cuff and the same star. |
+| 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.
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 the
diff --git a/design/cursors/README.md b/design/cursors/README.md
index b3a21cd3c..59322ec7f 100644
--- a/design/cursors/README.md
+++ b/design/cursors/README.md
@@ -27,5 +27,5 @@ 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`.
+`3d-concept.png`; Star Sprout's own 3D reference is `star-sprout/3d-reference.png`.
The consolidated acceptance list is in `requirements.md`.
diff --git a/design/cursors/requirements.md b/design/cursors/requirements.md
index 3274014c7..b9507a2e2 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 cursor
states that do not have a dedicated theme model. The five replacement packs
add style-specific volume: a glove with separate fingers, cut crystal facets,
- puffy rubber, beveled voxels, and ceramic accents.
+ puffy rubber, beveled voxels, and cushions set in a navy rim.
- Model the arrow and hand separately for every theme. Do not apply one
contour, material, or roundness rule to all designs.
- Preserve the cursor hotspot through hover, tilt, yaw, click, and size changes.
@@ -44,7 +44,7 @@ their 3D models.
| 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. |
| 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 | Soft mint ceramic; no heavy blue outline, raised star and leaves. | Rounded ivory glove with no blue outline; separate mint cuff, star, and leaves. |
+| 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`. |
The 2D PNG may keep a drawn contour where it helps readability. Its contour
must not be copied blindly onto the 3D material: decide per model whether it
@@ -54,6 +54,8 @@ becomes an inlay, side material, separate piece, or disappears.
- `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-direction.md`: per-theme modeling notes.
- `README.md`: source PNG and preparation workflow.
diff --git a/design/cursors/star-sprout/3d-reference.png b/design/cursors/star-sprout/3d-reference.png
new file mode 100644
index 000000000..760ed6b62
Binary files /dev/null and b/design/cursors/star-sprout/3d-reference.png differ
diff --git a/docs/3d-effects-v2.md b/docs/3d-effects-v2.md
index 978cd1a80..ec06d91f5 100644
--- a/docs/3d-effects-v2.md
+++ b/docs/3d-effects-v2.md
@@ -290,7 +290,9 @@ du bord (0,48 au pire), sous 1 texel au-delà (le flou arrondit les crêtes).
La 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. Le PNG du thème reste l'art en
+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
2D. En 3D, la scène nomme le modèle ; `sculpt.rs` en tient la boîte, qui pose le hotspot (pointe
de la flèche, bout de l'index), règle la garde au sol et borne la boîte de dessin. Emplacement du
cbuffer : `trail_a` = [modèle, épaisseur sous z = 0, hauteur au-dessus, 0] (`cursor_model_cb`).
@@ -303,8 +305,8 @@ cbuffer : `trail_a` = [modèle, épaisseur sous z = 0, hauteur au-dessus, 0] (`c
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.
- **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 l'étoile de Star
- Sprout un seul appel pour les deux formes.
+ ombres forment donc une seule boucle à étapes avec un seul appel au modèle, et Star Sprout un
+ seul appel pour ses deux formes.
### B.4 La caméra et l'ancrage