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.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
HG17: on SOMA's own skin a held thing has no skin of the hand in it. A finger joint stops bending when any bone past it meets the surface (a knuckle bent onto a box's face carried the next two bones 24 and 35 mm in); the curl reads each bone's skin where its joints carry it by their weights, as it is drawn; the hand's frame sets the palm's height on the ball of the thumb too, and only on skin the hand mostly carries. The audit on SOMA, worst over each take: 0 to 1 mm of hand in the thing (3 mm passing a cup hand to hand; was 17 to 36), 4 to 5 pads on, palm 1 to 6 mm off. Its palm gap reads the ball of the thumb with the palm.
shinyobjectzfc32762987f5
diff --git a/docs/hands.feature b/docs/hands.featureindex 45bf057c..597546e3 100644--- a/docs/hands.feature+++ b/docs/hands.feature@@ -451,6 +451,21 @@ Feature: Procedural arms and hands: a character reaches for, takes, holds, carrilift is slower; a light one moves with the wristAnd a throw's wind-up and follow-through scale with it+ @done+ Scenario: HG17. On SOMA's own skin a held thing has no skin of the hand in it+ # 11-15, the audit (tools/hands-audit) on SOMA's body: fingers stood 17 to 36 mm inside a held box and cup.+ # Three causes, each in the system. A joint bent until its own bone met the surface, and carried the bones+ # past it in (a knuckle 60 degrees onto a box's face, the next two bones 24 and 35 mm inside): it now stops+ # when any bone past it meets. The curl read each bone's skin as riding that bone alone, where the skin is+ # carried by several joints' weights (the ball of the thumb is half the hand's): it reads it as drawn. And+ # the ball of the thumb is the palm's: the hand's frame sets the palm's height on it too, and only on skin+ # the hand mostly carries itself (the web to the thumb stood 13 mm proud). Now, worst over each take: 0 to+ # 1 mm in the thing (3 mm passing a cup hand to hand), 4 to 5 pads on, the palm 1 to 6 mm off. Not this:+ # fingers 20 to 37 mm into the table on the way to a box, and into the body's own thigh.+ Given SOMA's body, its skin samples on the joints that carry them+ Then through each of the audit's six takes no skin of a hand is more than 3 mm inside the thing it holds+ And every hand that holds has four pads or more on it, its palm within 6 mm+Rule: Wider, for the character SDKScenario: HG11. Creatures' motion from generated videodiff --git a/systems/body/src/rig.rs b/systems/body/src/rig.rsindex dace148b..9500185d 100644--- a/systems/body/src/rig.rs+++ b/systems/body/src/rig.rs@@ -207,11 +207,16 @@ pub fn hand_rest(skel: &Skeleton, s: Side) -> Option<HandRest> {let middle = reach * 0.55;let skin = skel.skin_of(hand)- .filter(|x| x.part == "palm" && x.normal.dot(palm) > 0.5)+ // (skin the hand mostly carries itself: the web to the thumb stands 13 mm proud of the palm and goes with the thumb)+ .filter(|x| x.part == "palm" && x.normal.dot(palm) > 0.5 && x.joints.first().is_some_and(|j| j.1 >= 0.8)).map(|x| x.at - h).filter(|o| (*o - middle).reject_from_normalized(palm).length() < 0.025).map(|o| o.dot(palm)).fold(f32::MIN, f32::max);+ // and the ball of the thumb, which is the palm's too though the thumb's first bone carries it: a face the palm+ // lies on meets it first (left out, it sat 6 to 9 mm inside a held box with the thumb as far open as it goes)+ let ball = skel.finger("thumb", s).map_or(f32::MIN, |js| skel.skin_of(js[0]).filter(|x| x.normal.dot(palm) > 0.5).map(|x| (x.at - h).dot(palm)).fold(f32::MIN, f32::max));+ let skin = skin.max(ball);Some(HandRest { along, palm, mid: middle + palm * if skin > 0.0 { skin } else { 0.012 } })}diff --git a/systems/grab/src/hand.rs b/systems/grab/src/hand.rsindex 9c3a93af..1d6aec15 100644--- a/systems/grab/src/hand.rs+++ b/systems/grab/src/hand.rs@@ -152,32 +152,46 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, t};let own = [turns[js[0]], turns[js[1]], turns[js[2]]];let mut base = own;- // each bone's own skin, where the body has samples of it (from the bone's head, at rest)- let skin = js.map(|j| skel.skin_of(j).map(|x| x.at - skel.joints[j].head).collect::<Vec<Vec3>>());- // the least clearance of bone k's skin with the finger bent by `bend` (radians a joint)+ // each bone's own skin, where the body has samples of it+ let skin = js.map(|j| skel.skin_of(j).collect::<Vec<_>>());+ // the least clearance of bone k's skin with the finger bent by `bend` (radians a joint). Each sample is where+ // its joints carry it by their weights, as the skin is drawn: the ball of the thumb is shared with the hand,+ // and read as riding the thumb's bone alone it stood clear of a box it was 9 mm inside. (A joint that is not+ // this finger's rides with the hand.)let clear = |base: &[Quat; 3], bend: [f32; 3], k: usize| {let (mut pp, mut pr) = wrist;- let mut least = f32::MAX;- for i in 0..=k {+ let mut at = [wrist; 3];+ for i in 0..3 {let j = &skel.joints[js[i]];// (the knuckle from the hand's joint, whatever lies between: SOMA has a bone in the palm there)let p = pp + pr * if i == 0 { j.head - skel.joints[hand].head } else { skel.offset(js[i]) };let q = (pr * base[i] * Quat::from_axis_angle(axis(i), bend[i])).normalize();- if i == k && !skin[k].is_empty() {- for o in &skin[k] {- least = least.min(thing.distance(p + q * *o));- }- } else if i == k {- for along in [0.45, 0.75, 1.0] {- least = least.min(thing.distance(p + q * ((j.tail - j.head) * along)) - thick);- }- }+ at[i] = (p, q);(pp, pr) = (p, q);}+ let mut least = f32::MAX;+ if skin[k].is_empty() {+ let j = &skel.joints[js[k]];+ for along in [0.45, 0.75, 1.0] {+ least = least.min(thing.distance(at[k].0 + at[k].1 * ((j.tail - j.head) * along)) - thick);+ }+ }+ for x in &skin[k] {+ let (mut sum, mut total) = (Vec3::ZERO, 0.0);+ for &(j, w) in &x.joints {+ let (p, q, head) = js.iter().position(|&c| c == j).map_or((wrist.0, wrist.1, skel.joints[hand].head), |i| (at[i].0, at[i].1, skel.joints[j].head));+ sum += (p + q * (x.at - head)) * w;+ total += w;+ }+ least = least.min(thing.distance(sum / total.max(1e-6)));+ }least};- // each joint starts opened and bends until its bone meets the surface (the last step halved down to the- // contact), so the finger wraps whatever is there; the joints after it wait opened, out of the way+ // each joint starts opened and bends until its bone, or any bone past it, meets the surface (the last step+ // halved down to the contact), so the finger wraps whatever is there; the joints after it wait opened. (Read+ // on its own bone alone, a knuckle bent 60 degrees onto a box's face carried the two bones past it 24 and+ // 35 mm into the box, and a joint already in the thing is left as it is.)+ let free = |base: &[Quat; 3], bend: [f32; 3], k: usize| (k..3).map(|i| clear(base, bend, i)).fold(f32::MAX, f32::min);let open = OPEN[thumb as usize].map(f32::to_radians);// a thumb that is in the thing even opened is spread out from the palm (turned about the hand's length, the// less of the two ways, up to 60 degrees) until it is clear: round a cup, not through it@@ -197,7 +211,7 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, tlet mut bend = open;for k in 0..3 {let most = BEND[thumb as usize][k].to_radians();- let start = clear(&base, bend, k);+ let start = free(&base, bend, k);if start < 0.0 {// in the thing even opened: nothing a curl can fix; said, not hiddentouch.inside = touch.inside.max(-start);@@ -211,7 +225,7 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, twhile lo < most {let hi = (lo + step).min(most);bend[k] = hi;- let gap = clear(&base, bend, k);+ let gap = free(&base, bend, k);if gap < 0.0 {hit = Some(hi);break;@@ -226,7 +240,7 @@ pub fn curl(skel: &Skeleton, turns: &mut [Quat], wrist: (Vec3, Quat), s: Side, tfor _ in 0..8 {let mid = (lo + hi) / 2.0;bend[k] = mid;- if clear(&base, bend, k) < 0.0 { hi = mid } else { lo = mid }+ if free(&base, bend, k) < 0.0 { hi = mid } else { lo = mid }}bend[k] = lo;touch.on[n] = true;diff --git a/tools/hands-audit/src/main.rs b/tools/hands-audit/src/main.rsindex ffa16321..41b03bff 100644--- a/tools/hands-audit/src/main.rs+++ b/tools/hands-audit/src/main.rs@@ -76,7 +76,8 @@ fn audit(skel: &Skeleton, name: &str, base: &dyn Fn(f32) -> Pose, take: &Take, uif held && d < 0.006 && sample.part.ends_with('3') {touching.insert((sample.part.clone(), sample.joints[0].0));}- if held && sample.part == "palm" {+ // (the palm's skin and the ball of the thumb, which lies on a face with it)+ if held && (sample.part == "palm" || sample.part == "thumb1") {gap = gap.min(d);}}