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): make Pop Coral cut paper with flat tops

Claude54614e50ba89
diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlsl
index 7b15fec55..26f5414f2 100644
--- a/crates/compositor/src/shaders.hlsl
+++ b/crates/compositor/src/shaders.hlsl
@@ -779,6 +779,17 @@ float2 s_piece(float d, float dc, float sil, float z, float w, float zt, float h
return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));
}
+// Pop Coral est du papier découpé : des feuilles à plat, au dessus plat et au bord à peine
+// cassé. La feuille marine sous la silhouette élargie du trait `w`, de SCULPT_HOVER à 0,15 ; la
+// feuille de couleur (matière 1) posée dessus, 0,02 d'épaisseur, découpée des rainures entre les
+// doigts qui laissent voir la marine.
+float2 s_paper(float d, float sil, float z, float w)
+{
+ float navy = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + 0.15), 0.5 * (0.15 - SCULPT_HOVER), 0.006);
+ float sheet = s_extrude(d, z - 0.16, 0.01, 0.004);
+ return s_opu(float2(navy, 5.0), float2(sheet, 1.0));
+}
+
// 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)
@@ -809,7 +820,8 @@ float s_dash(float2 p, float2 a, float2 b, float ra, float rb)
// 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
+// dessus du plateau. Le gant ivoire, jaune ou ivoire. Pop Coral est en papier découpé
+// (`s_paper`), ses calques et ses tirets aussi : des feuilles au dessus plat. Puis ce que chacun ajoute devant : le calque
// jaune de la flèche, le calque corail du gant 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
@@ -858,7 +870,8 @@ float2 s_rimmed(float3 p, int theme, int shape)
w = 0.045;
dc = 1.0;
}
- float2 r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);
+ float2 r = theme == 2 ? s_paper(body.y, body.x, p.z, w)
+ : s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);
if (theme == 0)
{
if (arrow)
@@ -875,17 +888,17 @@ float2 s_rimmed(float3 p, int theme, int shape)
{
// 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));
+ r = s_opu(r, float2(s_extrude(back, p.z - 0.08, 0.03, 0.006), 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
{
- r = s_opu(r, float2(s_extrude(back, p.z - 0.09, 0.04, 0.03), 3.0));
+ r = s_opu(r, float2(s_extrude(back, p.z - 0.08, 0.03, 0.006), 3.0));
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));
+ return s_opu(r, float2(s_extrude(dash, p.z - 0.11, 0.06, 0.006), 3.0));
}
if (!arrow)
{
@@ -1234,9 +1247,9 @@ SculptMat sculpt_material(float mat, float3 p, int theme, int shape)
{
// Corail : la flèche, le calque 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 ((primary && shape == 0) || (mat > 2.5 && mat < 3.5 && shape == 1)) return s_mat(s_lin(1.0, 0.40, 0.30), 0.85, 0.08, 0.15, 0.03);
+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.10), 0.85, 0.08, 0.15, 0.03);
+ return s_mat(s_lin(0.09, 0.13, 0.45), 0.9, 0.05, 0.05, 0.02);
}
if (theme == 4)
{
diff --git a/crates/compositor/src/shaders.metal b/crates/compositor/src/shaders.metal
index 7805a5619..f50eb5a0d 100644
--- a/crates/compositor/src/shaders.metal
+++ b/crates/compositor/src/shaders.metal
@@ -746,6 +746,13 @@ static float2 s_piece(float d, float dc, float sil, float z, float w, float zt,
return s_opu(float2(min(tray, bead), 5.0), float2(cushion, mat));
}
+static float2 s_paper(float d, float sil, float z, float w)
+{
+ float navy = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + 0.15), 0.5 * (0.15 - SCULPT_HOVER), 0.006);
+ float sheet = s_extrude(d, z - 0.16, 0.01, 0.004);
+ return s_opu(float2(navy, 5.0), float2(sheet, 1.0));
+}
+
inline float s_bump(float2 p, float2 c, float r)
{
float k = saturate(1.0 - dot(p - c, p - c) / (r * r));
@@ -811,7 +818,8 @@ static float2 s_rimmed(float3 p, int theme, int shape)
w = 0.045;
dc = 1.0;
}
- float2 r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);
+ float2 r = theme == 2 ? s_paper(body.y, body.x, p.z, w)
+ : s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);
if (theme == 0)
{
if (arrow)
@@ -827,17 +835,17 @@ static float2 s_rimmed(float3 p, int theme, int shape)
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));
+ r = s_opu(r, float2(s_extrude(back, p.z - 0.08, 0.03, 0.006), 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
{
- r = s_opu(r, float2(s_extrude(back, p.z - 0.09, 0.04, 0.03), 3.0));
+ r = s_opu(r, float2(s_extrude(back, p.z - 0.08, 0.03, 0.006), 3.0));
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));
+ return s_opu(r, float2(s_extrude(dash, p.z - 0.11, 0.06, 0.006), 3.0));
}
if (!arrow)
{
@@ -1136,9 +1144,9 @@ static SculptMat sculpt_material(float mat, float3 p, int theme, int shape)
}
if (theme == 2)
{
- 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 ((primary && shape == 0) || (mat > 2.5 && mat < 3.5 && shape == 1)) return s_mat(s_lin(1.0, 0.40, 0.30), 0.85, 0.08, 0.15, 0.03);
+ if (mat < 3.5) return s_mat(s_lin(1.0, 0.80, 0.10), 0.85, 0.08, 0.15, 0.03);
+ return s_mat(s_lin(0.09, 0.13, 0.45), 0.9, 0.05, 0.05, 0.02);
}
if (theme == 4)
{
diff --git a/crates/compositor/src/vk_shaders/layer.wgsl b/crates/compositor/src/vk_shaders/layer.wgsl
index f1c122e6c..c0cc443c9 100644
--- a/crates/compositor/src/vk_shaders/layer.wgsl
+++ b/crates/compositor/src/vk_shaders/layer.wgsl
@@ -753,6 +753,12 @@ fn s_piece(d: f32, dc: f32, sil: f32, z: f32, w: f32, zt: f32, h: f32, bump: f32
return s_opu(vec2<f32>(min(tray, bead), 5.0), vec2<f32>(cushion, mat));
}
+fn s_paper(d: f32, sil: f32, z: f32, w: f32) -> vec2<f32> {
+ let navy = s_extrude(sil - w, z - 0.5 * (SCULPT_HOVER + 0.15), 0.5 * (0.15 - SCULPT_HOVER), 0.006);
+ let sheet = s_extrude(d, z - 0.16, 0.01, 0.004);
+ return s_opu(vec2<f32>(navy, 5.0), vec2<f32>(sheet, 1.0));
+}
+
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;
@@ -808,7 +814,12 @@ fn s_rimmed(p: vec3<f32>, theme: i32, shape: i32) -> vec2<f32> {
w = 0.045;
dc = 1.0;
}
- var r = s_piece(body.y, dc, body.x, p.z, w, zt, h, bump, 1.0);
+ var r: vec2<f32>;
+ if theme == 2 {
+ r = s_paper(body.y, body.x, p.z, w);
+ } else {
+ 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);
@@ -820,15 +831,15 @@ fn s_rimmed(p: vec3<f32>, theme: i32, shape: i32) -> vec2<f32> {
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));
+ r = s_opu(r, vec2<f32>(s_extrude(back, p.z - 0.08, 0.03, 0.006), 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 {
- r = s_opu(r, vec2<f32>(s_extrude(back, p.z - 0.09, 0.04, 0.03), 3.0));
+ r = s_opu(r, vec2<f32>(s_extrude(back, p.z - 0.08, 0.03, 0.006), 3.0));
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));
+ return s_opu(r, vec2<f32>(s_extrude(dash, p.z - 0.11, 0.06, 0.006), 3.0));
}
if !arrow {
let cq = p.xy - vec2<f32>(0.1541, -0.9047);
@@ -1081,12 +1092,12 @@ fn sculpt_material(mat: f32, p: vec3<f32>, theme: i32, shape: i32) -> SculptMat
}
if theme == 2 {
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);
+ return SculptMat(s_lin(1.0, 0.40, 0.30), 0.85, 0.08, 0.15, 0.03);
}
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(1.0, 0.80, 0.10), 0.85, 0.08, 0.15, 0.03);
}
- return SculptMat(s_lin(0.09, 0.13, 0.45), 0.6, 0.25, 0.05, 0.1);
+ return SculptMat(s_lin(0.09, 0.13, 0.45), 0.9, 0.05, 0.05, 0.02);
}
if theme == 4 {
if primary && shape == 0 {
diff --git a/design/cursors/3d-direction.md b/design/cursors/3d-direction.md
index 655fd07c6..4a2033170 100644
--- a/design/cursors/3d-direction.md
+++ b/design/cursors/3d-direction.md
@@ -14,7 +14,7 @@ compositor's beveled extrusion.
| --- | --- | --- |
| 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 | No sculpted model: its faceted drawing is extruded as drawn, with a beveled edge, like the default cursors. | The same. |
-| 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, a coral layer behind it offset down-left, two coral click dashes. |
+| Pop Coral | Cut paper: flat-topped sheets, no rounded bead or gloss. A coral sheet on a navy sheet, a yellow sheet behind them offset down-left, two yellow click dashes. | A yellow sheet on a navy sheet, the navy showing between the fingers, a coral sheet behind offset down-left, two coral click dashes. |
| Pixel Candy | Voxels drawn after `3d-concept.png`: a pink face, mint voxels down the left edge and the tail, pale pink step tops, a purple ring one voxel wide set a little behind. | A voxel hand in the same colours: the index, the other fingers apart, the thumb, mint down the lower-left edge. |
| 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. |
@@ -24,9 +24,10 @@ 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 and coral layers and click dashes, Star Sprout's cuff, star,
-leaves and eyes.
+(`RIM_POLY`, `RIM_GLOVE`). Pop Coral turns the same shapes into flat paper
+sheets instead (`s_paper`). What stands in front is theme-specific: Studio
+Ink's ivory band, Pop Coral's yellow and coral layers 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 the
diff --git a/design/cursors/requirements.md b/design/cursors/requirements.md
index 179002922..6a48bc84b 100644
--- a/design/cursors/requirements.md
+++ b/design/cursors/requirements.md
@@ -42,7 +42,7 @@ their 3D models.
| --- | --- | --- |
| 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 | The faceted drawing extruded as drawn, beveled edge; no sculpted model. | The same. |
-| 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 offset becomes a layer behind it; the coral click dashes become physical pieces. |
+| Pop Coral | Cut paper: a coral sheet on a navy sheet, flat tops, matte; the yellow offset becomes a flat sheet behind; the click dashes become flat pieces. | A yellow sheet on a navy sheet, flat tops, matte; the coral offset becomes a flat sheet behind; the coral click dashes become flat pieces. |
| Pixel Candy | Keep the stepped voxel form; purple is a ring of physical blocks set behind the face, not a flat outline. | Stepped voxel fingers and palm; preserve purple as a physical ring of blocks behind the face. |
| 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`. |
diff --git a/docs/3d-effects-v2.md b/docs/3d-effects-v2.md
index ee74e5716..903efdaac 100644
--- a/docs/3d-effects-v2.md
+++ b/docs/3d-effects-v2.md
@@ -289,12 +289,14 @@ du bord (0,48 au pire), sous 1 texel au-delà (le flou arrondit les crêtes).
La flèche et la main des 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`) : voxels
-biseautés pour Pixel Candy ; 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`). Prism Glow n'a pas de modèle : son dessin à facettes est extrudé comme tout sprite
-(B.3). 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`).
+biseautés pour Pixel Candy ; pour Studio Ink 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`) ; pour Pop Coral les mêmes formes en papier découpé, des feuilles au dessus plat
+(`s_paper`). Prism Glow n'a pas de modèle : son dessin à facettes est extrudé comme tout sprite
+(B.3). 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`).
Les voxels de Pixel Candy suivent deux grilles dessinées d'après la planche
(`scripts/generate-pixel-candy-voxels.mjs`, qui les écrit de même) : la face rose et ses voxels
menthe, le dessus des marches en rose pâle, et un anneau violet d'un voxel, en retrait derrière la