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.

SOMA's body is built with its skin samples on the joints a pose turns (tools/clothes/body.py). SOMA hangs skin on twist joints (all of an arm's and a leg's), the bone in the palm under each finger and the end joint past each fingertip, which no pose, clip or solver turns: left there, a hand on a cup was 12 samples of palm, no forearm, and fingertips 2 cm short. Each sample keeps its part and is written from its carrying joint, its weights summed. A body built this way reads the same in the hands' audit as one mended after.

shinyobjectz8883c30c5353
diff --git a/tools/clothes/body.py b/tools/clothes/body.py
index 361177e1..a62c25e6 100644
--- a/tools/clothes/body.py
+++ b/tools/clothes/body.py
@@ -132,6 +132,20 @@ def part_of(name):
return PART.get(n, "chest"), side
+# Each sample is written on the joints a pose turns. SOMA hangs skin on joints that no pose, clip or solver turns:
+# the twist joints along a limb (all of an arm's and a leg's skin), the bone in the palm under each finger and the
+# end joint past each fingertip. Left on those, a hand on a cup was 12 samples of palm with no forearm and its
+# fingertips 2 cm short. The part still says where the skin is (a palm bone's is "palm").
+above = {j["name"]: joints[j["parent"]]["name"] for j in joints if j["parent"] >= 0}
+PALM = tuple(f"Hand{f}1" for f in ("Index", "Middle", "Ring", "Pinky"))
+
+
+def carrier(n):
+ while n in above and ("Twist" in n or n.endswith("End") or n.endswith(PALM)):
+ n = above[n]
+ return n
+
+
gname = {g.index: g.name for g in skin.vertex_groups}
by_part = {}
for v in skin.data.vertices:
@@ -140,7 +154,10 @@ for v in skin.data.vertices:
continue
tot = sum(w for w, _ in ws)
part, side = part_of(ws[0][1])
- j0 = ws[0][1]
+ j0, on = carrier(ws[0][1]), {}
+ for w, n in ws:
+ on[carrier(n)] = on.get(carrier(n), 0) + w
+ ws = [(on[j0], j0)] + sorted(((w, n) for n, w in on.items() if n != j0), reverse=True)
by_part.setdefault((part, side), []).append({"part": part, "side": side, "j": [idx[n] for _, n in ws], "w": [round(w / tot, 4) for w, _ in ws],
"o": R(v.co - head[j0]), "n": R(v.normal)})
random.seed(7)