Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

CH48c: a drape fails with any seam open over 2 cm (closed), and the garment model trains only on drapes that pass. The long-sleeved shirt's short-looking sleeve was a cuff narrower than SOMA's forearm that slid off and hung open, one pair 8 cm apart, passed by the 95th-percentile check; 23 of the first 139 lean drapes have such a seam, mostly at sleeve-to-cuff corners. A gathering thread (a gathered edge drawn to its partner's length) changed none of the eight worst and was left out

shinyobjectz8f49748322a2
diff --git a/docs/character.feature b/docs/character.feature
index 4e10258c..a56c94c0 100644
--- a/docs/character.feature
+++ b/docs/character.feature
@@ -746,8 +746,14 @@ Feature: The character SDK as one system: SOMA bodies, Kimodo motion, generated
# the nearest training picture's design, where a random design passes one or two; nonsense ("a bowl of
# soup") falls back to a fitted top and trousers. words.sh makes each line a design, cuts it to SOMA and
# drapes it, about 20 s and $0: seven of seven were valid patterns and hung right, six read as asked.
- # Faults: "long-sleeved" comes out at the elbow, a turtleneck's collar collapses in the drape, unasked parts
- # come along (trousers with a turtleneck), and "a long dress" is not known as a top joined to a skirt.
+ # Faults: the long-sleeved shirt's sleeve was long but its cuff, a tube about 18 cm round reaching from wrist
+ # to elbow, is narrower than SOMA's forearm and slid off to hang open (one pair 8 cm apart); the drape's
+ # check looked only at the 95th percentile of seam gaps and passed it. A drape now fails with any seam open
+ # over 2 cm ("closed"), which 23 of the first 139 lean drapes do, mostly at sleeve-to-cuff corners, and the
+ # model trains only on drapes that pass. Drawing a gathered edge in to its partner's length (a gathering
+ # thread) was tried and changed none of the eight worst. Also: a turtleneck's collar collapses in the drape,
+ # unasked parts come along (trousers with a turtleneck), and "a long dress" is not known as a top joined to
+ # a skirt.
Then a line of words becomes a sewing pattern cut to SOMA and draped, with no caption written to train it
And its eval says how it compares with the nearest picture and with chance, on held-out designs and lines
diff --git a/tools/garments/drape_mlx.py b/tools/garments/drape_mlx.py
index 99cc60fb..0079581c 100644
--- a/tools/garments/drape_mlx.py
+++ b/tools/garments/drape_mlx.py
@@ -160,11 +160,14 @@ Xd = np.array(Xm)
# stayed: a top still hangs from the shoulders (SOMA's are at 1.45 m), anything else from the waist (1.05 m)
has_top = any("torso" in p["name"] for p in P["pieces"])
top_y = float(Xd[:, 1].max()); stayed = top_y > (1.38 if has_top else 0.95)
-ok = bool(np.isfinite(Xd).all() and np.percentile(gap, 95) < 15 and inside < 0.01 * n and stayed)
+# closed: no seam left open more than 2 cm anywhere (a cuff whose side seam never closed hangs open below the elbow,
+# and passed on the 95th percentile alone: 23 of the first 139 lean drapes, 12 of them with cuffs)
+closed = bool(gap.max() < 20)
+ok = bool(np.isfinite(Xd).all() and np.percentile(gap, 95) < 15 and inside < 0.01 * n and stayed and closed)
np.savez_compressed(os.path.join(out_dir, NAME + ".draped.npz"), X=Xd, F=F, FLAT=FLAT, seams=seams, start=np.array(start))
if snaps: np.savez_compressed(os.path.join(out_dir, NAME + ".snaps.npz"), start=np.array(start), **snaps)
report = {"name": NAME, "frames": FRAMES, "vertices": n, "seconds": round(time.time() - t0, 1), "ok": ok,
- "stayed": bool(stayed), "top_y": round(top_y, 3),
+ "stayed": bool(stayed), "closed": closed, "top_y": round(top_y, 3),
"seam_gap_mm": {"median": float(np.median(gap)), "p95": float(np.percentile(gap, 95)), "max": float(gap.max())},
"edge_strain": {"p5": float(np.percentile(strain, 5)), "p95": float(np.percentile(strain, 95))},
"cloth_vertices_inside_skin": inside}
diff --git a/tools/garments/garment_model.py b/tools/garments/garment_model.py
index ffcde702..82bf4307 100644
--- a/tools/garments/garment_model.py
+++ b/tools/garments/garment_model.py
@@ -39,9 +39,19 @@ PROBES = [
def unit(x): return x / np.maximum(np.linalg.norm(x, axis=-1, keepdims=True), 1e-9)
+def hung_right(data, n):
+ """a design whose drape passed and left no seam open over 2 cm (an open cuff would teach the look of a fault)"""
+ try: r = json.load(open(f"{data}/{n}/{n}.drape.json"))
+ except OSError: return False
+ return r["ok"] and r["seam_gap_mm"]["max"] < 20
+
+
def load(data):
- Z = np.load(f"{data}/embeds.npz")
- names = sorted({str(n) for n in Z["names"]})
+ Z = dict(np.load(f"{data}/embeds.npz"))
+ good = {n for n in {str(n) for n in Z["names"]} if hung_right(data, n)}
+ keep = np.array([str(n) in good for n in Z["names"]])
+ Z = {k: v[keep] for k, v in Z.items()}
+ names = sorted(good)
designs = {n: yaml.safe_load(open(f"{data}/{n}/design.yaml"))["design"] for n in names}
captions = [open(f"{data}/{n}/caption.txt").read().strip() for n in names if os.path.exists(f"{data}/{n}/caption.txt")]
return Z, names, designs, captions