diff --git a/figure/README.md b/figure/README.md index ce544a4f..1f4be597 100644 --- a/figure/README.md +++ b/figure/README.md @@ -25,10 +25,13 @@ The modules: as she moves and turns, and her eyes blink every few seconds (`FigureBlink`); a still pose has the hair hanging at rest. Its humanoid bones are found by name (VRoid's `J_Bip_*`, Mixamo's - `mixamorig` and common Blender names). Each pose turns them so the limbs - point where the solver's joints are, keeping the model's own - proportions, scales the model so its legs match the solver's and stands - its ankles on the solver's ankles. `FigureModelToon` gives it a + `mixamorig` and common Blender names). Each pose solves the limbs with + the model's own segment lengths to reach the solver's wrists and ankles, + keeping its proportions. It scales the model to the solver's leg length and stands + its measured slipper support on the solver's heel/ball contacts. The wrist uses the solver's palm + frame, converted from the model's bind pose; the fingers curl gently + unless the technique calls for a fist or hook. Eyes follow cued head + turns gently. `FigureModelToon` gives it a cel-shaded look on its own textures. The practices' backdrops are in `shared/figure/backdrops/`. The owner's @@ -36,13 +39,37 @@ references for the render quality are in `design/reference/`. ## Tests -Run from the repository root through the build queue: +Run from the repository root in a managed Harmony command. ```sh -build-queue -- ziran build --project --target=c --exe --entry figure_parts_test:main -o build/figure-parts-test tests/figure_parts_test.zi -build-queue -- ./build/figure-parts-test/figure_parts_test +for suite in figure_parts_test figure_model_pose_test figure_model_sole_test figure_cloth_test; do + ziran build --project --target=c --exe --entry "$suite:main" -o "build/$suite" "tests/$suite.zi" && + "build/$suite/$suite" || exit +done +python3 tests/slippers_test.py +python3 tests/attire_test.py --source-dir backup/figure-source ``` `figure_parts_test` checks that a skinned vertex follows its bone's motion, the contact shadow, a picture laid over a covering backdrop, and that a missing model file is refused cleanly. + +`figure_model_pose_test` loads both selected VRM skeletons and checks the +rendered hand direction, wrist alignment and planted ankle alignment as the pelvis moves +over fixed foot targets. It does not need a window or display. + +`figure_model_sole_test` measures actual skinned underside vertices for both +models during flat stances and heel/ball pivots, with a 1 mm floor, +flatness and pivot limit. `slippers_test.py` validates the shipped CC0 +models, rigid foot weights, matte cloth materials and flat soles; with +`--source-dir` it also proves every original bitmap/accessor byte and every +non-shoe primitive is retained. See `shared/figure/MODELS.md` for the +reproducible footwear pipeline. + +`figure_cloth` drapes the skirt hem, resolves leg-capsule contacts and +shares displacement across nearby fabric edges. `figure_model` applies +those constraints to the named skirt after skinning. `figure_cloth_test` +covers the fold through ninety degrees, waist anchoring and capsule +contacts. The preview's `--clothing-audit` checks actual named garment +surfaces throughout every timeline. Its private capture commands render +complete items and slow transitions for visual review. diff --git a/figure/figure_cloth.zi b/figure/figure_cloth.zi new file mode 100644 index 00000000..47b5e2f8 --- /dev/null +++ b/figure/figure_cloth.zi @@ -0,0 +1,37 @@ +// Small deterministic cloth constraints for the meditation skirt. The upper +// edge follows the fitted garment skin; the hem hangs under gravity instead +// of rotating over the head with a forward-folded pelvis. Leg capsules and +// the real floor keep the cloth outside the body. There is no free-running +// simulation or seek-dependent state. +#import "figure_math" +#import "kryon/scene" + +FigureClothOutside :: (point: Vector3, from: Vector3, to: Vector3, radius: float64, fallback: Vector3) -> Vector3 { + segment := FigureSub(to, from) + length := FigureDot(segment, segment) + along := ifx length > 0.000000001 then FigureClamp(FigureDot(FigureSub(point, from), segment) / length, 0.0, 1.0) else 0.0 + center := FigureAddScaled(from, segment, along) + delta := FigureSub(point, center) + distance := FigureLength(delta) + if distance >= radius { + return point + } + if distance < 0.000001 { + delta = FigureNormalize(fallback) + } else { + delta = FigureScale(delta, 1.0 / distance) + } + return FigureAddScaled(center, delta, radius) +} + +FigureClothHang :: (skinned: Vector3, rest: Vector3, rest_hips: Vector3, hips: Vector3, + facing: FigureQuat, yaw: float64, scale: float64) -> Vector3 { + local := FigureSub(rest, rest_hips) + depth := FigureMax(0.0, -local.y) + // Preserve the waist seam and let the lower skirt settle continuously. + loose := FigureSmooth(depth, 0.015, 0.19) + lateral := FigureRotate(facing, .{local.x, 0.0, local.z}) + lateral = FigureRotate(FigureAxisAngle(.{0.0, 1.0, 0.0}, yaw), lateral) + hanging := FigureAdd(hips, FigureScale(.{lateral.x, -depth, lateral.z}, scale)) + return FigureLerp(skinned, hanging, loose) +} diff --git a/figure/figure_joints.zi b/figure/figure_joints.zi index 2d1f0db9..eb20e173 100644 --- a/figure/figure_joints.zi +++ b/figure/figure_joints.zi @@ -27,6 +27,9 @@ FigureJoints :: struct { knees: [2]Vector3 ankles: [2]Vector3 toes: [2]Vector3 + // Actual solver heel/ball contacts, including lift and pivots. + heels: [2]Vector3 + balls: [2]Vector3 feet: [2]FigureQuat } diff --git a/figure/figure_model.zi b/figure/figure_model.zi index 8f15fe16..c3213c69 100644 --- a/figure/figure_model.zi +++ b/figure/figure_model.zi @@ -3,13 +3,14 @@ // // The model's humanoid bones are found by name: VRoid's J_Bip_*, Mixamo's // mixamorig names and the common Blender names. Each pose turns those bones -// so the limbs point where the solver's joints are, keeping the model's own -// proportions; the trunk, head and feet take the solver's turns. The whole +// so the limbs reach the solver's wrists and ankles with the model's own +// segment lengths; the trunk, head and feet take the solver's turns. The whole // model is scaled so its legs match the solver's and placed so its ankles // stand on the solver's ankles. A VRM model's hair and clothes swing on its // spring bones and its eyes blink while the pose is played over time. #import "figure_math" #import "figure_joints" +#import "figure_cloth" #import "kryon/scene" #import "kryon/scene_gltf" #import "kryon/scene_skin" @@ -56,6 +57,14 @@ FigureModel :: struct { // Turns the model to face +Z with its left at +X. facing: FigureQuat yaw: float64 + // The model's relaxed palm frames in the solver's coordinate system. + hand_rest: [2]FigureQuat + // Measured sole vertices in foot-relative, facing-corrected bind space. + sole_points: [128]Vector3 + sole_count: [2]s32 + sole_heel: [2]Vector3 + sole_ball: [2]Vector3 + foot_stretch: [2]float64 // The toon look: a shader, and per scene mesh its uniforms. Each mesh // keeps the importer's own base colour texture, which the renderer // uploads once and samples into the shader's vertex data. @@ -105,6 +114,29 @@ FigureModelLoad :: (figure: *FigureModel, scene: *Scene, path: string) -> bool { return false } GltfSetDualQuaternion(*figure.instance, true) + // Feet use their exact affine transform: the calibrated sole length + // needs nonuniform Z scale, which a rigid dual quaternion cannot encode. + // The tunic and trousers also use affine blending across joints. In a + // deep lunge the thighs can rotate far enough apart to make adjacent + // vertices choose opposite dual-quaternion rotation paths at the seat. + skirt := false + for index: 0..figure.model.meshes.count - 1 { + mesh := *figure.model.meshes[index] + skirt = skirt || TextView(mesh.name[:]) == "PracticeSkirt" + } + for index: 0..figure.instance.meshes.count - 1 { + inst := *figure.instance.meshes[index] + mesh := *figure.model.meshes[inst.mesh_index] + name := TextView(mesh.name[:]) + primitive := *mesh.primitives[inst.primitive_index] + high: float64 = -1000.0 + for vertex: primitive.indices[:] { + high = FigureMax(high, primitive.positions[vertex].y) + } + if high < 0.30 || (!skirt && (name == "PracticeClothing" || name == "PracticeWrapFacings")) { + inst.skin.dual_quaternion = false + } + } count := figure.model.nodes.count if !VecResize(figure.rest_turn, count) || !VecResize(figure.rest_at, count) || !VecResize(figure.turn, count) || !VecResize(figure.role_of, count) { @@ -165,6 +197,10 @@ FigureModelLoad :: (figure: *FigureModel, scene: *Scene, path: string) -> bool { // keeps its own naming; only the heading is turned. figure.yaw = -Atan2(forward.x, forward.z) figure.facing = FigureAxisAngle(FigureV3(0.0, 1.0, 0.0), figure.yaw) + for side: cast(s32)0..1 { + figure.hand_rest[side] = FigureModelHandRest(figure, side) + } + FigureModelReadSoles(figure) // A VRM model's springs start from its rest pose. if VrmReadFile(*figure.avatar, path) { unused VrmSpringsReset(*figure.avatar, *figure.model, *figure.instance) @@ -202,56 +238,35 @@ FigureModelPose :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints, lower := FigureModelAim(figure, upper, FigureSideRole(side, FIGURE_LOWER_ARM), FigureSideRole(side, FIGURE_HAND), FigureSub(joints.wrists[side], joints.elbows[side])) turns[FigureSideRole(side, FIGURE_LOWER_ARM)] = lower - turns[FigureSideRole(side, FIGURE_HAND)] = lower + turns[FigureSideRole(side, FIGURE_HAND)] = FigureMultiply( + FigureQuatNormalize(joints.hands[side]), FigureConjugate(figure.hand_rest[side])) thigh := FigureModelAim(figure, pelvis, FigureSideRole(side, FIGURE_UPPER_LEG), FigureSideRole(side, FIGURE_LOWER_LEG), FigureSub(joints.knees[side], joints.hips[side])) turns[FigureSideRole(side, FIGURE_UPPER_LEG)] = thigh shin := FigureModelAim(figure, thigh, FigureSideRole(side, FIGURE_LOWER_LEG), FigureSideRole(side, FIGURE_FOOT), FigureSub(joints.ankles[side], joints.knees[side])) turns[FigureSideRole(side, FIGURE_LOWER_LEG)] = shin - foot := FigureModelAim(figure, FigureQuatNormalize(joints.feet[side]), FigureSideRole(side, FIGURE_FOOT), - FigureSideRole(side, FIGURE_TOES), FigureSub(joints.toes[side], joints.ankles[side])) + // The prepared slipper sole is level at rest. Toe-bone direction + // is anatomical, not the sole plane; aiming it tilted planted shoes. + foot := FigureQuatNormalize(joints.feet[side]) turns[FigureSideRole(side, FIGURE_FOOT)] = foot turns[FigureSideRole(side, FIGURE_TOES)] = foot // The fingers relax into a soft curl, closing further with a fist. hand := turns[FigureSideRole(side, FIGURE_HAND)] - curl := 0.18 + FigureClamp(joints.fist[side], 0.0, 1.0) * 1.0 for finger: cast(s32)0..4 { parent := hand for segment: cast(s32)0..2 { role := FigureFingerRole(side, finger, segment) next := ifx segment < 2 then FigureFingerRole(side, finger, segment + 1) else -1 bend := FigureModelFingerAxis(figure, role, next, side) - amount := ifx finger == 0 then curl * 0.4 else curl + amount := FigureFingerCurl(joints.fist[side], joints.hook[side], finger, segment) turned := FigureMultiply(FigureAxisAngle(FigureRotate(parent, bend), amount), parent) turns[role] = turned parent = turned } } } - // Each node turns with the nearest posed bone above it. - for at: 0..figure.order.count - 1 { - node := figure.order[at] - parent := figure.model.nodes[node].parent - role := figure.role_of[node] - figure.turn[node] = ifx role >= 0 then turns[role] else ifx parent >= 0 then figure.turn[parent] else FigureIdentity() - if role < 0 { - continue - } - // World rotation now: the figure-space turn carried into the - // model's space; the local rotation is that against the parent's. - inverse_facing := FigureConjugate(figure.facing) - mine := FigureMultiply(FigureMultiply(FigureMultiply(inverse_facing, figure.turn[node]), figure.facing), - figure.rest_turn[node]) - above := FigureIdentity() - if parent >= 0 { - above = FigureMultiply(FigureMultiply(FigureMultiply(inverse_facing, figure.turn[parent]), figure.facing), - figure.rest_turn[parent]) - } - local := FigureQuatNormalize(FigureMultiply(FigureConjugate(above), mine)) - figure.instance.rotations[node] = .{local.x, local.y, local.z, local.w} - figure.instance.trs_dirty[node] = true - } + FigureModelSetTurns(figure, turns[:]) // The legs match the solver's; the ankles stand on the solver's ankles. model_leg: float64 solver_leg: float64 @@ -263,18 +278,292 @@ FigureModelPose :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints, solver_leg += FigureDistance(joints.hips[side], joints.knees[side]) + FigureDistance(joints.knees[side], joints.ankles[side]) } scale := ifx model_leg > 0.000001 then solver_leg / model_leg else 1.0 + feet_targets: [2]Vector3 + for side: cast(s32)0..1 { + figure.foot_stretch[side] = 1.0 + span := FigureDistance(joints.heels[side], joints.balls[side]) + model_span := FigureDistance(figure.sole_heel[side], figure.sole_ball[side]) * scale + if figure.sole_count[side] > 0 && span > 0.01 && model_span > 0.01 { + figure.foot_stretch[side] = span / model_span + } + foot_node := figure.bones[FigureSideRole(side, FIGURE_FOOT)] + if foot_node >= 0 { + figure.instance.scales[foot_node].z = figure.model.nodes[foot_node].scale.z * figure.foot_stretch[side] + figure.instance.trs_dirty[foot_node] = true + } + feet_targets[side] = FigureModelSoleTarget(figure, joints, side, scale) + } offset: Vector3 for side: cast(s32)0..1 { ankle := FigureScale(FigureRotate(figure.facing, FigureModelPosed(figure, figure.bones[FigureSideRole(side, FIGURE_FOOT)])), scale) - offset = FigureAdd(offset, FigureScale(FigureSub(joints.ankles[side], ankle), 0.5)) + offset = FigureAdd(offset, FigureScale(FigureSub(feet_targets[side], ankle), 0.5)) } + // A measured sole changes the ankle target. Keep the pelvis inside + // both legs' reach before solving them, including nearly straight + // stances where the two avatars' thigh/shin ratios differ. + hips: [2]Vector3 + reaches: [2]float64 + for side: cast(s32)0..1 { + upper := FigureSideRole(side, FIGURE_UPPER_LEG) + lower := FigureSideRole(side, FIGURE_LOWER_LEG) + foot := FigureSideRole(side, FIGURE_FOOT) + hips[side] = FigureScale(FigureRotate(figure.facing, + FigureModelPosed(figure, figure.bones[upper])), scale) + reaches[side] = (FigureDistance(FigureModelRest(figure, upper, -1), FigureModelRest(figure, lower, -1)) + + FigureDistance(FigureModelRest(figure, lower, -1), FigureModelRest(figure, foot, -1))) * scale - 0.000002 + } + for pass: 0..31 { + adjusted := false + for side: cast(s32)0..1 { + delta := FigureSub(FigureAdd(offset, hips[side]), feet_targets[side]) + distance := FigureLength(delta) + if distance > reaches[side] + 0.0000000001 && reaches[side] > 0.0 { + offset = FigureAddScaled(offset, delta, reaches[side] / distance - 1.0) + adjusted = true + } + } + if !adjusted { + break + } + } + // Bone directions alone cannot keep contacts fixed when the model's + // thigh/shin or upper/lower arm ratios differ from the solver's. Solve + // each limb again with the model's lengths, reaching the same targets. + for side: cast(s32)0..1 { + FigureModelReach(figure, turns[:], pelvis, FigureSideRole(side, FIGURE_UPPER_LEG), + FigureSideRole(side, FIGURE_LOWER_LEG), FigureSideRole(side, FIGURE_FOOT), + feet_targets[side], joints.knees[side], offset, scale) + FigureModelReach(figure, turns[:], chest, FigureSideRole(side, FIGURE_UPPER_ARM), + FigureSideRole(side, FIGURE_LOWER_ARM), FigureSideRole(side, FIGURE_HAND), + joints.wrists[side], joints.elbows[side], offset, scale) + } + FigureModelSetTurns(figure, turns[:]) root := figure.instance.root_node SetPosition(scene, root, offset.x, offset.y, offset.z) SetRotation(scene, root, 0.0, figure.yaw, 0.0) SetScale(scene, root, scale, scale, scale) + gaze := FigureGaze(joints) + VrmLookAtSet(*figure.avatar, *figure.model, *figure.instance, gaze.x, gaze.y) FigureModelLive(figure, offset, scale, seconds) - return GltfUpdateScene(*figure.model, *figure.instance, scene) + if !GltfUpdateScene(*figure.model, *figure.instance, scene) { + return false + } + FigureModelCloth(figure, scene, joints) + return true +} + +// Drape only the named skirt emitted by prepare_attire.py. Other garment, +// body, hair and slipper skins retain their existing deformation. +FigureModelCloth :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints) { + root := scene.nodes[figure.instance.root_node] + scale := root.scale.x + rest_hips := figure.rest_at[figure.bones[FIGURE_HIPS]] + hip_world := FigureModelWorld(figure, scene, FIGURE_HIPS) + forward := FigureRotate(FigureQuatNormalize(joints.pelvis_turn), .{0.0, 0.0, 1.0}) + lateral := FigureRotate(FigureQuatNormalize(joints.pelvis_turn), .{1.0, 0.0, 0.0}) + yaw := ifx lateral.x * lateral.x + lateral.z * lateral.z > 0.000001 then Atan2(-lateral.z, lateral.x) else Atan2(forward.x, forward.z) + legs: [6]Vector3 + for side: cast(s32)0..1 { + legs[side * 3] = FigureModelWorld(figure, scene, FigureSideRole(side, FIGURE_UPPER_LEG)) + legs[side * 3 + 1] = FigureModelWorld(figure, scene, FigureSideRole(side, FIGURE_LOWER_LEG)) + legs[side * 3 + 2] = FigureModelWorld(figure, scene, FigureSideRole(side, FIGURE_FOOT)) + } + for index: 0..figure.instance.meshes.count - 1 { + inst := *figure.instance.meshes[index] + source := *figure.model.meshes[inst.mesh_index] + name := TextView(source.name[:]) + skirt := name == "PracticeSkirt" + tailored := !inst.skin.dual_quaternion && (name == "PracticeClothing" || name == "PracticeWrapFacings") + if !skirt && !tailored { + continue + } + mesh := scene.meshes[scene.nodes[inst.scene_node].mesh] + if skirt { + for vertex: 0..inst.skin.positions.count - 1 { + rest := inst.skin.positions[vertex] + skinned := FigureAdd(root.position, FigureScale(FigureRotate(figure.facing, + scene.positions[mesh.first_vertex + vertex]), scale)) + point := FigureClothHang(skinned, rest, rest_hips, hip_world, figure.facing, yaw, scale) + loose := FigureSmooth(rest_hips.y - rest.y, 0.015, 0.10) + if loose > 0.0 { + fallback := FigureRotate(figure.facing, .{rest.x - rest_hips.x, 0.0, rest.z - rest_hips.z}) + // Alternate projections resolve both legs when the skirt lies + // between them, without changing the body or the foot contacts. + for pass: 0..3 { + for side: 0..1 { + outside := FigureClothOutside(point, legs[side * 3], legs[side * 3 + 1], 0.078 * scale, fallback) + point = FigureLerp(point, outside, loose) + outside = FigureClothOutside(point, legs[side * 3 + 1], legs[side * 3 + 2], 0.054 * scale, fallback) + point = FigureLerp(point, outside, loose) + } + } + } + point.y = FigureMax(point.y, 0.006) + scene.positions[mesh.first_vertex + vertex] = FigureScale(FigureRotate(FigureConjugate(figure.facing), + FigureSub(point, root.position)), 1.0 / scale) + } + } + // Spread a point's displacement over neighbouring fabric edges. + // The skirt keeps its skinned waist seam as the drape settles. + stretch := ifx skirt then 1.6 else 2.2 + refresh_normals := skirt + for pass: 0..11 { + changed := false + for edge: 0..mesh.index_count - 1 { + next := edge - edge % 3 + (edge + 1) % 3 + a := scene.indices[mesh.first_index + edge] + b := scene.indices[mesh.first_index + next] + rest_a := inst.skin.positions[a] + rest_b := inst.skin.positions[b] + length := FigureDistance(rest_a, rest_b) + if length < 0.001 { + continue + } + point_a := *scene.positions[mesh.first_vertex + a] + point_b := *scene.positions[mesh.first_vertex + b] + delta := FigureSub(< Vector3 { + world := figure.instance.node_world[figure.bones[role]] + root := scene.nodes[figure.instance.root_node] + return FigureAdd(root.position, FigureScale(FigureRotate(figure.facing, + .{world.m[3], world.m[7], world.m[11]}), root.scale.x)) +} + +// Relaxed fingers have a small graduated curl; fists close every joint, +// while a hook curls the tips further without clenching the knuckles. +FigureFingerCurl :: (fist: float64, hook: float64, finger: s32, segment: s32) -> float64 { + relaxed := 0.14 + cast(float64)finger * 0.025 + closed := relaxed + FigureClamp(fist, 0.0, 1.0) * 1.0 + if segment > 0 { + closed += FigureClamp(hook, 0.0, 1.0) * 0.65 + } + return FigureMin(1.35, closed) * ifx finger == 0 then 0.4 else 1.0 +} + +// Eyes lead a gentle head turn rather than staring straight out of the +// skull. The practice's head frame already follows its cued hand or gaze. +// Return degrees left and up, bounded well within the VRM's lookAt curves. +FigureGaze :: (joints: *FigureJoints) -> Vector3 { + forward := FigureRotate(FigureQuatNormalize(joints.head_turn), FigureV3(0.0, 0.0, 1.0)) + relative := FigureRotate(FigureConjugate(FigureQuatNormalize(joints.chest_turn)), forward) + yaw := Atan2(relative.x, relative.z) * 180.0 / FIGURE_PI + pitch := Atan2(relative.y, Sqrt(relative.x * relative.x + relative.z * relative.z)) * 180.0 / FIGURE_PI + return .{FigureClamp(yaw * 0.2, -8.0, 8.0), FigureClamp(pitch * 0.2, -5.0, 5.0), 0.0} +} + +// Place the measured shoe support on the solver's actual contact, rather +// than assuming two avatars have the solver's ankle-to-sole dimensions. +FigureModelSoleTarget :: (figure: *FigureModel, joints: *FigureJoints, side: s32, scale: float64) -> Vector3 { + if figure.sole_count[side] == 0 || FigureDistance(joints.heels[side], joints.balls[side]) < 0.01 { + return joints.ankles[side] + } + heel := joints.heels[side].y <= joints.balls[side].y + contact := ifx heel then joints.heels[side] else joints.balls[side] + relative := ifx heel then figure.sole_heel[side] else figure.sole_ball[side] + relative.z *= figure.foot_stretch[side] + turned := FigureRotate(FigureQuatNormalize(joints.feet[side]), FigureScale(relative, scale)) + target := FigureSub(contact, turned) + lowest: float64 = 1000.0 + for index: cast(s32)0..figure.sole_count[side] - 1 { + relative_point := figure.sole_points[side * 64 + index] + relative_point.z *= figure.foot_stretch[side] + point := FigureRotate(FigureQuatNormalize(joints.feet[side]), FigureScale(relative_point, scale)) + lowest = FigureMin(lowest, point.y) + } + target.y = contact.y - lowest + return target +} + +// Measurements from the actual skinned slipper vertices in the scene. +// Only contacts on the floor with the sole facing upward are planted. +FigureContactMeasure :: struct { + vertices: s64 + floor_error: float64 + flatness: float64 + pivot_error: float64 +} + +FigureModelContacts :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints, surface_height: float64 = 0.0) -> FigureContactMeasure { + result: FigureContactMeasure + root := scene.nodes[figure.instance.root_node] + for index: 0..figure.instance.meshes.count - 1 { + inst := *figure.instance.meshes[index] + source := *figure.model.meshes[inst.mesh_index] + if TextView(source.name[:]) != "PracticeClothSlippers" { + continue + } + side := inst.primitive_index + heel_down := joints.heels[side].y <= joints.balls[side].y + target := ifx heel_down then joints.heels[side] else joints.balls[side] + up := FigureRotate(FigureQuatNormalize(joints.feet[side]), FigureV3(0.0, 1.0, 0.0)) + if FigureAbs(target.y - surface_height) > 0.000001 || up.y < 0.1 { + continue + } + mesh := scene.meshes[scene.nodes[inst.scene_node].mesh] + matrix := figure.instance.node_world[inst.gltf_node] + low: float64 = 1000.0 + high: float64 = -1000.0 + back: float64 = 1000.0 + front: float64 = -1000.0 + heel: Vector3 + ball: Vector3 + for vertex: 0..inst.skin.positions.count - 1 { + rest := inst.skin.positions[vertex] + if FigureAbs(rest.y) > 0.000001 { + continue + } + point := scene.positions[mesh.first_vertex + vertex] + in_model := FigureV3(matrix.m[0] * point.x + matrix.m[1] * point.y + matrix.m[2] * point.z + matrix.m[3], + matrix.m[4] * point.x + matrix.m[5] * point.y + matrix.m[6] * point.z + matrix.m[7], + matrix.m[8] * point.x + matrix.m[9] * point.y + matrix.m[10] * point.z + matrix.m[11]) + actual := FigureAdd(root.position, FigureScale(FigureRotate(figure.facing, in_model), root.scale.x)) + low = FigureMin(low, actual.y) + high = FigureMax(high, actual.y) + along := FigureRotate(figure.facing, rest).z + if along < back { + back = along + heel = actual + } + if along > front { + front = along + ball = actual + } + result.vertices += 1 + } + result.floor_error = FigureMax(result.floor_error, FigureAbs(low - surface_height)) + if up.y > 0.999999 { + result.flatness = FigureMax(result.flatness, high - low) + } + result.pivot_error = FigureMax(result.pivot_error, FigureDistance(ifx heel_down then heel else ball, target)) + } + return result } // How closed the eyes are at SECONDS: a blink every two to five seconds, @@ -294,9 +583,9 @@ FigureBlink :: (seconds: float64) -> float64 { cast(float64)twice * 0.32 t := seconds - start if t >= 0.0 && t < 0.07 { - closed = FigureMax(closed, FigureSmooth(t / 0.07)) + closed = FigureMax(closed, FigureSmooth(t, 0.0, 0.07)) } else if t >= 0.07 && t < 0.2 { - closed = FigureMax(closed, 1.0 - FigureSmooth((t - 0.07) / 0.13)) + closed = FigureMax(closed, 1.0 - FigureSmooth(t - 0.07, 0.0, 0.13)) } } return closed @@ -349,11 +638,6 @@ FigureHash :: (value: float64) -> float64 { return wave - cast(float64)cast(s64)wave + ifx wave < 0.0 then 1.0 else 0.0 } -FigureSmooth :: (u: float64) -> float64 { - t := FigureClamp(u, 0.0, 1.0) - return t * t * (3.0 - 2.0 * t) -} - // The live parts of a VRM model at SECONDS: springs placed in the world as // the root is, swinging since the last pose (settled and hung at rest on a // still pose, a seek or the first one), and the eyes' blink. @@ -425,6 +709,110 @@ FigureModelRest :: (figure: *FigureModel, role: s32, fallback: s32) -> Vector3 { return ifx node >= 0 then figure.rest_at[node] else Vector3.{} } +// The generated slippers are separate primitives with one rigid foot +// weight. Measure the actual underside vertices; no guessed ankle height. +FigureModelReadSoles :: (figure: *FigureModel) { + figure.sole_count[0] = 0 + figure.sole_count[1] = 0 + for mesh_index: 0..figure.model.meshes.count - 1 { + mesh := *figure.model.meshes[mesh_index] + if TextView(mesh.name[:]) != "PracticeClothSlippers" || mesh.primitives.count != 2 { + continue + } + for side: cast(s32)0..1 { + primitive := *mesh.primitives[side] + low: float64 = 1000.0 + for point: primitive.positions[:] { + low = FigureMin(low, point.y) + } + ankle := FigureModelRest(figure, FigureSideRole(side, FIGURE_FOOT), -1) + back: float64 = 1000.0 + front: float64 = -1000.0 + for point: primitive.positions[:] { + if point.y > low + 0.000001 || figure.sole_count[side] >= 64 { + continue + } + relative := FigureRotate(figure.facing, FigureSub(point, ankle)) + figure.sole_points[side * 64 + figure.sole_count[side]] = relative + figure.sole_count[side] += 1 + if relative.z < back { + back = relative.z + figure.sole_heel[side] = relative + } + if relative.z > front { + front = relative.z + figure.sole_ball[side] = relative + } + } + } + } +} + +// Apply world-space bone turns as local glTF rotations. Unmapped nodes +// retain their bind rotation and inherit the nearest posed ancestor. +FigureModelSetTurns :: (figure: *FigureModel, turns: []FigureQuat) { + // Each node turns with the nearest posed bone above it. + for at: 0..figure.order.count - 1 { + node := figure.order[at] + parent := figure.model.nodes[node].parent + role := figure.role_of[node] + figure.turn[node] = ifx role >= 0 then turns[role] else ifx parent >= 0 then figure.turn[parent] else FigureIdentity() + if role < 0 { + continue + } + // World rotation now: the figure-space turn carried into the + // model's space; the local rotation is that against the parent's. + inverse_facing := FigureConjugate(figure.facing) + mine := FigureMultiply(FigureMultiply(FigureMultiply(inverse_facing, figure.turn[node]), figure.facing), + figure.rest_turn[node]) + above := FigureIdentity() + if parent >= 0 { + above = FigureMultiply(FigureMultiply(FigureMultiply(inverse_facing, figure.turn[parent]), figure.facing), + figure.rest_turn[parent]) + } + local := FigureQuatNormalize(FigureMultiply(FigureConjugate(above), mine)) + figure.instance.rotations[node] = .{local.x, local.y, local.z, local.w} + figure.instance.trs_dirty[node] = true + } +} + +// Retarget a limb with its own segment lengths. The knee/elbow keeps the +// solver's bend plane; unreachable targets stop just short of full reach. +FigureModelReach :: (figure: *FigureModel, turns: []FigureQuat, base: FigureQuat, + upper: s32, lower: s32, end: s32, target: Vector3, bend: Vector3, offset: Vector3, scale: float64) { + if figure.bones[upper] < 0 || figure.bones[lower] < 0 || figure.bones[end] < 0 { + return + } + origin := FigureAdd(offset, FigureScale(FigureRotate(figure.facing, + FigureModelPosed(figure, figure.bones[upper])), scale)) + first := FigureDistance(FigureModelRest(figure, upper, -1), FigureModelRest(figure, lower, -1)) * scale + second := FigureDistance(FigureModelRest(figure, lower, -1), FigureModelRest(figure, end, -1)) * scale + if first < 0.000001 || second < 0.000001 { + return + } + delta := FigureSub(target, origin) + distance := FigureLength(delta) + if distance < 0.000001 { + return + } + direction := FigureScale(delta, 1.0 / distance) + distance = FigureClamp(distance, FigureAbs(first - second) + 0.000001, first + second - 0.000001) + pole := FigureSub(bend, origin) + pole = FigureAddScaled(pole, direction, -FigureDot(pole, direction)) + if FigureLength(pole) < 0.000001 { + pole = FigureAddScaled(FigureV3(0.0, 0.0, 1.0), direction, -direction.z) + } + if FigureLength(pole) < 0.000001 { + pole = FigureCross(direction, FigureV3(1.0, 0.0, 0.0)) + } + along := (first * first - second * second + distance * distance) / (2.0 * distance) + across := Sqrt(FigureMax(first * first - along * along, 0.0)) + middle := FigureAddScaled(FigureAddScaled(origin, direction, along), FigureNormalize(pole), across) + endpoint := FigureAddScaled(origin, direction, distance) + turns[upper] = FigureModelAim(figure, base, upper, lower, FigureSub(middle, origin)) + turns[lower] = FigureModelAim(figure, turns[upper], lower, end, FigureSub(endpoint, middle)) +} + // BASE carried on, then swung so the bone from ROLE to NEXT points along // TARGET (in the figure's space). FigureModelAim :: (figure: *FigureModel, base: FigureQuat, role: s32, next: s32, target: Vector3) -> FigureQuat { @@ -438,6 +826,20 @@ FigureModelAim :: (figure: *FigureModel, base: FigureQuat, role: s32, next: s32, return FigureQuatNormalize(FigureMultiply(FigureSwing(FigureRotate(base, rest), target), base)) } +// Palm frames use -Y along the fingers and +Z out of the palm. Convert +// that frame to the model's bind pose once, rather than letting the wrist +// inherit the forearm and discard the technique's cued palm turns. +FigureModelHandRest :: (figure: *FigureModel, side: s32) -> FigureQuat { + wrist := FigureModelRest(figure, FigureSideRole(side, FIGURE_HAND), -1) + middle := FigureModelRest(figure, FigureFingerRole(side, 2, 0), FigureSideRole(side, FIGURE_HAND)) + along := FigureNormalize(FigureRotate(figure.facing, FigureSub(middle, wrist))) + if FigureLength(along) < 0.000001 { + along = FigureNormalize(FigureRotate(figure.facing, FigureSub(wrist, + FigureModelRest(figure, FigureSideRole(side, FIGURE_LOWER_ARM), -1)))) + } + return FigureFrame(FigureScale(along, -1.0), FigureV3(0.0, -1.0, 0.0), FigureV3(0.0, 0.0, 1.0)) +} + // The axis a finger segment curls about at rest, in the figure's space: // across the finger, towards the palm (which faces down in a T pose and // in towards the body in an A pose). diff --git a/figure/tools/prepare_attire.py b/figure/tools/prepare_attire.py new file mode 100644 index 00000000..b5b2e51c --- /dev/null +++ b/figure/tools/prepare_attire.py @@ -0,0 +1,303 @@ +#!/usr/bin/env python3 +"""Build calm cross-collar meditation clothes on the owner's CC0 VRoid figures. + +Starts with prepare_slippers' checksummed originals. Keeps identity, original +texture bytes, skeleton, hair, body and slippers. Reuses the fitted garment +surface and bind weights, removes the man's hood/cords, relaxes his trousers, +and adds real crossed lapel/sash geometry. The woman's flared skirt remains +separate so the runtime can drape it under gravity during folds. +""" +import argparse +import copy +import hashlib +import json +from pathlib import Path +import struct + +import numpy as np +from prepare_slippers import prepare, ORIGINAL, COMPONENT, WIDTH + + +def sha(path): + with path.open('rb') as stream: + return hashlib.file_digest(stream, 'sha256').hexdigest() + + +class Asset: + def __init__(self, path): + with path.open('rb') as stream: + assert struct.unpack('= .999 + forearm = np.clip((distance[sleeve] + .11) / .22, 0, 1) + forearm *= forearm * (3 - 2 * forearm) + joints[sleeve] = [upper, lower, 0, 0] + weights[sleeve] = np.column_stack((1 - forearm, forearm, np.zeros((len(forearm), 2)))) + + +def blend_trouser_seat(asset, attrs, skin): + """Keep the waistband on the hips and let each trouser leg follow its thigh.""" + names = [asset.doc['nodes'][node].get('name') for node in skin['joints']] + hips, left, right = (names.index(name) for name in ('J_Bip_C_Hips', 'J_Bip_L_UpperLeg', 'J_Bip_R_UpperLeg')) + bind = asset.read(skin['inverseBindMatrices'])[hips].reshape((4, 4), order='F') + waist = np.linalg.inv(bind)[:3, 3] + positions, joints, weights = (attrs[key] for key in ('POSITION', 'JOINTS_0', 'WEIGHTS_0')) + left_shin, right_shin = (names.index(f'J_Bip_{side}_LowerLeg') for side in ('L', 'R')) + seat = np.sum(np.where(np.isin(joints, [hips, left, right]), weights, 0), axis=1) >= .90 + seat &= waist[1] - positions[:, 1] < .43 + x = waist[0] - positions[seat, 0] + depth = waist[1] - positions[seat, 1] + leg = np.clip((depth - .02) / .23, 0, 1) + leg *= leg * (3 - 2 * leg) + width = .095 * np.clip((.43 - depth) / .15, 0, 1) + side = np.clip((x + width) / (2 * width), 0, 1) + side *= side * (3 - 2 * side) + shin = np.where(x >= 0, left_shin, right_shin) + shin_weight = np.sum(np.where(joints[seat] == shin[:, None], weights[seat], 0), axis=1) + joints[seat] = np.column_stack((np.full(len(leg), hips), np.full(len(leg), left), np.full(len(leg), right), shin)) + weights[seat] = np.column_stack((1 - leg, leg * side, leg * (1 - side), np.zeros(len(leg)))) * (1 - shin_weight[:, None]) + weights[seat, 3] = shin_weight + + +def diffuse_garment_weights(attrs, triangles, joint_count): + """Smooth neighboring skin weights, including across UV seams.""" + used, indices = np.unique(triangles.reshape(-1), return_inverse=True) + positions = attrs['POSITION'][used] + _, welded = np.unique(np.round(positions, 5), axis=0, return_inverse=True) + triangles = welded[indices].reshape(-1, 3) + edges = np.concatenate([triangles[:, [0, 1]], triangles[:, [1, 2]], triangles[:, [2, 0]]]) + edges = np.unique(np.concatenate([edges, edges[:, ::-1]]), axis=0) + source, neighbor = edges[edges[:, 0] != edges[:, 1]].T + neighbors = np.bincount(source, minlength=int(welded.max()) + 1)[:, None] + weights = np.zeros((len(neighbors), joint_count), dtype=np.float64) + np.add.at(weights, (welded[:, None], attrs['JOINTS_0'][used]), attrs['WEIGHTS_0'][used]) + weights /= np.sum(weights, axis=1, keepdims=True) + for _ in range(5): + average = np.zeros_like(weights) + np.add.at(average, source, weights[neighbor]) + weights = np.where(neighbors, .4 * weights + .6 * average / np.maximum(neighbors, 1), weights) + strongest = np.argsort(-weights, axis=1, kind='stable')[:, :4][welded] + values = np.take_along_axis(weights[welded], strongest, axis=1) + attrs['JOINTS_0'][used] = strongest + attrs['WEIGHTS_0'][used] = values / np.sum(values, axis=1, keepdims=True) + + +def dress(source, target, person): + slippers = prepare(source, target, person) + asset = Asset(target) + d = asset.doc + body_node = next(i for i, n in enumerate(d['nodes']) if n.get('name') == 'Body') + body = d['meshes'][d['nodes'][body_node]['mesh']] + skin = d['skins'][d['nodes'][body_node]['skin']] + top = asset.material('Practice_Linen_Wrap', [.76, .79, .69, 1] if person == 'woman' else [.36, .46, .39, 1]) + bottom = asset.material('Practice_Linen_Skirt' if person == 'woman' else 'Practice_Relaxed_Trousers', + [.22, .36, .33, 1] if person == 'woman' else [.25, .29, .27, 1]) + trim = asset.material('Practice_Crossed_Cloth_Facing', [.16, .27, .24, 1]) + kept, changed, skirt, trims, cloth = [], [], [], [], [] + for primitive_index, primitive in enumerate(body['primitives']): + name = d['materials'][primitive['material']]['name'] + if 'CLOTH' not in name: + kept.append(primitive) + continue + attrs = {key: asset.read(index) for key, index in primitive['attributes'].items()} + triangles = asset.read(primitive['indices']).reshape(-1, 3) + if 'Tops' in name: + blend_sleeves(asset, attrs, skin) + if person == 'man': + # The hood and drawstrings have their own spring-bone weights. + hood = [i for i, node in enumerate(skin['joints']) if 'Hood' in d['nodes'][node].get('name', '')] + hood_weight = np.sum(np.where(np.isin(attrs['JOINTS_0'], hood), attrs['WEIGHTS_0'], 0), axis=1) + triangles = triangles[np.max(hood_weight[triangles], axis=1) < .01] + if person == 'woman': + lower = np.mean(attrs['POSITION'][triangles, 1], axis=1) < .975 + skirt.append(asset.primitive(attrs, triangles[lower], bottom)) + triangles = triangles[~lower] + if person == 'man': + diffuse_garment_weights(attrs, triangles, len(skin['joints'])) + top_attrs = copy.deepcopy(attrs) + cloth.append(asset.primitive(attrs, triangles, top)) + # Two overlapping facings describe a left-over-right wrap closure. + neck_y, waist_y = (1.375, 1.005) if person == 'woman' else (1.46, 1.06) + points = [(float(-.043 + u * .15), float(neck_y + u * (waist_y - neck_y))) for u in np.linspace(0, 1, 18)] + trims.append(ribbon(asset, top_attrs, points, .022, trim, np.unique(triangles))) + points = [(float(.043 - u * .087), float(neck_y - u * .18)) for u in np.linspace(0, 1, 10)] + trims.append(ribbon(asset, top_attrs, points, .018, trim, np.unique(triangles))) + # Fitted sash follows the waist surface, not a rigid accessory. + sash = np.abs(top_attrs['POSITION'][:, 1] - waist_y) < .035 + sash_triangles = asset.read(primitive['indices']).reshape(-1, 3) + sash_triangles = sash_triangles[np.all(sash[sash_triangles], axis=1)] + if len(sash_triangles): + top_attrs['POSITION'][:, 0] *= 1.008 + top_attrs['POSITION'][:, 2] *= 1.012 + trims.append(asset.primitive(top_attrs, sash_triangles, trim)) + else: + # Relax the trousers around each leg while leaving the ankle cuff. + blend_trouser_seat(asset, attrs, skin) + diffuse_garment_weights(attrs, triangles, len(skin['joints'])) + xyz = attrs['POSITION'] + used = np.unique(triangles) + u = np.clip((xyz[used, 1] - .10) / .88, 0, 1) + expansion = .022 * np.sin(np.pi * u) + # Expand around each leg's centre, rather than translating both + # walls outward and exposing skin at the inside of the trousers. + center_x = np.sign(xyz[used, 0]) * (.061 + .018 * np.clip((xyz[used, 1] - .45) / .45, 0, 1)) + radial_x = xyz[used, 0] - center_x + radial_z = xyz[used, 2] - .01 + length = np.maximum(np.sqrt(radial_x ** 2 + radial_z ** 2), 1e-6) + xyz[used, 0] += radial_x / length * expansion + xyz[used, 2] += radial_z / length * expansion + normals = np.zeros_like(attrs['NORMAL']) + cross = np.cross(xyz[triangles[:, 1]] - xyz[triangles[:, 0]], xyz[triangles[:, 2]] - xyz[triangles[:, 0]]) + for corner in range(3): + np.add.at(normals, triangles[:, corner], cross) + length = np.linalg.norm(normals, axis=1) + normals[length > 1e-8] /= length[length > 1e-8, None] + attrs['NORMAL'][used] = normals[used] + cloth.append(asset.primitive(attrs, triangles, bottom)) + changed.append({'original_primitive': primitive_index, 'original_material': name}) + body['primitives'] = kept + asset.mesh(body_node, 'PracticeClothing', cloth) + if skirt: + asset.mesh(body_node, 'PracticeSkirt', skirt) + asset.mesh(body_node, 'PracticeWrapFacings', trims) + # Removed hood springs have no visible geometry; keep skeleton compatibility. + asset.save(target) + slippers['output_sha256'] = sha(target) + return slippers, {'source_sha256': ORIGINAL[person], 'output_sha256': sha(target), + 'changed_body_primitives': changed, 'skirt_preserved': person == 'woman', + 'identity': 'Original face, hair, body, skeleton and flat slippers retained', + 'style': 'Matte linen cross-collar wrap, plain sash and flared skirt' if person == 'woman' + else 'Matte linen cross-collar tunic and relaxed trousers; hood/cord meshes removed'} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--source-dir', required=True, type=Path) + parser.add_argument('--output-dir', default=Path('shared/figure'), type=Path) + args = parser.parse_args() + slippers, attire = {}, {} + for person in ORIGINAL: + slippers[person], attire[person] = dress(args.source_dir / f'{person}.vrm', args.output_dir / f'{person}.vrm', person) + (args.output_dir / 'slippers.json').write_text(json.dumps(slippers, indent=2) + '\n') + (args.output_dir / 'attire.json').write_text(json.dumps(attire, indent=2) + '\n') + print('Prepared both traditional-inspired meditation outfits; original CC0 identities and flat slippers retained') + + +if __name__ == '__main__': + main() diff --git a/figure/tools/prepare_slippers.py b/figure/tools/prepare_slippers.py new file mode 100644 index 00000000..c35ab4a0 --- /dev/null +++ b/figure/tools/prepare_slippers.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python3 +"""Replace only the CC0 samples' shoe primitives with simple cloth slippers. + +Inputs must be the unmodified, checksummed VRoid samples (see MODELS.md). +Textures, body/clothing/hair geometry, skeleton, expressions and springs +are retained byte for byte. New slippers have one flat sole plane, no heel, +and rigid foot weights so heel/ball pivots preserve that measured plane. +""" +import argparse +import hashlib +import json +import math +from pathlib import Path +import struct + +import numpy as np + +ORIGINAL = { + 'woman': 'adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979', + 'man': '7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f', +} +COMPONENT = {5121: ' 0 else -1 + points = original_points[original_points[:, 0] * sign > 0] + lower, upper = points.min(axis=0), points.max(axis=0) + center_x = float((lower[0] + upper[0]) / 2) + center_z = float((lower[2] + upper[2]) / 2) + half_width = float((upper[0] - lower[0]) / 2) * .94 + half_length = float((upper[2] - lower[2]) / 2) * .96 + positions, indices = [], [] + # Thin flat underside, rounded cloth upper. No platform or heel block. + for ring in range(7): + angle = (ring - 1) / 5 * math.pi / 2 if ring > 0 else 0 + radius = math.cos(angle) if ring > 0 else 1 + height = .003 + .054 * math.sin(angle) if ring > 0 else 0 + for segment in range(segments): + theta = 2 * math.pi * segment / segments + # Toe is slightly broader than the heel, without a pointed tip. + width = half_width * (1 - .12 * math.cos(theta)) + positions.append([center_x + math.sin(theta) * width * radius, + height, center_z + math.cos(theta) * half_length * radius]) + positions.append([center_x, 0, center_z]) + center = len(positions) - 1 + for segment in range(segments): + after = (segment + 1) % segments + indices.extend([center, after, segment]) + for ring in range(6): + a, b = ring * segments + segment, ring * segments + after + c, d = a + segments, b + segments + indices.extend([a, b, c, b, d, c]) + positions = np.array(positions) + # Derive smooth normals from the generated triangles. + normals = np.zeros_like(positions) + for a, b, c in np.array(indices).reshape(-1, 3): + normal = np.cross(positions[b] - positions[a], positions[c] - positions[a]) + normals[[a, b, c]] += normal + lengths = np.linalg.norm(normals, axis=1) + normals[lengths > 0] /= lengths[lengths > 0, None] + joints = [[joint, 0, 0, 0]] * len(positions) + weights = [[1, 0, 0, 0]] * len(positions) + slippers['primitives'].append({'attributes': { + 'POSITION': append(positions, 5126, 'VEC3'), 'NORMAL': append(normals, 5126, 'VEC3'), + 'JOINTS_0': append(joints, 5123, 'VEC4'), 'WEIGHTS_0': append(weights, 5126, 'VEC4')}, + 'indices': append(np.array(indices).reshape(-1, 1), 5123, 'SCALAR'), 'material': material, 'mode': 4}) + measurements.append({'side': side, 'vertices': len(positions), 'sole_height': 0, + 'sole_flatness': 0, 'heel': [center_x, 0, center_z + half_length], + 'ball': [center_x, 0, center_z - half_length], + 'original_shoe_height': float(upper[1] - lower[1]), 'upper_height': .057}) + mesh_index = len(doc['meshes']) + doc['meshes'].append(slippers) + new_node = len(doc['nodes']) + # Preserve the source mesh-node transform and skin binding exactly. + doc['nodes'].append({**node, 'name': 'PracticeClothSlippers', 'mesh': mesh_index}) + parent = next((n for n in doc['nodes'][:new_node] if body_node in n.get('children', [])), None) + if parent is not None: + parent['children'].append(new_node) + else: + for scene in doc['scenes']: + if body_node in scene['nodes']: + scene['nodes'].append(new_node) + binary.extend(b'\0' * (-len(binary) % 4)) + doc['buffers'][0]['byteLength'] = len(binary) + encoded = json.dumps(doc, separators=(',', ':'), ensure_ascii=False).encode() + encoded += b' ' * (-len(encoded) % 4) + target.parent.mkdir(parents=True, exist_ok=True) + with target.open('wb') as stream: + stream.write(struct.pack(' (`vroid/beta/HairSample_Female.vrm` and `vroid/beta/HairSample_Male.vrm`). -- SHA-256: +- Original SHA-256: - `woman.vrm` adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979 - `man.vrm` 7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f - Format: VRM 0.x (glTF 2.0 binary with the `VRM` extension), PNG textures, a VRM humanoid skeleton with hair spring bones. 27,068 and 24,858 triangles. -They are loaded unchanged through Kryon's glTF importer (`figure_model`) -and drawn with the toon look the owner approved. Do not change their -appearance without asking the owner. +On 2026-11-18 the owner requested simple, flat cloth Tai Chi slippers for +both figures. `figure/tools/prepare_slippers.py` removes only the original +shoe primitives and adds closed, rounded cloth slippers: matte stone grey +for the woman and charcoal for the man, a 3 mm edge and 57 mm upper, with +one level underside and no heel or platform. The rest of the mesh, +textures, skeleton and VRM metadata is retained. Output checksums and sole +measurements are in `slippers.json`; the CC0 dedication still applies. + +Reproduce from the original files (checksums above), kept in the ignored +`backup/figure-source/` directory during development: + +```sh +python3 figure/tools/prepare_slippers.py --source-dir backup/figure-source +python3 tests/slippers_test.py --source-dir backup/figure-source +``` + +The originals can also be recovered from this repository's pre-slipper +revision or the source URLs above. The pipeline refuses modified input, +so re-running it never compounds a previous edit. No texture regeneration +or changes to the other clothing, hair or face are part of this edit. + +Kryon's importer loads these models through `figure_model`, using the +approved toon look. The retargeter measures actual sole vertices and fits +the foot length to the solver's heel/ball span, keeping both pivots fixed. +Only foot-only primitives use affine skinning for that length adjustment; +the rest retain volume-preserving dual-quaternion skinning. + +## Traditional meditation attire + +The owner's later request includes the clothes and explicitly keeps the +woman's skirt. `figure/tools/prepare_attire.py --source-dir +backup/figure-source` starts from the same checksummed originals, builds the +existing neutral flat slippers, and then replaces only clothing draw +primitives. The new matte linen colors, crossed cloth facings and fitted +sash form a calm traditional-inspired wrap. The woman retains the fitted +long-sleeve top and flared skirt silhouette; the man loses the hoodie/cord +geometry and gains a cross-collar tunic with relaxed trousers. Faces, +hair, bodies, skeleton, expressions, source texture bytes, CC0 metadata and +slipper geometry remain intact. Blended skin weights at the sleeves and +the trouser seat spread deformation through those joints. `attire.json` +records exact output identity and the source primitives replaced. + +The skirt is its own `PracticeSkirt` mesh. `figure_cloth` and +`FigureModelCloth` constrain its lower portion under gravity, outside leg +capsules and above the floor, while preserving the skinned waist seam. +Short edge-length constraints distribute the drape below the waist during +forward folds and lunges. The constraints use the pose at the requested +time, so seeking to a frame gives the same drape as playing it. The +pre-attire slippers and original models remain in ignored recovery storage. + +```sh +python3 figure/tools/prepare_attire.py --source-dir backup/figure-source +python3 tests/slippers_test.py --source-dir backup/figure-source +python3 tests/attire_test.py --source-dir backup/figure-source +``` diff --git a/shared/figure/README.md b/shared/figure/README.md index 070c501c..4fded9a6 100644 --- a/shared/figure/README.md +++ b/shared/figure/README.md @@ -9,3 +9,10 @@ veranda for astral projection. Their originals, prompts and checks are in `source/` (`provenance.json`); the stored backdrops have their colour made about 1.3 times as strong and are sized for phones. + +Each backdrop has a same-name JSON ground registration: source-image +horizon, a safe open-floor rectangle, cover crop, camera pitch and minimum +view height. Coordinates exclude the Tai Chi wall/stairs, Workout deck +edges/railings, Sun Salutation foliage and astral veranda railing. The +preview transforms these marks through the actual image crop and fits the +entire motion and contact shadow into the remaining floor. diff --git a/shared/figure/attire.json b/shared/figure/attire.json new file mode 100644 index 00000000..e83caed7 --- /dev/null +++ b/shared/figure/attire.json @@ -0,0 +1,32 @@ +{ + "woman": { + "source_sha256": "adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979", + "output_sha256": "f677800f355982139bdc59c471846c262eda6bbc2b13bd89a00a5591bac3a75c", + "changed_body_primitives": [ + { + "original_primitive": 4, + "original_material": "F00_002_01_Tops_01_CLOTH" + } + ], + "skirt_preserved": true, + "identity": "Original face, hair, body, skeleton and flat slippers retained", + "style": "Matte linen cross-collar wrap, plain sash and flared skirt" + }, + "man": { + "source_sha256": "7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f", + "output_sha256": "727443b67b3c30856976446cc3e644dc4074107bb67b970b5d342010a138c1ea", + "changed_body_primitives": [ + { + "original_primitive": 4, + "original_material": "M00_006_01_Tops_01_CLOTH" + }, + { + "original_primitive": 5, + "original_material": "M00_001_01_Bottoms_01_CLOTH" + } + ], + "skirt_preserved": false, + "identity": "Original face, hair, body, skeleton and flat slippers retained", + "style": "Matte linen cross-collar tunic and relaxed trousers; hood/cord meshes removed" + } +} diff --git a/shared/figure/backdrops/astral.json b/shared/figure/backdrops/astral.json new file mode 100644 index 00000000..5f79a558 --- /dev/null +++ b/shared/figure/backdrops/astral.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "image_width": 1280, + "image_height": 853, + "horizon": 0.71, + "floor_left": 0.18, + "floor_top": 0.78, + "floor_right": 0.82, + "floor_bottom": 0.96, + "zoom": 1.5, + "focus": 1.0, + "pitch": 0.22, + "minimum_view_height": 2.4, + "description": "Normalized source-image coordinates. Usable ground excludes walls, rails, plants, stairs and foreground edges. Camera fits the entire motion and shadow inside this area, with additional screen margins." +} diff --git a/shared/figure/backdrops/sun-salutation.json b/shared/figure/backdrops/sun-salutation.json new file mode 100644 index 00000000..93ff9cc2 --- /dev/null +++ b/shared/figure/backdrops/sun-salutation.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "image_width": 1280, + "image_height": 853, + "horizon": 0.79, + "floor_left": 0.4, + "floor_top": 0.87, + "floor_right": 0.6, + "floor_bottom": 0.97, + "zoom": 2.0, + "focus": 1.0, + "pitch": 0.22, + "minimum_view_height": 2.4, + "description": "Normalized source-image coordinates. Usable ground excludes walls, rails, plants, stairs and foreground edges. Camera fits the entire motion and shadow inside this area, with additional screen margins." +} diff --git a/shared/figure/backdrops/tai-chi.json b/shared/figure/backdrops/tai-chi.json new file mode 100644 index 00000000..56f62e6a --- /dev/null +++ b/shared/figure/backdrops/tai-chi.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "image_width": 1280, + "image_height": 853, + "horizon": 0.76, + "floor_left": 0.2, + "floor_top": 0.81, + "floor_right": 0.8, + "floor_bottom": 0.97, + "zoom": 1.6, + "focus": 1.0, + "pitch": 0.16, + "minimum_view_height": 2.4, + "description": "Normalized source-image coordinates. Usable ground excludes walls, rails, plants, stairs and foreground edges. Camera fits the entire motion and shadow inside this area, with additional screen margins." +} diff --git a/shared/figure/backdrops/workout.json b/shared/figure/backdrops/workout.json new file mode 100644 index 00000000..c106296f --- /dev/null +++ b/shared/figure/backdrops/workout.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "image_width": 1280, + "image_height": 853, + "horizon": 0.73, + "floor_left": 0.2, + "floor_top": 0.79, + "floor_right": 0.8, + "floor_bottom": 0.96, + "zoom": 1.6, + "focus": 1.0, + "pitch": 0.22, + "minimum_view_height": 2.4, + "description": "Normalized source-image coordinates. Usable ground excludes walls, rails, plants, stairs and foreground edges. Camera fits the entire motion and shadow inside this area, with additional screen margins." +} diff --git a/shared/figure/man.vrm b/shared/figure/man.vrm index 46e8c583..2b676792 100644 Binary files a/shared/figure/man.vrm and b/shared/figure/man.vrm differ diff --git a/shared/figure/slippers.json b/shared/figure/slippers.json new file mode 100644 index 00000000..16c18c90 --- /dev/null +++ b/shared/figure/slippers.json @@ -0,0 +1,86 @@ +{ + "woman": { + "source_sha256": "adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979", + "output_sha256": "f677800f355982139bdc59c471846c262eda6bbc2b13bd89a00a5591bac3a75c", + "slippers": [ + { + "side": "L", + "vertices": 225, + "sole_height": 0, + "sole_flatness": 0, + "heel": [ + -0.04924570769071579, + 0, + 0.07680007204413414 + ], + "ball": [ + -0.04924570769071579, + 0, + -0.11925879254937172 + ], + "original_shoe_height": 0.17255966365337372, + "upper_height": 0.057 + }, + { + "side": "R", + "vertices": 225, + "sole_height": 0, + "sole_flatness": 0, + "heel": [ + 0.049919672310352325, + 0, + 0.07680031567811965 + ], + "ball": [ + 0.049919672310352325, + 0, + -0.11925847738981246 + ], + "original_shoe_height": 0.17256003618240356, + "upper_height": 0.057 + } + ] + }, + "man": { + "source_sha256": "7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f", + "output_sha256": "727443b67b3c30856976446cc3e644dc4074107bb67b970b5d342010a138c1ea", + "slippers": [ + { + "side": "L", + "vertices": 225, + "sole_height": 0, + "sole_flatness": 0, + "heel": [ + -0.05338574945926666, + 0, + 0.0861485032737255 + ], + "ball": [ + -0.05338574945926666, + 0, + -0.17508904173970222 + ], + "original_shoe_height": 0.10461036115884781, + "upper_height": 0.057 + }, + { + "side": "R", + "vertices": 225, + "sole_height": 0, + "sole_flatness": 0, + "heel": [ + 0.05440085381269455, + 0, + 0.08614855796098708 + ], + "ball": [ + 0.05440085381269455, + 0, + -0.17508904427289962 + ], + "original_shoe_height": 0.10461036115884781, + "upper_height": 0.057 + } + ] + } +} diff --git a/shared/figure/woman.vrm b/shared/figure/woman.vrm index 0e5235f9..2c8df43d 100644 Binary files a/shared/figure/woman.vrm and b/shared/figure/woman.vrm differ diff --git a/taichi/voice-male/en/tai_chi_text_00229dc1.ogg b/taichi/voice-male/en/tai_chi_text_00229dc1.ogg index f94b734a..240b9a3a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_00229dc1.ogg and b/taichi/voice-male/en/tai_chi_text_00229dc1.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_08b08ec7.ogg b/taichi/voice-male/en/tai_chi_text_08b08ec7.ogg index 8cd96f2a..b39c67c8 100644 Binary files a/taichi/voice-male/en/tai_chi_text_08b08ec7.ogg and b/taichi/voice-male/en/tai_chi_text_08b08ec7.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_0b5e8f31.ogg b/taichi/voice-male/en/tai_chi_text_0b5e8f31.ogg index f87fde4f..b4bbc8ce 100644 Binary files a/taichi/voice-male/en/tai_chi_text_0b5e8f31.ogg and b/taichi/voice-male/en/tai_chi_text_0b5e8f31.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_0dba0da9.ogg b/taichi/voice-male/en/tai_chi_text_0dba0da9.ogg index 654b974a..99aaa4b4 100644 Binary files a/taichi/voice-male/en/tai_chi_text_0dba0da9.ogg and b/taichi/voice-male/en/tai_chi_text_0dba0da9.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_0e9377db.ogg b/taichi/voice-male/en/tai_chi_text_0e9377db.ogg index 31fb81a4..36b14939 100644 Binary files a/taichi/voice-male/en/tai_chi_text_0e9377db.ogg and b/taichi/voice-male/en/tai_chi_text_0e9377db.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_0fe484c6.ogg b/taichi/voice-male/en/tai_chi_text_0fe484c6.ogg index 4e53c93d..47de1a35 100644 Binary files a/taichi/voice-male/en/tai_chi_text_0fe484c6.ogg and b/taichi/voice-male/en/tai_chi_text_0fe484c6.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_1214228d.ogg b/taichi/voice-male/en/tai_chi_text_1214228d.ogg index 0d0cc6d8..f21ab7e7 100644 Binary files a/taichi/voice-male/en/tai_chi_text_1214228d.ogg and b/taichi/voice-male/en/tai_chi_text_1214228d.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_12ff1a98.ogg b/taichi/voice-male/en/tai_chi_text_12ff1a98.ogg index 4fafd95f..192cf1fc 100644 Binary files a/taichi/voice-male/en/tai_chi_text_12ff1a98.ogg and b/taichi/voice-male/en/tai_chi_text_12ff1a98.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_13255ee9.ogg b/taichi/voice-male/en/tai_chi_text_13255ee9.ogg index ec9cb6f0..5ed43d6f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_13255ee9.ogg and b/taichi/voice-male/en/tai_chi_text_13255ee9.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_1437fd9b.ogg b/taichi/voice-male/en/tai_chi_text_1437fd9b.ogg index e36cf797..bdd8b4d0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_1437fd9b.ogg and b/taichi/voice-male/en/tai_chi_text_1437fd9b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_1937e234.ogg b/taichi/voice-male/en/tai_chi_text_1937e234.ogg index 12d9d962..4d45ea22 100644 Binary files a/taichi/voice-male/en/tai_chi_text_1937e234.ogg and b/taichi/voice-male/en/tai_chi_text_1937e234.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_194bdd39.ogg b/taichi/voice-male/en/tai_chi_text_194bdd39.ogg index 3140a829..db1bac3a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_194bdd39.ogg and b/taichi/voice-male/en/tai_chi_text_194bdd39.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_1a5f3d9f.ogg b/taichi/voice-male/en/tai_chi_text_1a5f3d9f.ogg index c95cc557..318f6c82 100644 Binary files a/taichi/voice-male/en/tai_chi_text_1a5f3d9f.ogg and b/taichi/voice-male/en/tai_chi_text_1a5f3d9f.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_2333ef81.ogg b/taichi/voice-male/en/tai_chi_text_2333ef81.ogg index 1bcdac86..57c42027 100644 Binary files a/taichi/voice-male/en/tai_chi_text_2333ef81.ogg and b/taichi/voice-male/en/tai_chi_text_2333ef81.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_287f2a44.ogg b/taichi/voice-male/en/tai_chi_text_287f2a44.ogg index dcefd304..32afabcb 100644 Binary files a/taichi/voice-male/en/tai_chi_text_287f2a44.ogg and b/taichi/voice-male/en/tai_chi_text_287f2a44.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_2ba9b2aa.ogg b/taichi/voice-male/en/tai_chi_text_2ba9b2aa.ogg index 8f965a55..87256ac5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_2ba9b2aa.ogg and b/taichi/voice-male/en/tai_chi_text_2ba9b2aa.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_2c97926d.ogg b/taichi/voice-male/en/tai_chi_text_2c97926d.ogg index 86f29375..f4f74f5f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_2c97926d.ogg and b/taichi/voice-male/en/tai_chi_text_2c97926d.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_2d26a6c8.ogg b/taichi/voice-male/en/tai_chi_text_2d26a6c8.ogg index 1b6e3d40..ce4536c5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_2d26a6c8.ogg and b/taichi/voice-male/en/tai_chi_text_2d26a6c8.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_2f6f4e6b.ogg b/taichi/voice-male/en/tai_chi_text_2f6f4e6b.ogg index 90243ed3..9725731d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_2f6f4e6b.ogg and b/taichi/voice-male/en/tai_chi_text_2f6f4e6b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_30279255.ogg b/taichi/voice-male/en/tai_chi_text_30279255.ogg index 0b76bcce..42ebe415 100644 Binary files a/taichi/voice-male/en/tai_chi_text_30279255.ogg and b/taichi/voice-male/en/tai_chi_text_30279255.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_3128377c.ogg b/taichi/voice-male/en/tai_chi_text_3128377c.ogg index 02d3897e..723c321b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_3128377c.ogg and b/taichi/voice-male/en/tai_chi_text_3128377c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_316df868.ogg b/taichi/voice-male/en/tai_chi_text_316df868.ogg index dde37556..ecf33eaa 100644 Binary files a/taichi/voice-male/en/tai_chi_text_316df868.ogg and b/taichi/voice-male/en/tai_chi_text_316df868.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_328cc5d3.ogg b/taichi/voice-male/en/tai_chi_text_328cc5d3.ogg index a43a85d4..b3c6c194 100644 Binary files a/taichi/voice-male/en/tai_chi_text_328cc5d3.ogg and b/taichi/voice-male/en/tai_chi_text_328cc5d3.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_338c03db.ogg b/taichi/voice-male/en/tai_chi_text_338c03db.ogg index cac0c418..3c2c6c0a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_338c03db.ogg and b/taichi/voice-male/en/tai_chi_text_338c03db.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_35cb7125.ogg b/taichi/voice-male/en/tai_chi_text_35cb7125.ogg index f7d1b6a0..842be101 100644 Binary files a/taichi/voice-male/en/tai_chi_text_35cb7125.ogg and b/taichi/voice-male/en/tai_chi_text_35cb7125.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_3617ce6e.ogg b/taichi/voice-male/en/tai_chi_text_3617ce6e.ogg index 4e16c94f..af7d1184 100644 Binary files a/taichi/voice-male/en/tai_chi_text_3617ce6e.ogg and b/taichi/voice-male/en/tai_chi_text_3617ce6e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_392b8188.ogg b/taichi/voice-male/en/tai_chi_text_392b8188.ogg index ed0100ca..962522ad 100644 Binary files a/taichi/voice-male/en/tai_chi_text_392b8188.ogg and b/taichi/voice-male/en/tai_chi_text_392b8188.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_3a30a08c.ogg b/taichi/voice-male/en/tai_chi_text_3a30a08c.ogg index 2646987d..52b7e37f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_3a30a08c.ogg and b/taichi/voice-male/en/tai_chi_text_3a30a08c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_3ca9b632.ogg b/taichi/voice-male/en/tai_chi_text_3ca9b632.ogg index 11af1a6f..9b350014 100644 Binary files a/taichi/voice-male/en/tai_chi_text_3ca9b632.ogg and b/taichi/voice-male/en/tai_chi_text_3ca9b632.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_3da8ecf0.ogg b/taichi/voice-male/en/tai_chi_text_3da8ecf0.ogg index 180d66ca..f43ac19c 100644 Binary files a/taichi/voice-male/en/tai_chi_text_3da8ecf0.ogg and b/taichi/voice-male/en/tai_chi_text_3da8ecf0.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_40b3f289.ogg b/taichi/voice-male/en/tai_chi_text_40b3f289.ogg index 5a82796c..a528336a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_40b3f289.ogg and b/taichi/voice-male/en/tai_chi_text_40b3f289.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4203cee4.ogg b/taichi/voice-male/en/tai_chi_text_4203cee4.ogg index 63f61f66..52a928e8 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4203cee4.ogg and b/taichi/voice-male/en/tai_chi_text_4203cee4.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_44a8a247.ogg b/taichi/voice-male/en/tai_chi_text_44a8a247.ogg index e3590b24..701aa3f6 100644 Binary files a/taichi/voice-male/en/tai_chi_text_44a8a247.ogg and b/taichi/voice-male/en/tai_chi_text_44a8a247.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4524bf48.ogg b/taichi/voice-male/en/tai_chi_text_4524bf48.ogg index 371b2c75..cb871a0b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4524bf48.ogg and b/taichi/voice-male/en/tai_chi_text_4524bf48.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_46bf6666.ogg b/taichi/voice-male/en/tai_chi_text_46bf6666.ogg index 47b9e876..8f2cd76b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_46bf6666.ogg and b/taichi/voice-male/en/tai_chi_text_46bf6666.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_48b13590.ogg b/taichi/voice-male/en/tai_chi_text_48b13590.ogg index 3c18defc..f19bb423 100644 Binary files a/taichi/voice-male/en/tai_chi_text_48b13590.ogg and b/taichi/voice-male/en/tai_chi_text_48b13590.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4a7ada47.ogg b/taichi/voice-male/en/tai_chi_text_4a7ada47.ogg index 6a9f9ee3..037e1165 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4a7ada47.ogg and b/taichi/voice-male/en/tai_chi_text_4a7ada47.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4b426ba0.ogg b/taichi/voice-male/en/tai_chi_text_4b426ba0.ogg index 42445c1a..c185b7ed 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4b426ba0.ogg and b/taichi/voice-male/en/tai_chi_text_4b426ba0.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4b910289.ogg b/taichi/voice-male/en/tai_chi_text_4b910289.ogg index 417ab646..a88e9ab4 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4b910289.ogg and b/taichi/voice-male/en/tai_chi_text_4b910289.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4dccc8f9.ogg b/taichi/voice-male/en/tai_chi_text_4dccc8f9.ogg index 6465bf49..9d7b5e56 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4dccc8f9.ogg and b/taichi/voice-male/en/tai_chi_text_4dccc8f9.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_4e7482a9.ogg b/taichi/voice-male/en/tai_chi_text_4e7482a9.ogg index c98ddae1..4af5f78b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_4e7482a9.ogg and b/taichi/voice-male/en/tai_chi_text_4e7482a9.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_508fbf1c.ogg b/taichi/voice-male/en/tai_chi_text_508fbf1c.ogg index 224739a8..de167d03 100644 Binary files a/taichi/voice-male/en/tai_chi_text_508fbf1c.ogg and b/taichi/voice-male/en/tai_chi_text_508fbf1c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_535f60cc.ogg b/taichi/voice-male/en/tai_chi_text_535f60cc.ogg index 1a304bf6..ccfe6ad1 100644 Binary files a/taichi/voice-male/en/tai_chi_text_535f60cc.ogg and b/taichi/voice-male/en/tai_chi_text_535f60cc.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_53796e8e.ogg b/taichi/voice-male/en/tai_chi_text_53796e8e.ogg index 0613d4c1..4f110fd9 100644 Binary files a/taichi/voice-male/en/tai_chi_text_53796e8e.ogg and b/taichi/voice-male/en/tai_chi_text_53796e8e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_55550b8d.ogg b/taichi/voice-male/en/tai_chi_text_55550b8d.ogg index 86191702..daa5e2df 100644 Binary files a/taichi/voice-male/en/tai_chi_text_55550b8d.ogg and b/taichi/voice-male/en/tai_chi_text_55550b8d.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_5667f2f0.ogg b/taichi/voice-male/en/tai_chi_text_5667f2f0.ogg index 0d70cd0c..0c48be83 100644 Binary files a/taichi/voice-male/en/tai_chi_text_5667f2f0.ogg and b/taichi/voice-male/en/tai_chi_text_5667f2f0.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_56bd419c.ogg b/taichi/voice-male/en/tai_chi_text_56bd419c.ogg index 27492d45..c7769a1d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_56bd419c.ogg and b/taichi/voice-male/en/tai_chi_text_56bd419c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_584c7c86.ogg b/taichi/voice-male/en/tai_chi_text_584c7c86.ogg index befdad0d..c70d1877 100644 Binary files a/taichi/voice-male/en/tai_chi_text_584c7c86.ogg and b/taichi/voice-male/en/tai_chi_text_584c7c86.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_5e3d7daf.ogg b/taichi/voice-male/en/tai_chi_text_5e3d7daf.ogg index e3748274..0d16d6d6 100644 Binary files a/taichi/voice-male/en/tai_chi_text_5e3d7daf.ogg and b/taichi/voice-male/en/tai_chi_text_5e3d7daf.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_5e86b493.ogg b/taichi/voice-male/en/tai_chi_text_5e86b493.ogg index 8fbb73c3..851437cf 100644 Binary files a/taichi/voice-male/en/tai_chi_text_5e86b493.ogg and b/taichi/voice-male/en/tai_chi_text_5e86b493.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_5f77423c.ogg b/taichi/voice-male/en/tai_chi_text_5f77423c.ogg index 380514ae..301c75f8 100644 Binary files a/taichi/voice-male/en/tai_chi_text_5f77423c.ogg and b/taichi/voice-male/en/tai_chi_text_5f77423c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_60de7adf.ogg b/taichi/voice-male/en/tai_chi_text_60de7adf.ogg index f6fdadbb..038de529 100644 Binary files a/taichi/voice-male/en/tai_chi_text_60de7adf.ogg and b/taichi/voice-male/en/tai_chi_text_60de7adf.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_610d05a1.ogg b/taichi/voice-male/en/tai_chi_text_610d05a1.ogg index 11e32078..93ace5ee 100644 Binary files a/taichi/voice-male/en/tai_chi_text_610d05a1.ogg and b/taichi/voice-male/en/tai_chi_text_610d05a1.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_6398602f.ogg b/taichi/voice-male/en/tai_chi_text_6398602f.ogg index 9ac50c88..0c4b8181 100644 Binary files a/taichi/voice-male/en/tai_chi_text_6398602f.ogg and b/taichi/voice-male/en/tai_chi_text_6398602f.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_6f196c53.ogg b/taichi/voice-male/en/tai_chi_text_6f196c53.ogg index b40014bf..6e5772ec 100644 Binary files a/taichi/voice-male/en/tai_chi_text_6f196c53.ogg and b/taichi/voice-male/en/tai_chi_text_6f196c53.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_6f58c87c.ogg b/taichi/voice-male/en/tai_chi_text_6f58c87c.ogg index 9705b359..a83a6466 100644 Binary files a/taichi/voice-male/en/tai_chi_text_6f58c87c.ogg and b/taichi/voice-male/en/tai_chi_text_6f58c87c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_71318f62.ogg b/taichi/voice-male/en/tai_chi_text_71318f62.ogg index 84fff45e..2737d635 100644 Binary files a/taichi/voice-male/en/tai_chi_text_71318f62.ogg and b/taichi/voice-male/en/tai_chi_text_71318f62.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_71bd5408.ogg b/taichi/voice-male/en/tai_chi_text_71bd5408.ogg index b310f555..b0daa0d5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_71bd5408.ogg and b/taichi/voice-male/en/tai_chi_text_71bd5408.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_72d8ea7f.ogg b/taichi/voice-male/en/tai_chi_text_72d8ea7f.ogg index eb6bfe94..7c7b9cf0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_72d8ea7f.ogg and b/taichi/voice-male/en/tai_chi_text_72d8ea7f.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_72de89eb.ogg b/taichi/voice-male/en/tai_chi_text_72de89eb.ogg index ca4ad472..d5bcf2dc 100644 Binary files a/taichi/voice-male/en/tai_chi_text_72de89eb.ogg and b/taichi/voice-male/en/tai_chi_text_72de89eb.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7312f21d.ogg b/taichi/voice-male/en/tai_chi_text_7312f21d.ogg index 9b0b1307..200cb1c8 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7312f21d.ogg and b/taichi/voice-male/en/tai_chi_text_7312f21d.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_74770c0c.ogg b/taichi/voice-male/en/tai_chi_text_74770c0c.ogg index 1c1b9433..ab4c7f10 100644 Binary files a/taichi/voice-male/en/tai_chi_text_74770c0c.ogg and b/taichi/voice-male/en/tai_chi_text_74770c0c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7794d39b.ogg b/taichi/voice-male/en/tai_chi_text_7794d39b.ogg index f4a33195..3c06b393 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7794d39b.ogg and b/taichi/voice-male/en/tai_chi_text_7794d39b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_786ec098.ogg b/taichi/voice-male/en/tai_chi_text_786ec098.ogg index 0dd89357..6f017885 100644 Binary files a/taichi/voice-male/en/tai_chi_text_786ec098.ogg and b/taichi/voice-male/en/tai_chi_text_786ec098.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_796903cf.ogg b/taichi/voice-male/en/tai_chi_text_796903cf.ogg index e76c1d61..e1f03a5f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_796903cf.ogg and b/taichi/voice-male/en/tai_chi_text_796903cf.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7ba65469.ogg b/taichi/voice-male/en/tai_chi_text_7ba65469.ogg index c1c1535f..102b66e4 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7ba65469.ogg and b/taichi/voice-male/en/tai_chi_text_7ba65469.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7c4a698f.ogg b/taichi/voice-male/en/tai_chi_text_7c4a698f.ogg index 08414da4..ae31504e 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7c4a698f.ogg and b/taichi/voice-male/en/tai_chi_text_7c4a698f.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7e001382.ogg b/taichi/voice-male/en/tai_chi_text_7e001382.ogg index 376b45c5..f8b5041c 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7e001382.ogg and b/taichi/voice-male/en/tai_chi_text_7e001382.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_7fcb9855.ogg b/taichi/voice-male/en/tai_chi_text_7fcb9855.ogg index 71b0d6b7..0471cb24 100644 Binary files a/taichi/voice-male/en/tai_chi_text_7fcb9855.ogg and b/taichi/voice-male/en/tai_chi_text_7fcb9855.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_83f51909.ogg b/taichi/voice-male/en/tai_chi_text_83f51909.ogg index dda81057..48eec5e0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_83f51909.ogg and b/taichi/voice-male/en/tai_chi_text_83f51909.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_85a10dca.ogg b/taichi/voice-male/en/tai_chi_text_85a10dca.ogg index 2f1d3792..96c5e5f8 100644 Binary files a/taichi/voice-male/en/tai_chi_text_85a10dca.ogg and b/taichi/voice-male/en/tai_chi_text_85a10dca.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_86da993b.ogg b/taichi/voice-male/en/tai_chi_text_86da993b.ogg index fda692da..80cbd04f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_86da993b.ogg and b/taichi/voice-male/en/tai_chi_text_86da993b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_87bca4fb.ogg b/taichi/voice-male/en/tai_chi_text_87bca4fb.ogg index 36779b7c..12927231 100644 Binary files a/taichi/voice-male/en/tai_chi_text_87bca4fb.ogg and b/taichi/voice-male/en/tai_chi_text_87bca4fb.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_8803b8ed.ogg b/taichi/voice-male/en/tai_chi_text_8803b8ed.ogg index a389253e..e9fc7f90 100644 Binary files a/taichi/voice-male/en/tai_chi_text_8803b8ed.ogg and b/taichi/voice-male/en/tai_chi_text_8803b8ed.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_8929a7fe.ogg b/taichi/voice-male/en/tai_chi_text_8929a7fe.ogg index eba398ef..481fdc53 100644 Binary files a/taichi/voice-male/en/tai_chi_text_8929a7fe.ogg and b/taichi/voice-male/en/tai_chi_text_8929a7fe.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_89384f6b.ogg b/taichi/voice-male/en/tai_chi_text_89384f6b.ogg index 5e3c18e8..08f79f8b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_89384f6b.ogg and b/taichi/voice-male/en/tai_chi_text_89384f6b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_8a4ce4f0.ogg b/taichi/voice-male/en/tai_chi_text_8a4ce4f0.ogg index 3ffbc8db..0ce43d67 100644 Binary files a/taichi/voice-male/en/tai_chi_text_8a4ce4f0.ogg and b/taichi/voice-male/en/tai_chi_text_8a4ce4f0.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_925c46d6.ogg b/taichi/voice-male/en/tai_chi_text_925c46d6.ogg index 4d87d8ab..c59786af 100644 Binary files a/taichi/voice-male/en/tai_chi_text_925c46d6.ogg and b/taichi/voice-male/en/tai_chi_text_925c46d6.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_93e3c42a.ogg b/taichi/voice-male/en/tai_chi_text_93e3c42a.ogg index 9efa1c04..43073c60 100644 Binary files a/taichi/voice-male/en/tai_chi_text_93e3c42a.ogg and b/taichi/voice-male/en/tai_chi_text_93e3c42a.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_95f12cb4.ogg b/taichi/voice-male/en/tai_chi_text_95f12cb4.ogg index aa739c9e..72b7f473 100644 Binary files a/taichi/voice-male/en/tai_chi_text_95f12cb4.ogg and b/taichi/voice-male/en/tai_chi_text_95f12cb4.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_9622c4c4.ogg b/taichi/voice-male/en/tai_chi_text_9622c4c4.ogg index 1285635a..e1180b23 100644 Binary files a/taichi/voice-male/en/tai_chi_text_9622c4c4.ogg and b/taichi/voice-male/en/tai_chi_text_9622c4c4.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_9913a2b1.ogg b/taichi/voice-male/en/tai_chi_text_9913a2b1.ogg index 1d4b6e47..e2b356d1 100644 Binary files a/taichi/voice-male/en/tai_chi_text_9913a2b1.ogg and b/taichi/voice-male/en/tai_chi_text_9913a2b1.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_99dcdf63.ogg b/taichi/voice-male/en/tai_chi_text_99dcdf63.ogg index 699436c8..5a865d52 100644 Binary files a/taichi/voice-male/en/tai_chi_text_99dcdf63.ogg and b/taichi/voice-male/en/tai_chi_text_99dcdf63.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_9b49bb7e.ogg b/taichi/voice-male/en/tai_chi_text_9b49bb7e.ogg index 7499adf1..bdc1b66a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_9b49bb7e.ogg and b/taichi/voice-male/en/tai_chi_text_9b49bb7e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_a03d14bd.ogg b/taichi/voice-male/en/tai_chi_text_a03d14bd.ogg index 8680e53a..fa9c9390 100644 Binary files a/taichi/voice-male/en/tai_chi_text_a03d14bd.ogg and b/taichi/voice-male/en/tai_chi_text_a03d14bd.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_a0e9bcad.ogg b/taichi/voice-male/en/tai_chi_text_a0e9bcad.ogg index c3b61e09..323e70f5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_a0e9bcad.ogg and b/taichi/voice-male/en/tai_chi_text_a0e9bcad.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_a1db4e09.ogg b/taichi/voice-male/en/tai_chi_text_a1db4e09.ogg index 7df428fb..6bb0e3c9 100644 Binary files a/taichi/voice-male/en/tai_chi_text_a1db4e09.ogg and b/taichi/voice-male/en/tai_chi_text_a1db4e09.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_a7cb4b38.ogg b/taichi/voice-male/en/tai_chi_text_a7cb4b38.ogg index e9e6045c..b8c4af9a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_a7cb4b38.ogg and b/taichi/voice-male/en/tai_chi_text_a7cb4b38.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_a85fe981.ogg b/taichi/voice-male/en/tai_chi_text_a85fe981.ogg index 434a61d7..e29fcc51 100644 Binary files a/taichi/voice-male/en/tai_chi_text_a85fe981.ogg and b/taichi/voice-male/en/tai_chi_text_a85fe981.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ab8faccf.ogg b/taichi/voice-male/en/tai_chi_text_ab8faccf.ogg index 5746b5f8..d8c6b9f2 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ab8faccf.ogg and b/taichi/voice-male/en/tai_chi_text_ab8faccf.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_abdb135e.ogg b/taichi/voice-male/en/tai_chi_text_abdb135e.ogg index a367ec36..36d01b67 100644 Binary files a/taichi/voice-male/en/tai_chi_text_abdb135e.ogg and b/taichi/voice-male/en/tai_chi_text_abdb135e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ace0101e.ogg b/taichi/voice-male/en/tai_chi_text_ace0101e.ogg index ebfd648e..9eaa5b95 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ace0101e.ogg and b/taichi/voice-male/en/tai_chi_text_ace0101e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_adc6c353.ogg b/taichi/voice-male/en/tai_chi_text_adc6c353.ogg index f1726937..02cf177d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_adc6c353.ogg and b/taichi/voice-male/en/tai_chi_text_adc6c353.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_aee54a47.ogg b/taichi/voice-male/en/tai_chi_text_aee54a47.ogg index fe7ef9da..3d1af7d0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_aee54a47.ogg and b/taichi/voice-male/en/tai_chi_text_aee54a47.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_af663a26.ogg b/taichi/voice-male/en/tai_chi_text_af663a26.ogg index 4edb9eea..de2afe25 100644 Binary files a/taichi/voice-male/en/tai_chi_text_af663a26.ogg and b/taichi/voice-male/en/tai_chi_text_af663a26.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_afe043f6.ogg b/taichi/voice-male/en/tai_chi_text_afe043f6.ogg index bf7e92d0..701358c5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_afe043f6.ogg and b/taichi/voice-male/en/tai_chi_text_afe043f6.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_b2a8d2a1.ogg b/taichi/voice-male/en/tai_chi_text_b2a8d2a1.ogg index 887b6e3b..e956d5c5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_b2a8d2a1.ogg and b/taichi/voice-male/en/tai_chi_text_b2a8d2a1.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_b57f247e.ogg b/taichi/voice-male/en/tai_chi_text_b57f247e.ogg index 39463b3e..1fa60438 100644 Binary files a/taichi/voice-male/en/tai_chi_text_b57f247e.ogg and b/taichi/voice-male/en/tai_chi_text_b57f247e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_b6ed23c8.ogg b/taichi/voice-male/en/tai_chi_text_b6ed23c8.ogg index b7c7b72c..5ab0b673 100644 Binary files a/taichi/voice-male/en/tai_chi_text_b6ed23c8.ogg and b/taichi/voice-male/en/tai_chi_text_b6ed23c8.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_b7361414.ogg b/taichi/voice-male/en/tai_chi_text_b7361414.ogg index 6b2bcdb4..b5306ca6 100644 Binary files a/taichi/voice-male/en/tai_chi_text_b7361414.ogg and b/taichi/voice-male/en/tai_chi_text_b7361414.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_b9047f16.ogg b/taichi/voice-male/en/tai_chi_text_b9047f16.ogg index 97b2f2b5..a7f9e6c0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_b9047f16.ogg and b/taichi/voice-male/en/tai_chi_text_b9047f16.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_bd66dd01.ogg b/taichi/voice-male/en/tai_chi_text_bd66dd01.ogg index 7a9a0f5e..189b6857 100644 Binary files a/taichi/voice-male/en/tai_chi_text_bd66dd01.ogg and b/taichi/voice-male/en/tai_chi_text_bd66dd01.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_be6e86a3.ogg b/taichi/voice-male/en/tai_chi_text_be6e86a3.ogg index c68c553e..b2fd179d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_be6e86a3.ogg and b/taichi/voice-male/en/tai_chi_text_be6e86a3.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c17d2797.ogg b/taichi/voice-male/en/tai_chi_text_c17d2797.ogg index 35c5225c..15bc3a13 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c17d2797.ogg and b/taichi/voice-male/en/tai_chi_text_c17d2797.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c43383ad.ogg b/taichi/voice-male/en/tai_chi_text_c43383ad.ogg index c5aff332..50a92411 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c43383ad.ogg and b/taichi/voice-male/en/tai_chi_text_c43383ad.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c5a9c3f0.ogg b/taichi/voice-male/en/tai_chi_text_c5a9c3f0.ogg index d6ccb6c3..790de89e 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c5a9c3f0.ogg and b/taichi/voice-male/en/tai_chi_text_c5a9c3f0.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c90cc07e.ogg b/taichi/voice-male/en/tai_chi_text_c90cc07e.ogg index f0414294..b8f6bb9d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c90cc07e.ogg and b/taichi/voice-male/en/tai_chi_text_c90cc07e.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c96ac20b.ogg b/taichi/voice-male/en/tai_chi_text_c96ac20b.ogg index 49b5d6f2..20bfbd35 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c96ac20b.ogg and b/taichi/voice-male/en/tai_chi_text_c96ac20b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_c9f67d1a.ogg b/taichi/voice-male/en/tai_chi_text_c9f67d1a.ogg index 525e1bb1..ed6dc77f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_c9f67d1a.ogg and b/taichi/voice-male/en/tai_chi_text_c9f67d1a.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_caeaa03c.ogg b/taichi/voice-male/en/tai_chi_text_caeaa03c.ogg index 4bc4ed7c..58927d58 100644 Binary files a/taichi/voice-male/en/tai_chi_text_caeaa03c.ogg and b/taichi/voice-male/en/tai_chi_text_caeaa03c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_cbc10497.ogg b/taichi/voice-male/en/tai_chi_text_cbc10497.ogg index a5b6ff54..651c4ee7 100644 Binary files a/taichi/voice-male/en/tai_chi_text_cbc10497.ogg and b/taichi/voice-male/en/tai_chi_text_cbc10497.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_cc010dbb.ogg b/taichi/voice-male/en/tai_chi_text_cc010dbb.ogg index 0b86db3b..15731111 100644 Binary files a/taichi/voice-male/en/tai_chi_text_cc010dbb.ogg and b/taichi/voice-male/en/tai_chi_text_cc010dbb.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_cdbc70af.ogg b/taichi/voice-male/en/tai_chi_text_cdbc70af.ogg index 24284918..301d54f9 100644 Binary files a/taichi/voice-male/en/tai_chi_text_cdbc70af.ogg and b/taichi/voice-male/en/tai_chi_text_cdbc70af.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_d0493cf4.ogg b/taichi/voice-male/en/tai_chi_text_d0493cf4.ogg index 84c80b11..2ddc4ca5 100644 Binary files a/taichi/voice-male/en/tai_chi_text_d0493cf4.ogg and b/taichi/voice-male/en/tai_chi_text_d0493cf4.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_d0c03e0f.ogg b/taichi/voice-male/en/tai_chi_text_d0c03e0f.ogg index c7a004b6..885b1b4b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_d0c03e0f.ogg and b/taichi/voice-male/en/tai_chi_text_d0c03e0f.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_d424c53b.ogg b/taichi/voice-male/en/tai_chi_text_d424c53b.ogg index d714c1fb..1937669f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_d424c53b.ogg and b/taichi/voice-male/en/tai_chi_text_d424c53b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_d652fd8b.ogg b/taichi/voice-male/en/tai_chi_text_d652fd8b.ogg index 107c1438..ce77180a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_d652fd8b.ogg and b/taichi/voice-male/en/tai_chi_text_d652fd8b.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_d679385d.ogg b/taichi/voice-male/en/tai_chi_text_d679385d.ogg index dea9e9e3..dd52ee8e 100644 Binary files a/taichi/voice-male/en/tai_chi_text_d679385d.ogg and b/taichi/voice-male/en/tai_chi_text_d679385d.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_daeb3b51.ogg b/taichi/voice-male/en/tai_chi_text_daeb3b51.ogg index 62b077fe..14f5cf2d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_daeb3b51.ogg and b/taichi/voice-male/en/tai_chi_text_daeb3b51.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_dd827bc3.ogg b/taichi/voice-male/en/tai_chi_text_dd827bc3.ogg index 29322846..cd47a442 100644 Binary files a/taichi/voice-male/en/tai_chi_text_dd827bc3.ogg and b/taichi/voice-male/en/tai_chi_text_dd827bc3.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e2f5303c.ogg b/taichi/voice-male/en/tai_chi_text_e2f5303c.ogg index fac9fee8..9e566343 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e2f5303c.ogg and b/taichi/voice-male/en/tai_chi_text_e2f5303c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e3589954.ogg b/taichi/voice-male/en/tai_chi_text_e3589954.ogg index ec8f93fb..656bd1bc 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e3589954.ogg and b/taichi/voice-male/en/tai_chi_text_e3589954.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e4b82c74.ogg b/taichi/voice-male/en/tai_chi_text_e4b82c74.ogg index ee202677..9d2880d1 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e4b82c74.ogg and b/taichi/voice-male/en/tai_chi_text_e4b82c74.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e5523ea3.ogg b/taichi/voice-male/en/tai_chi_text_e5523ea3.ogg index 4bb248ae..5cf14991 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e5523ea3.ogg and b/taichi/voice-male/en/tai_chi_text_e5523ea3.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e5e697a6.ogg b/taichi/voice-male/en/tai_chi_text_e5e697a6.ogg index 9fef3b52..b87f787d 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e5e697a6.ogg and b/taichi/voice-male/en/tai_chi_text_e5e697a6.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_e8e9287c.ogg b/taichi/voice-male/en/tai_chi_text_e8e9287c.ogg index 252826b2..f5e3158a 100644 Binary files a/taichi/voice-male/en/tai_chi_text_e8e9287c.ogg and b/taichi/voice-male/en/tai_chi_text_e8e9287c.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ebc67770.ogg b/taichi/voice-male/en/tai_chi_text_ebc67770.ogg index a3433859..202a0c5b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ebc67770.ogg and b/taichi/voice-male/en/tai_chi_text_ebc67770.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ecd98771.ogg b/taichi/voice-male/en/tai_chi_text_ecd98771.ogg index 6f84798d..c5f6974e 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ecd98771.ogg and b/taichi/voice-male/en/tai_chi_text_ecd98771.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ed124b43.ogg b/taichi/voice-male/en/tai_chi_text_ed124b43.ogg index 7d73fb96..69a30b89 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ed124b43.ogg and b/taichi/voice-male/en/tai_chi_text_ed124b43.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ee334173.ogg b/taichi/voice-male/en/tai_chi_text_ee334173.ogg index cfa7e6b2..5cac7830 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ee334173.ogg and b/taichi/voice-male/en/tai_chi_text_ee334173.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_efa69898.ogg b/taichi/voice-male/en/tai_chi_text_efa69898.ogg index 415e9e8d..8f4b28d3 100644 Binary files a/taichi/voice-male/en/tai_chi_text_efa69898.ogg and b/taichi/voice-male/en/tai_chi_text_efa69898.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_eff03932.ogg b/taichi/voice-male/en/tai_chi_text_eff03932.ogg index a4827481..c71e9841 100644 Binary files a/taichi/voice-male/en/tai_chi_text_eff03932.ogg and b/taichi/voice-male/en/tai_chi_text_eff03932.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f02fde99.ogg b/taichi/voice-male/en/tai_chi_text_f02fde99.ogg index 2254ed0a..92f5012f 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f02fde99.ogg and b/taichi/voice-male/en/tai_chi_text_f02fde99.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f16dffea.ogg b/taichi/voice-male/en/tai_chi_text_f16dffea.ogg index cef18b18..a3aea71b 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f16dffea.ogg and b/taichi/voice-male/en/tai_chi_text_f16dffea.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f1a2b237.ogg b/taichi/voice-male/en/tai_chi_text_f1a2b237.ogg index 1b7f2b80..600e3812 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f1a2b237.ogg and b/taichi/voice-male/en/tai_chi_text_f1a2b237.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f5fe1734.ogg b/taichi/voice-male/en/tai_chi_text_f5fe1734.ogg index 5327a6e5..89db1f86 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f5fe1734.ogg and b/taichi/voice-male/en/tai_chi_text_f5fe1734.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f6afaebb.ogg b/taichi/voice-male/en/tai_chi_text_f6afaebb.ogg index d98c0af2..e2ff44f9 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f6afaebb.ogg and b/taichi/voice-male/en/tai_chi_text_f6afaebb.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f783fead.ogg b/taichi/voice-male/en/tai_chi_text_f783fead.ogg index f93604ea..8198cb46 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f783fead.ogg and b/taichi/voice-male/en/tai_chi_text_f783fead.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_f9865c85.ogg b/taichi/voice-male/en/tai_chi_text_f9865c85.ogg index df7920de..120e82e0 100644 Binary files a/taichi/voice-male/en/tai_chi_text_f9865c85.ogg and b/taichi/voice-male/en/tai_chi_text_f9865c85.ogg differ diff --git a/taichi/voice-male/en/tai_chi_text_ff433c2b.ogg b/taichi/voice-male/en/tai_chi_text_ff433c2b.ogg index 6179e3ef..16650009 100644 Binary files a/taichi/voice-male/en/tai_chi_text_ff433c2b.ogg and b/taichi/voice-male/en/tai_chi_text_ff433c2b.ogg differ diff --git a/taichi/voice/en/tai_chi_text_ff433c2b.ogg b/taichi/voice/en/tai_chi_text_ff433c2b.ogg index d557b102..b55586ba 100644 Binary files a/taichi/voice/en/tai_chi_text_ff433c2b.ogg and b/taichi/voice/en/tai_chi_text_ff433c2b.ogg differ diff --git a/tests/attire_test.py b/tests/attire_test.py new file mode 100644 index 00000000..1d4fa161 --- /dev/null +++ b/tests/attire_test.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Verify real garment edits preserve both selected identities and plain soles.""" +import argparse +from pathlib import Path +import sys +import numpy as np + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'figure/tools')) +from prepare_attire import Asset, ORIGINAL, sha +import json + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--source-dir', required=True, type=Path) + args = parser.parse_args() + root = Path('shared/figure') + receipts = json.loads((root / 'attire.json').read_text()) + for person in ('woman', 'man'): + original_path = args.source_dir / f'{person}.vrm' + target = root / f'{person}.vrm' + assert sha(original_path) == ORIGINAL[person] + old, new = Asset(original_path), Asset(target) + d, o = new.doc, old.doc + assert sha(target) == receipts[person]['output_sha256'] + assert new.binary[:len(old.binary)] == old.binary + assert d['extensions']['VRM']['meta'] == o['extensions']['VRM']['meta'] + assert d['extensions']['VRM']['meta']['licenseName'] == 'CC0' + for key in ('images', 'textures', 'samplers', 'skins'): + assert d[key] == o[key], (person, key) + for i, node in enumerate(o['nodes']): + # Appended garment nodes may be new children; original nodes stay. + assert {k: v for k, v in node.items() if k != 'children'} == {k: v for k, v in d['nodes'][i].items() if k != 'children'} + assert d['nodes'][i].get('children', [])[:len(node.get('children', []))] == node.get('children', []) + for i, mesh in enumerate(o['meshes']): + expected = [p for p in mesh['primitives'] if 'CLOTH' not in o['materials'][p['material']]['name']] + actual = [p for p in d['meshes'][i]['primitives'] if not d['materials'][p['material']]['name'].startswith('Practice_')] + assert actual == expected, (person, mesh.get('name')) + garments = [] + for mesh in d['meshes']: + for primitive in mesh['primitives']: + name = d['materials'][primitive['material']]['name'] + if not name.startswith('Practice_') or name == 'Practice_Matte_Cloth': + continue + garments.append((mesh, primitive)) + a = primitive['attributes'] + p, n = new.read(a['POSITION']), new.read(a['NORMAL']) + weights = new.read(a['WEIGHTS_0']) + indices = new.read(primitive['indices']) + assert np.isfinite(p).all() and np.isfinite(n).all() + assert np.allclose(weights.sum(1), 1, atol=1e-5) + assert indices.max() < len(p) + mat = d['materials'][primitive['material']]['pbrMetallicRoughness'] + assert mat['roughnessFactor'] == 1 and mat['metallicFactor'] == 0 + assert 'baseColorTexture' not in mat + assert garments and any(mesh['name'] == 'PracticeWrapFacings' for mesh, _ in garments) + if person == 'woman': + skirt = next(mesh for mesh, _ in garments if mesh.get('name') == 'PracticeSkirt') + points = new.read(skirt['primitives'][0]['attributes']['POSITION']) + assert .60 < points[:, 1].min() < .70 and np.ptp(points[:, 0]) > .45 + else: + body_node = next(n for n in d['nodes'] if n.get('name') == 'Body') + skin = d['skins'][body_node['skin']] + hood = [j for j, node in enumerate(skin['joints']) if 'Hood' in d['nodes'][node].get('name', '')] + for _, primitive in garments: + a = primitive['attributes'] + joints, weights = new.read(a['JOINTS_0']), new.read(a['WEIGHTS_0']) + assert np.max(np.where(np.isin(joints, hood), weights, 0)) < .01 + print(f'{person}: real linen wrap geometry, identity/CC0/texture/skeleton preserved; skirt retained or hood removed') + + +if __name__ == '__main__': + main() diff --git a/tests/figure_cloth_test.zi b/tests/figure_cloth_test.zi new file mode 100644 index 00000000..ab5a457f --- /dev/null +++ b/tests/figure_cloth_test.zi @@ -0,0 +1,47 @@ +// Gravity drape and body-contact constraints, independent of rendering. +#import "figure_math" +#import "figure_cloth" +#import "kryon/scene" +#import "std/math" + +main :: () -> s32 { + fail: s32 + hips := FigureV3(0.0, 0.90, 0.0) + rest_hips := FigureV3(0.0, 0.94, 0.0) + hem := FigureV3(0.2, 0.64, 0.05) + // A forward fold must not rotate the hem over the pelvis/head, even + // when the underlying rigid hip rotation crosses ninety degrees. + previous: Vector3 + for sample: 0..180 { + angle := cast(float64)sample * FIGURE_PI / 180.0 + rigid := FigureAdd(hips, FigureRotate(FigureAxisAngle(.{1.0, 0.0, 0.0}, angle), FigureSub(hem, rest_hips))) + draped := FigureClothHang(rigid, hem, rest_hips, hips, FigureIdentity(), 0.0, 1.0) + if FigureAbs(draped.y - 0.60) > 0.000001 || (sample > 0 && FigureDistance(draped, previous) > 0.001) { + fail += 1 + } + previous = draped + } + waist := FigureV3(0.1, 0.95, 0.0) + rigid_waist := FigureV3(0.12, 0.91, 0.02) + if FigureDistance(FigureClothHang(rigid_waist, waist, rest_hips, hips, FigureIdentity(), 0.0, 1.0), rigid_waist) > 0.000001 { + fail += 1 + } + // Cloth inside a thigh, its endpoint, or exactly on the centerline is + // projected outside the capsule without NaNs or moving the skeleton. + from := FigureV3(0.0, 0.8, 0.0) + to := FigureV3(0.0, 0.4, 0.0) + for sample: 0..20 { + point := FigureV3(0.01, 0.35 + cast(float64)sample * 0.025, 0.0) + out := FigureClothOutside(point, from, to, 0.078, .{1.0, 0.0, 0.0}) + nearest := FigureV3(0.0, FigureClamp(out.y, 0.4, 0.8), 0.0) + if !FigureFinite(out) || FigureDistance(out, nearest) < 0.077999 { + fail += 1 + } + } + center := FigureClothOutside(.{0.0, 0.6, 0.0}, from, to, 0.078, .{1.0, 0.0, 0.0}) + if !FigureFinite(center) || FigureAbs(center.x - 0.078) > 0.000001 { + fail += 1 + } + print("cloth constraints: % findings in fold/waist/capsule regressions\n", fail) + return fail +} diff --git a/tests/figure_model_pose_test.zi b/tests/figure_model_pose_test.zi new file mode 100644 index 00000000..863d2866 --- /dev/null +++ b/tests/figure_model_pose_test.zi @@ -0,0 +1,92 @@ +// Regression checks on the selected VRM skeletons, after model retargeting. +#import "figure_math" +#import "figure_joints" +#import "figure_model" +#import "kryon/scene" +#import "kryon/scene_gltf" +#import "std/math" + +ModelPoint :: (figure: *FigureModel, scene: *Scene, role: s32) -> Vector3 { + world := figure.instance.node_world[figure.bones[role]] + root := scene.nodes[figure.instance.root_node] + return FigureAdd(root.position, FigureScale(FigureRotate(figure.facing, + FigureV3(world.m[3], world.m[7], world.m[11])), root.scale.x)) +} + +ModelPose :: (phase: float64) -> FigureJoints { + pose: FigureJoints + pose.height = 1.65 + pose.pelvis = .{0.04 * Sin(phase), 0.82 + 0.025 * Cos(phase), 0.025 * Sin(phase)} + pose.pelvis_turn = FigureIdentity() + pose.chest_turn = FigureIdentity() + pose.head_turn = FigureIdentity() + pose.spine = FigureAdd(pose.pelvis, FigureV3(0.0, 0.12, 0.0)) + pose.chest = FigureAdd(pose.pelvis, FigureV3(0.0, 0.35, 0.0)) + pose.neck = FigureAdd(pose.pelvis, FigureV3(0.0, 0.55, 0.0)) + for side: cast(s32)0..1 { + sign := ifx side == 0 then 1.0 else -1.0 + hip := FigureAdd(pose.pelvis, FigureV3(sign * 0.09, -0.04, 0.0)) + ankle := FigureV3(sign * 0.12, 0.08, 0.0) + direction := FigureNormalize(FigureSub(ankle, hip)) + pole := FigureNormalize(FigureAddScaled(FigureV3(0.0, 0.0, 1.0), direction, -direction.z)) + half := FigureDistance(hip, ankle) * 0.5 + pose.hips[side] = hip + pose.knees[side] = FigureAddScaled(FigureLerp(hip, ankle, 0.5), pole, Sqrt(0.16 - half * half)) + pose.ankles[side] = ankle + pose.toes[side] = FigureAdd(ankle, FigureV3(0.0, -0.055, 0.14)) + pose.feet[side] = FigureIdentity() + pose.shoulders[side] = FigureAdd(pose.chest, FigureV3(sign * 0.17, 0.02, 0.0)) + pose.elbows[side] = FigureAdd(pose.chest, FigureV3(sign * 0.32, -0.12, 0.05)) + pose.wrists[side] = FigureAdd(pose.chest, FigureV3(sign * 0.4, -0.25, 0.15)) + pose.hands[side] = FigureMultiply(FigureAxisAngle(FigureV3(0.0, 1.0, 0.0), phase), + FigureAxisAngle(FigureV3(1.0, 0.0, 0.0), 0.35 * Sin(phase))) + } + return pose +} + +main :: () -> s32 { + fail: s32 + paths: [2]string = .["shared/figure/woman.vrm", "shared/figure/man.vrm"] + for path: paths { + scene: Scene + SceneInit(*scene) + defer SceneFree(*scene) + model: FigureModel + defer FigureModelRelease(*model) + if !FigureModelLoad(*model, *scene, path) { + print("model pose: could not load %\n", path) + return 1 + } + worst_ankle: float64 + worst_drift: float64 + worst_hand: float64 + worst_wrist: float64 + planted: [2]Vector3 + for sample: 0..12 { + pose := ModelPose(cast(float64)sample * FIGURE_PI / 6.0) + if !FigureModelPose(*model, *scene, *pose) { + return 1 + } + for side: cast(s32)0..1 { + ankle := ModelPoint(*model, *scene, FigureSideRole(side, FIGURE_FOOT)) + if sample == 0 { + planted[side] = ankle + } + worst_ankle = FigureMax(worst_ankle, FigureDistance(ankle, pose.ankles[side])) + worst_drift = FigureMax(worst_drift, FigureDistance(ankle, planted[side])) + wrist := ModelPoint(*model, *scene, FigureSideRole(side, FIGURE_HAND)) + worst_wrist = FigureMax(worst_wrist, FigureDistance(wrist, pose.wrists[side])) + middle := ModelPoint(*model, *scene, FigureFingerRole(side, 2, 0)) + pointing := FigureNormalize(FigureSub(middle, wrist)) + wanted := FigureRotate(pose.hands[side], FigureV3(0.0, -1.0, 0.0)) + worst_hand = FigureMax(worst_hand, FigureDistance(pointing, wanted)) + } + } + print("model pose: % ankle error % m, planted drift % m, wrist error % m, hand direction error %\n", + path, worst_ankle, worst_drift, worst_wrist, worst_hand) + if worst_ankle > 0.0001 || worst_drift > 0.0001 || worst_wrist > 0.0001 || worst_hand > 0.001 { + fail += 1 + } + } + return fail +} diff --git a/tests/figure_model_sole_test.zi b/tests/figure_model_sole_test.zi new file mode 100644 index 00000000..93f051bb --- /dev/null +++ b/tests/figure_model_sole_test.zi @@ -0,0 +1,127 @@ +// Measure the rendered, skinned slipper vertices, not ankle-bone guesses. +#import "figure_math" +#import "figure_joints" +#import "figure_model" +#import "figure_model_pose_test" +#import "kryon/scene" +#import "kryon/scene_gltf" +#import "std/math" + +SoleWorld :: (figure: *FigureModel, matrix: GltfMatrix, point: Vector3, scene: *Scene) -> Vector3 { + in_model := FigureV3(matrix.m[0] * point.x + matrix.m[1] * point.y + matrix.m[2] * point.z + matrix.m[3], + matrix.m[4] * point.x + matrix.m[5] * point.y + matrix.m[6] * point.z + matrix.m[7], + matrix.m[8] * point.x + matrix.m[9] * point.y + matrix.m[10] * point.z + matrix.m[11]) + root := scene.nodes[figure.instance.root_node] + return FigureAdd(root.position, FigureScale(FigureRotate(figure.facing, in_model), root.scale.x)) +} + +SoleCheck :: (figure: *FigureModel, scene: *Scene, path: string) -> s32 { + worst_gap: float64 + worst_flat: float64 + worst_pivot: float64 + measured: s64 + for mode: 0..3 { + for sample: 0..16 { + phase := cast(float64)sample * FIGURE_PI / 8.0 + pose := ModelPose(phase) + // Nearly straight, shifted stances exposed retargeting reach + // errors even when the solver's planted target was exact. + if mode == 3 { + shift := FigureV3(0.08 * Sin(phase), 0.06, 0.03 * Cos(phase)) + pose.pelvis = FigureAdd(pose.pelvis, shift) + for side: cast(s32)0..1 { + pose.hips[side] = FigureAdd(pose.hips[side], shift) + } + } + angle: float64 + if mode == 1 || mode == 2 { + angle = (ifx mode == 1 then -0.7 else 0.7) * cast(float64)sample / 16.0 + } + foot := FigureAxisAngle(FigureV3(1.0, 0.0, 0.0), angle) + for side: cast(s32)0..1 { + x := ifx side == 0 then 0.12 else -0.12 + contact := FigureV3(x, 0.0, ifx mode == 2 then 0.138 else -0.055) + relative := FigureV3(0.0, -0.08, ifx mode == 2 then 0.138 else -0.055) + pose.ankles[side] = FigureSub(contact, FigureRotate(foot, relative)) + pose.feet[side] = foot + pose.heels[side] = FigureAdd(pose.ankles[side], FigureRotate(foot, FigureV3(0.0, -0.08, -0.055))) + pose.balls[side] = FigureAdd(pose.ankles[side], FigureRotate(foot, FigureV3(0.0, -0.08, 0.138))) + pose.toes[side] = pose.balls[side] + direction := FigureNormalize(FigureSub(pose.ankles[side], pose.hips[side])) + pole := FigureNormalize(FigureAddScaled(FigureV3(0.0, 0.0, 1.0), direction, -direction.z)) + half := FigureDistance(pose.hips[side], pose.ankles[side]) * 0.5 + pose.knees[side] = FigureAddScaled(FigureLerp(pose.hips[side], pose.ankles[side], 0.5), + pole, Sqrt(FigureMax(0.16 - half * half, 0.0))) + } + if !FigureModelPose(figure, scene, *pose) { + return 1 + } + for mesh_index: 0..figure.instance.meshes.count - 1 { + inst := *figure.instance.meshes[mesh_index] + source_mesh := *figure.model.meshes[inst.mesh_index] + if TextView(source_mesh.name[:]) != "PracticeClothSlippers" { + continue + } + side := inst.primitive_index + mesh := scene.meshes[scene.nodes[inst.scene_node].mesh] + low: float64 = 1000.0 + high: float64 = -1000.0 + back: float64 = 1000.0 + front: float64 = -1000.0 + heel: Vector3 + ball: Vector3 + for vertex: 0..inst.skin.positions.count - 1 { + rest := inst.skin.positions[vertex] + if FigureAbs(rest.y) > 0.000001 { + continue + } + actual := SoleWorld(figure, figure.instance.node_world[inst.gltf_node], + scene.positions[mesh.first_vertex + vertex], scene) + low = FigureMin(low, actual.y) + high = FigureMax(high, actual.y) + facing := FigureRotate(figure.facing, rest) + if facing.z < back { + back = facing.z + heel = actual + } + if facing.z > front { + front = facing.z + ball = actual + } + measured += 1 + } + worst_gap = FigureMax(worst_gap, FigureAbs(low)) + if mode == 0 || mode == 3 { + worst_flat = FigureMax(worst_flat, high - low) + } + actual := ifx mode == 2 then ball else heel + target := ifx mode == 2 then pose.balls[side] else pose.heels[side] + worst_pivot = FigureMax(worst_pivot, FigureDistance(actual, target)) + } + } + } + print("sole test: % vertices %, floor error % m, flatness % m, heel/ball pivot error % m\n", + path, measured, worst_gap, worst_flat, worst_pivot) + return ifx measured < 1000 || worst_gap >= 0.001 || worst_flat >= 0.001 || worst_pivot >= 0.001 then 1 else 0 +} + +main :: () -> s32 { + fail: s32 + paths: [2]string = .["shared/figure/woman.vrm", "shared/figure/man.vrm"] + model: FigureModel + defer FigureModelRelease(*model) + for path: paths { + scene: Scene + SceneInit(*scene) + defer SceneFree(*scene) + if !FigureModelLoad(*model, *scene, path) { + return 1 + } + if model.sole_count[0] != 33 || model.sole_count[1] != 33 { + print("sole test: stale measurements after loading %\n", path) + return 1 + } + fail += SoleCheck(*model, *scene, path) + } + return fail +} diff --git a/tests/figure_parts_test.zi b/tests/figure_parts_test.zi index a96662a1..74d86b0d 100644 --- a/tests/figure_parts_test.zi +++ b/tests/figure_parts_test.zi @@ -97,6 +97,25 @@ main :: () -> s32 { open += ifx closed < 0.01 then 1 else 0 } fail += Check(FigureBlink(-1.0) == 0.0 && shut >= 15 && open > 1600, "her eyes blink now and then") + gaze_pose: FigureJoints + gaze_pose.chest_turn = FigureIdentity() + gaze_pose.head_turn = FigureAxisAngle(FigureV3(0.0, 1.0, 0.0), FIGURE_PI / 6.0) + gaze := FigureGaze(*gaze_pose) + fail += Check(gaze.x > 5.9 && gaze.x < 6.1 && FigureAbs(gaze.y) < 0.000001, + "eyes gently lead a cued head turn") + gaze_pose.head_turn = FigureIdentity() + fail += Check(FigureLength(FigureGaze(*gaze_pose)) < 0.000001, "eyes rest looking forward") + for finger: cast(s32)0..4 { + for segment: cast(s32)0..2 { + relaxed := FigureFingerCurl(0.0, 0.0, finger, segment) + fist := FigureFingerCurl(1.0, 0.0, finger, segment) + hook := FigureFingerCurl(0.0, 1.0, finger, segment) + fail += Check(relaxed > 0.0 && relaxed < 0.3 && fist > relaxed && fist <= 1.35, + "relaxed fingers curl gently and a fist closes them") + fail += Check((segment == 0 && hook == relaxed) || (segment > 0 && hook > relaxed), + "a hook curls finger tips without clenching knuckles") + } + } if fail == 0 { print("Figure parts local tests passed\n") } diff --git a/tests/slippers_test.py b/tests/slippers_test.py new file mode 100644 index 00000000..888c4030 --- /dev/null +++ b/tests/slippers_test.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Validate the shipped slipper geometry, skin bindings and CC0 metadata.""" +import argparse +import hashlib +import json +from pathlib import Path +import struct +import numpy as np + + +def load(path): + with path.open('rb') as stream: + assert struct.unpack('