Render the practice figures with barefoot contact and sleeve clearance
This commit is contained in:
1 parent
acd695550f
commit
d82bcc2565
15 files changed
+453
-444
No files matched your search
+10
-9
@@ -28,13 +28,16 @@ The modules:
|
||||
`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
|
||||
its measured barefoot support on the solver's heel/ball contacts. The
|
||||
clavicles lift and move forward with the upper arms. The wrist follows the
|
||||
solver's palm frame and shares part of its axial turn with the forearm.
|
||||
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.
|
||||
- `figure_stage` retains the model and renders it to a transparent pixel
|
||||
buffer with a fixed orthographic camera. It accepts the bundled VRM
|
||||
bytes and shares the same camera geometry with the preview.
|
||||
|
||||
The practices' backdrops are in `shared/figure/backdrops/`. The owner's
|
||||
references for the render quality are in `design/reference/`.
|
||||
@@ -48,7 +51,6 @@ for suite in figure_parts_test figure_model_pose_test figure_model_sole_test fig
|
||||
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
|
||||
```
|
||||
|
||||
@@ -59,17 +61,16 @@ 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 ankles as the pelvis
|
||||
moves over fixed foot targets. It also checks clavicle motion on a high
|
||||
reach and sweeps the palm through a full turn at a fixed wrist and elbow.
|
||||
reach, sweeps the palm through a full turn at a fixed wrist and elbow,
|
||||
and measures skirt clearance as the forearm sweeps across a low reach.
|
||||
|
||||
`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.
|
||||
flatness and pivot limit. `attire_test.py` checks the soles against the
|
||||
original CC0 skin mesh and verifies the reconstructed figures' textures,
|
||||
skeleton and clothing. See `shared/figure/MODELS.md` for reproduction.
|
||||
|
||||
`figure_cloth` drapes the skirt hem, resolves leg-capsule contacts and
|
||||
`figure_cloth` drapes the skirt hem, resolves leg and sleeve contacts and
|
||||
shares displacement across nearby fabric edges. `figure_model` applies
|
||||
those constraints to the named skirt after skinning. The attire generator
|
||||
grades sleeve weights across the elbow and fits the man's shoulder and
|
||||
|
||||
+110
-22
@@ -106,10 +106,33 @@ FigureFingerRole :: (side: s32, finger: s32, segment: s32) -> s32 {
|
||||
// The model's own animations are not used. False when the file is not a
|
||||
// valid model or has no hips, legs and arms.
|
||||
FigureModelLoad :: (figure: *FigureModel, scene: *Scene, path: string) -> bool {
|
||||
FigureModelRelease(figure)
|
||||
loaded := GltfReadFile(path)
|
||||
FigureTakeModel(*figure.model, *loaded)
|
||||
GltfModelRelease(*loaded)
|
||||
defer GltfModelRelease(*loaded)
|
||||
if !FigureModelUse(figure, scene, *loaded) {
|
||||
return false
|
||||
}
|
||||
if VrmReadFile(*figure.avatar, path) {
|
||||
unused VrmSpringsReset(*figure.avatar, *figure.model, *figure.instance)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Package assets are already in memory on desktop, Android and Web.
|
||||
FigureModelLoadBytes :: (figure: *FigureModel, scene: *Scene, bytes: []u8) -> bool {
|
||||
loaded := GltfReadBytes(bytes)
|
||||
defer GltfModelRelease(*loaded)
|
||||
if !FigureModelUse(figure, scene, *loaded) {
|
||||
return false
|
||||
}
|
||||
if VrmReadBytes(*figure.avatar, bytes) {
|
||||
unused VrmSpringsReset(*figure.avatar, *figure.model, *figure.instance)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
FigureModelUse :: (figure: *FigureModel, scene: *Scene, loaded: *GltfModel) -> bool {
|
||||
FigureModelRelease(figure)
|
||||
FigureTakeModel(*figure.model, loaded)
|
||||
if !figure.model.valid || !GltfSceneCreate(scene, *figure.model, *figure.instance) {
|
||||
return false
|
||||
}
|
||||
@@ -201,10 +224,6 @@ FigureModelLoad :: (figure: *FigureModel, scene: *Scene, path: string) -> bool {
|
||||
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)
|
||||
}
|
||||
figure.clock = -1.0
|
||||
figure.ready = true
|
||||
return true
|
||||
@@ -248,8 +267,8 @@ FigureModelPose :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints,
|
||||
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
|
||||
// The prepared slipper sole is level at rest. Toe-bone direction
|
||||
// is anatomical, not the sole plane; aiming it tilted planted shoes.
|
||||
// The calibrated foot sole is level at rest. Toe-bone direction
|
||||
// is anatomical, not the sole plane; aiming it tilted planted feet.
|
||||
foot := FigureQuatNormalize(joints.feet[side])
|
||||
turns[FigureSideRole(side, FIGURE_FOOT)] = foot
|
||||
turns[FigureSideRole(side, FIGURE_TOES)] = foot
|
||||
@@ -295,12 +314,12 @@ FigureModelPose :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints,
|
||||
}
|
||||
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(feet_targets[side], ankle), 0.5))
|
||||
}
|
||||
// Keep authored pelvis translation. Averaging the ankles inferred from
|
||||
// rotating model bones shifts the whole root during a weight transfer,
|
||||
// even when both feet stay planted in the solver.
|
||||
model_pelvis := FigureScale(FigureRotate(figure.facing,
|
||||
FigureModelPosed(figure, figure.bones[FIGURE_HIPS])), scale)
|
||||
offset := FigureSub(joints.pelvis, model_pelvis)
|
||||
// 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.
|
||||
@@ -358,12 +377,57 @@ FigureModelPose :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints,
|
||||
if !GltfUpdateScene(*figure.model, *figure.instance, scene) {
|
||||
return false
|
||||
}
|
||||
FigureModelToeContact(figure, scene, joints)
|
||||
FigureModelCloth(figure, scene, joints)
|
||||
return true
|
||||
}
|
||||
|
||||
// Let the toes flex along the floor as the heel rises. The surface beyond
|
||||
// the ball follows the forefoot correction across its whole thickness.
|
||||
FigureModelToeContact :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints) {
|
||||
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[:]) != "PracticeBareFeet" {
|
||||
continue
|
||||
}
|
||||
side := inst.primitive_index
|
||||
turn := FigureQuatNormalize(joints.feet[side])
|
||||
up := FigureRotate(turn, .{0.0, 1.0, 0.0})
|
||||
if up.y < 0.1 || FigureDistance(joints.heels[side], joints.balls[side]) < 0.01 {
|
||||
continue
|
||||
}
|
||||
heel_down := joints.heels[side].y <= joints.balls[side].y
|
||||
anchor := ifx heel_down then joints.heels[side] else joints.balls[side]
|
||||
rest := ifx heel_down then figure.sole_heel[side] else figure.sole_ball[side]
|
||||
// A lifted leg needs no contact adjustment once its toes clear.
|
||||
ankle := FigureModelRest(figure, FigureSideRole(side, FIGURE_FOOT), -1)
|
||||
matrix := figure.instance.node_world[inst.gltf_node]
|
||||
mesh := scene.meshes[scene.nodes[inst.scene_node].mesh]
|
||||
local_up := FigureV3(matrix.m[4], matrix.m[5], matrix.m[6])
|
||||
slope := FigureDot(local_up, local_up) * root.scale.x
|
||||
if slope <= 0.000001 { continue }
|
||||
changed := false
|
||||
for vertex: 0..inst.skin.positions.count - 1 {
|
||||
from_ankle := FigureRotate(figure.facing, FigureSub(inst.skin.positions[vertex], ankle))
|
||||
from_pivot := FigureV3(from_ankle.x - rest.x, 0.0,
|
||||
(from_ankle.z - rest.z) * figure.foot_stretch[side])
|
||||
level := anchor.y + FigureRotate(turn, FigureScale(from_pivot, root.scale.x)).y
|
||||
point := *scene.positions[mesh.first_vertex + vertex]
|
||||
height := root.position.y + (FigureDot(local_up, <<point) + matrix.m[7]) * root.scale.x
|
||||
lift := -FigureMin(level, height)
|
||||
if lift > 0.0000001 {
|
||||
<<point = FigureAddScaled(<<point, local_up, lift / slope)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if changed { ComputeNormals(scene, inst.scene_node) }
|
||||
}
|
||||
}
|
||||
|
||||
// Drape only the named skirt emitted by prepare_attire.py. Other garment,
|
||||
// body, hair and slipper skins retain their existing deformation.
|
||||
// body, hair and foot skins retain their existing deformation.
|
||||
FigureModelCloth :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints) {
|
||||
root := scene.nodes[figure.instance.root_node]
|
||||
scale := root.scale.x
|
||||
@@ -374,12 +438,23 @@ FigureModelCloth :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints)
|
||||
yaw := ifx lateral.x * lateral.x + lateral.z * lateral.z > 0.000001 then Atan2(-lateral.z, lateral.x) else Atan2(forward.x, forward.z)
|
||||
cloth_turn := FigureMultiply(FigureAxisAngle(.{0.0, 1.0, 0.0}, yaw), figure.facing)
|
||||
legs: [6]Vector3
|
||||
arms: [6]Vector3
|
||||
sleeves: [2]bool
|
||||
thighs: [2]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))
|
||||
thighs[side] = FigureNormalize(FigureSub(legs[side * 3 + 1], legs[side * 3]))
|
||||
upper := FigureSideRole(side, FIGURE_UPPER_ARM)
|
||||
lower := FigureSideRole(side, FIGURE_LOWER_ARM)
|
||||
hand := FigureSideRole(side, FIGURE_HAND)
|
||||
sleeves[side] = figure.bones[upper] >= 0 && figure.bones[lower] >= 0 && figure.bones[hand] >= 0
|
||||
if sleeves[side] {
|
||||
arms[side * 3] = FigureModelWorld(figure, scene, upper)
|
||||
arms[side * 3 + 1] = FigureModelWorld(figure, scene, lower)
|
||||
arms[side * 3 + 2] = FigureModelWorld(figure, scene, hand)
|
||||
}
|
||||
}
|
||||
for index: 0..figure.instance.meshes.count - 1 {
|
||||
inst := *figure.instance.meshes[index]
|
||||
@@ -410,6 +485,15 @@ FigureModelCloth :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoints)
|
||||
point = FigureLerp(point, outside, loose)
|
||||
outside = FigureClothOutside(point, legs[side * 3 + 1], legs[side * 3 + 2], 0.054 * scale, outward)
|
||||
point = FigureLerp(point, outside, loose)
|
||||
// Loose cloth can reach the forearm in low reaches
|
||||
// and the upper sleeve during a fold. Resolve both
|
||||
// against the skinned rig, keeping the waist pinned.
|
||||
if sleeves[side] {
|
||||
outside = FigureClothOutside(point, arms[side * 3], arms[side * 3 + 1], 0.071 * scale, outward)
|
||||
point = FigureLerp(point, outside, loose)
|
||||
outside = FigureClothOutside(point, arms[side * 3 + 1], arms[side * 3 + 2], 0.062 * scale, outward)
|
||||
point = FigureLerp(point, outside, loose)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,7 +576,7 @@ FigureGaze :: (joints: *FigureJoints) -> Vector3 {
|
||||
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
|
||||
// Place the measured foot 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 {
|
||||
@@ -515,7 +599,7 @@ FigureModelSoleTarget :: (figure: *FigureModel, joints: *FigureJoints, side: s32
|
||||
return target
|
||||
}
|
||||
|
||||
// Measurements from the actual skinned slipper vertices in the scene.
|
||||
// Measurements from the actual skinned plantar vertices in the scene.
|
||||
// Only contacts on the floor with the sole facing upward are planted.
|
||||
FigureContactMeasure :: struct {
|
||||
vertices: s64
|
||||
@@ -530,7 +614,7 @@ FigureModelContacts :: (figure: *FigureModel, scene: *Scene, joints: *FigureJoin
|
||||
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" {
|
||||
if !FigureSoleMesh(TextView(source.name[:])) {
|
||||
continue
|
||||
}
|
||||
side := inst.primitive_index
|
||||
@@ -756,14 +840,18 @@ 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.
|
||||
// The plantars use a rigid foot weight. Measure the actual underside
|
||||
// vertices to establish the heel and forefoot pivots.
|
||||
FigureSoleMesh :: (name: string) -> bool {
|
||||
return name == "PracticeBareFeet" || name == "PracticeClothSlippers"
|
||||
}
|
||||
|
||||
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 {
|
||||
if !FigureSoleMesh(TextView(mesh.name[:])) || mesh.primitives.count != 2 {
|
||||
continue
|
||||
}
|
||||
for side: cast(s32)0..1 {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// Retained render-thread scene for presenting a practice figure.
|
||||
#import "figure_math"
|
||||
#import "figure_joints"
|
||||
#import "figure_model"
|
||||
#import "kryon/scene"
|
||||
#import "kryon/scene_render"
|
||||
#import "kryon/drawing_props"
|
||||
#import "std/math"
|
||||
#import "std/vec"
|
||||
Raster :: #import "std/image";
|
||||
#if OS == .LINUX || OS == .ANDROID || OS == .WEB {
|
||||
GPU :: #import "kryon/scene_gpu";
|
||||
}
|
||||
|
||||
FigureStage :: struct {
|
||||
scene: Scene
|
||||
model: FigureModel
|
||||
pixels: Raster.Image
|
||||
#if OS == .LINUX || OS == .ANDROID || OS == .WEB {
|
||||
gpu: GPU.SceneGpuContext
|
||||
}
|
||||
}
|
||||
|
||||
FigureCamera :: (center: Vector3, yaw: float64, pitch: float64,
|
||||
span: float64, aspect: float64) -> SceneCamera {
|
||||
half_height := span / 2.0
|
||||
half_width := half_height * aspect
|
||||
toward := FigureV3(Sin(yaw) * Cos(pitch), Sin(pitch), Cos(yaw) * Cos(pitch))
|
||||
camera := OrthographicCamera(-half_width, half_width, half_height, -half_height, 0.05, 30.0)
|
||||
camera.target = center
|
||||
camera.position = FigureAddScaled(center, toward, 8.0)
|
||||
camera.up = .{0.0, 1.0, 0.0}
|
||||
return camera
|
||||
}
|
||||
|
||||
// Transform the camera inversely so the posed character moves as one body.
|
||||
FigureCameraPlaced :: (camera: SceneCamera, offset: Vector3, pivot: Vector3, roll: float64) -> SceneCamera {
|
||||
result := camera
|
||||
inverse := FigureAxisAngle(.{0.0, 0.0, 1.0}, -roll)
|
||||
result.target = FigureAdd(pivot, FigureRotate(inverse, FigureSub(FigureSub(camera.target, offset), pivot)))
|
||||
result.position = FigureAdd(pivot, FigureRotate(inverse, FigureSub(FigureSub(camera.position, offset), pivot)))
|
||||
result.up = FigureRotate(inverse, camera.up)
|
||||
return result
|
||||
}
|
||||
|
||||
FigureStageInit :: (stage: *FigureStage) {
|
||||
SceneInit(*stage.scene)
|
||||
stage.scene.background = .{0, 0, 0, 0}
|
||||
AddHemisphereLight(*stage.scene, .{255, 249, 236, 255}, .{109, 115, 99, 255}, 0.7)
|
||||
unused AddDirectionalLight(*stage.scene, .{255, 248, 235, 255}, 0.6, .{-3.0, 6.0, 4.0})
|
||||
}
|
||||
|
||||
FigureStageFree :: (stage: *FigureStage) {
|
||||
#if OS == .LINUX || OS == .ANDROID || OS == .WEB {
|
||||
GPU.SceneGpuRelease(*stage.gpu)
|
||||
}
|
||||
FigureModelRelease(*stage.model)
|
||||
SceneFree(*stage.scene)
|
||||
VecFree(stage.pixels.pixels)
|
||||
stage.pixels.width = 0
|
||||
stage.pixels.height = 0
|
||||
}
|
||||
|
||||
FigureStageRender :: (stage: *FigureStage, joints: *FigureJoints,
|
||||
camera: SceneCamera, width: s32, height: s32, seconds: float64) -> bool {
|
||||
if !FigureModelPose(*stage.model, *stage.scene, joints, seconds) {
|
||||
return false
|
||||
}
|
||||
toward := FigureNormalize(FigureSub(camera.position, camera.target))
|
||||
yaw := Atan2(toward.x, toward.z)
|
||||
light := FigureRotate(FigureAxisAngle(.{0.0, 1.0, 0.0}, yaw), .{-0.45, 0.75, 0.55})
|
||||
FigureModelLight(*stage.model, light, toward)
|
||||
if stage.pixels.width != width || stage.pixels.height != height {
|
||||
if !VecResize(stage.pixels.pixels, cast(s64)width * height * 4) {
|
||||
return false
|
||||
}
|
||||
stage.pixels.width = width
|
||||
stage.pixels.height = height
|
||||
}
|
||||
#if OS == .LINUX || OS == .ANDROID || OS == .WEB {
|
||||
return GPU.SceneGpuRenderOrCPU(*stage.gpu, *stage.scene, camera, *stage.pixels).ok
|
||||
} else {
|
||||
return RenderScene(*stage.scene, camera, *stage.pixels)
|
||||
}
|
||||
}
|
||||
|
||||
FigureStageLoadBytes :: (stage: *FigureStage, bytes: []u8) -> bool {
|
||||
FigureStageInit(stage)
|
||||
return FigureModelLoadBytes(*stage.model, *stage.scene, bytes) && FigureModelToon(*stage.model, *stage.scene)
|
||||
}
|
||||
|
||||
FigureStagePaint :: (stage: *FigureStage, joints: *FigureJoints, center: Vector3,
|
||||
yaw: float64, pitch: float64, span: float64, width: s32, height: s32, seconds: float64,
|
||||
offset: Vector3, pivot: Vector3, roll: float64) -> bool {
|
||||
camera := FigureCamera(center, yaw, pitch, span, cast(float64)width / cast(float64)height)
|
||||
placed := FigureCameraPlaced(camera, offset, pivot, roll)
|
||||
return FigureStageRender(stage, joints, placed, width, height, seconds)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/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
|
||||
Starts with the checksummed CC0 originals. Keeps identity, original
|
||||
texture bytes, skeleton, hair and the original skin beneath the shoes. 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.
|
||||
@@ -15,7 +15,13 @@ from pathlib import Path
|
||||
import struct
|
||||
|
||||
import numpy as np
|
||||
from prepare_slippers import prepare, ORIGINAL, COMPONENT, WIDTH
|
||||
ORIGINAL = {
|
||||
'woman': 'adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979',
|
||||
'man': '7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f',
|
||||
}
|
||||
COMPONENT = {5121: '<u1', 5123: '<u2', 5125: '<u4', 5126: '<f4'}
|
||||
WIDTH = {'SCALAR': 1, 'VEC2': 2, 'VEC3': 3, 'VEC4': 4, 'MAT4': 16}
|
||||
|
||||
|
||||
|
||||
def sha(path):
|
||||
@@ -230,14 +236,77 @@ def fit_garment_weights(attrs, joint_count, body, vertices, blend, body_region):
|
||||
attrs['WEIGHTS_0'][selected] = weights / weights.sum(axis=1, keepdims=True)
|
||||
|
||||
|
||||
def is_foot_skin(asset, primitive):
|
||||
material = asset.doc['materials'][primitive['material']]['name']
|
||||
if 'SKIN' not in material:
|
||||
return False
|
||||
ids = np.unique(asset.read(primitive['indices']))
|
||||
heights = asset.read(primitive['attributes']['POSITION'])[ids, 1]
|
||||
return heights.min() < .05 and heights.max() < .20
|
||||
|
||||
|
||||
def barefoot(asset, body_node, primitive, person):
|
||||
"""Level the original plantar skin while preserving toes, UVs and seams."""
|
||||
doc = asset.doc
|
||||
skin = doc['skins'][doc['nodes'][body_node]['skin']]
|
||||
src = {key: asset.read(i) for key, i in primitive['attributes'].items()}
|
||||
src_triangles = asset.read(primitive['indices']).reshape(-1, 3)
|
||||
feet = []
|
||||
measurements = []
|
||||
for side, sign in (('L', -1), ('R', 1)):
|
||||
attrs = {key: values.copy() for key, values in src.items()}
|
||||
xyz = attrs['POSITION']
|
||||
triangles = src_triangles[np.all(xyz[src_triangles, 0] * sign > 0, axis=1)]
|
||||
used = np.unique(triangles)
|
||||
# The source models stand inside slightly elevated shoes. Measure the
|
||||
# bare heel and forefoot on both sides and remove that ramp below the ankle.
|
||||
rear = used[(xyz[used, 2] > .016) & (xyz[used, 2] < .063)]
|
||||
fore = used[(xyz[used, 2] > -.112) & (xyz[used, 2] < -.078)]
|
||||
heel = rear[xyz[rear, 1].argmin()]
|
||||
ball = fore[xyz[fore, 1].argmin()]
|
||||
plane = np.interp(xyz[used, 2], [xyz[ball, 2], xyz[heel, 2]], [xyz[ball, 1], xyz[heel, 1]])
|
||||
blend = np.clip((xyz[used, 1] - .086) / .048, 0, 1)
|
||||
drop = (plane + .0013) * (1 - blend * blend * (3 - 2 * blend))
|
||||
xyz[used, 1] = np.maximum(0, xyz[used, 1] - drop)
|
||||
# Skin on the plantar surface follows the sole affine, while skin at
|
||||
# the ankle still blends through the original lower-leg weights.
|
||||
foot_node = next(i for i, node in enumerate(doc['nodes']) if node.get('name') == f'J_Bip_{side}_Foot')
|
||||
foot = skin['joints'].index(foot_node)
|
||||
sole = used[xyz[used, 1] < .002]
|
||||
attrs['JOINTS_0'][sole] = [foot, 0, 0, 0]
|
||||
attrs['WEIGHTS_0'][sole] = [1, 0, 0, 0]
|
||||
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)
|
||||
# Some UV seams have coincident vertices and zero-area bridge triangles.
|
||||
valid = used[length[used] > 1e-8]
|
||||
attrs['NORMAL'][valid] = normals[valid] / length[valid, None]
|
||||
feet.append(asset.primitive(attrs, triangles, primitive['material']))
|
||||
contact = xyz[used][xyz[used, 1] == 0]
|
||||
if len(contact) < 8 or np.ptp(contact[:, 2]) < .12:
|
||||
raise ValueError(f'{person} {side}: heel and forefoot do not share the contact plane')
|
||||
measurements.append({'side': side, 'vertices': len(used), 'triangles': len(triangles),
|
||||
'support_vertices': len(contact), 'heel_to_ball': float(np.ptp(contact[:, 2]))})
|
||||
if sum(m['triangles'] for m in measurements) != len(src_triangles):
|
||||
raise ValueError(f'{person}: foot extraction dropped original triangles')
|
||||
asset.mesh(body_node, 'PracticeBareFeet', feet)
|
||||
return measurements
|
||||
|
||||
|
||||
def dress(source, target, person):
|
||||
slippers = prepare(source, target, person)
|
||||
asset = Asset(target)
|
||||
if sha(source) != ORIGINAL[person]:
|
||||
raise ValueError(f'{source}: expected the original CC0 sample')
|
||||
asset = Asset(source)
|
||||
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']]
|
||||
skin_parts = [p for p in body['primitives'] if 'SKIN' in d['materials'][p['material']]['name']]
|
||||
foot_skin = next(p for p in body['primitives'] if is_foot_skin(asset, p))
|
||||
measurements = barefoot(asset, body_node, foot_skin, person)
|
||||
skin_parts = [p for p in body['primitives'] if p is not foot_skin and
|
||||
'SKIN' in d['materials'][p['material']]['name']]
|
||||
# The skin and clothes share accessors. Only vertices indexed by skin
|
||||
# primitives belong to the surface we want to fit against.
|
||||
skin_vertices = np.unique(np.concatenate([asset.read(p['indices']) for p in skin_parts]))
|
||||
@@ -253,6 +322,8 @@ def dress(source, target, person):
|
||||
kept, changed, skirt, trims, cloth = [], [], [], [], []
|
||||
for primitive_index, primitive in enumerate(body['primitives']):
|
||||
name = d['materials'][primitive['material']]['name']
|
||||
if primitive is foot_skin or 'Shoes' in name:
|
||||
continue
|
||||
if 'CLOTH' not in name:
|
||||
kept.append(primitive)
|
||||
continue
|
||||
@@ -336,10 +407,10 @@ def dress(source, target, person):
|
||||
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),
|
||||
return {'source_sha256': ORIGINAL[person], 'output_sha256': sha(target),
|
||||
'bare_feet': measurements,
|
||||
'changed_body_primitives': changed, 'skirt_preserved': person == 'woman',
|
||||
'identity': 'Original face, hair, body, skeleton and flat slippers retained',
|
||||
'identity': 'Original face, hair, body, skeleton and bare feet 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'}
|
||||
|
||||
@@ -349,12 +420,11 @@ def main():
|
||||
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 = {}, {}
|
||||
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')
|
||||
attire[person] = dress(args.source_dir / f'{person}.vrm', args.output_dir / f'{person}.vrm', person)
|
||||
(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')
|
||||
print('Prepared both traditional-inspired meditation outfits; original CC0 identities and bare feet retained')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
#!/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: '<u1', 5123: '<u2', 5125: '<u4', 5126: '<f4'}
|
||||
WIDTH = {'SCALAR': 1, 'VEC2': 2, 'VEC3': 3, 'VEC4': 4, 'MAT4': 16}
|
||||
|
||||
|
||||
def prepare(source, target, person):
|
||||
if hashlib.file_digest(source.open('rb'), 'sha256').hexdigest() != ORIGINAL[person]:
|
||||
raise ValueError(f'{source}: expected the original CC0 sample')
|
||||
with source.open('rb') as stream:
|
||||
magic, version, _ = struct.unpack('<III', stream.read(12))
|
||||
size, kind = struct.unpack('<II', stream.read(8))
|
||||
assert magic == 0x46546C67 and version == 2 and kind == 0x4E4F534A
|
||||
doc = json.loads(stream.read(size))
|
||||
size, kind = struct.unpack('<II', stream.read(8))
|
||||
assert kind == 0x004E4942
|
||||
binary = bytearray(stream.read(size))
|
||||
|
||||
def read(index):
|
||||
accessor = doc['accessors'][index]
|
||||
view = doc['bufferViews'][accessor['bufferView']]
|
||||
dtype = np.dtype(COMPONENT[accessor['componentType']])
|
||||
count, width = accessor['count'], WIDTH[accessor['type']]
|
||||
return np.ndarray((count, width), dtype=dtype, buffer=binary,
|
||||
offset=view.get('byteOffset', 0) + accessor.get('byteOffset', 0),
|
||||
strides=(view.get('byteStride', dtype.itemsize * width), dtype.itemsize)).copy()
|
||||
|
||||
def append(values, component, kind):
|
||||
values = np.asarray(values, dtype=COMPONENT[component])
|
||||
binary.extend(b'\0' * (-len(binary) % 4))
|
||||
view = len(doc['bufferViews'])
|
||||
doc['bufferViews'].append({'buffer': 0, 'byteOffset': len(binary), 'byteLength': values.nbytes})
|
||||
binary.extend(values.tobytes())
|
||||
accessor = len(doc['accessors'])
|
||||
spec = {'bufferView': view, 'componentType': component, 'count': len(values), 'type': kind}
|
||||
if kind == 'VEC3':
|
||||
spec.update(min=values.min(axis=0).tolist(), max=values.max(axis=0).tolist())
|
||||
doc['accessors'].append(spec)
|
||||
return accessor
|
||||
|
||||
shoe_material = next(i for i, material in enumerate(doc['materials']) if 'Shoes' in material['name'])
|
||||
body_node = next(i for i, node in enumerate(doc['nodes']) if 'mesh' in node and
|
||||
any(p.get('material') == shoe_material for p in doc['meshes'][node['mesh']]['primitives']))
|
||||
node = doc['nodes'][body_node]
|
||||
old = doc['meshes'][node['mesh']]
|
||||
original_points = []
|
||||
for primitive in old['primitives']:
|
||||
if primitive.get('material') == shoe_material:
|
||||
original_points.extend(read(primitive['attributes']['POSITION'])[np.unique(read(primitive['indices']))])
|
||||
original_points = np.array(original_points)
|
||||
old['primitives'] = [p for p in old['primitives'] if p.get('material') != shoe_material]
|
||||
material = len(doc['materials'])
|
||||
color = [.44, .43, .39, 1] if person == 'woman' else [.25, .27, .26, 1]
|
||||
doc['materials'].append({'name': 'Practice_Matte_Cloth', 'doubleSided': False,
|
||||
'pbrMetallicRoughness': {'baseColorFactor': color, 'metallicFactor': 0,
|
||||
'roughnessFactor': 1}})
|
||||
doc['extensions']['VRM']['materialProperties'].append({
|
||||
'name': 'Practice_Matte_Cloth', 'shader': 'VRM/MToon', 'renderQueue': -1,
|
||||
'floatProperties': {'_Cutoff': .5, '_CullMode': 2, '_BlendMode': 0},
|
||||
'vectorProperties': {'_Color': color, '_ShadeColor': color},
|
||||
'textureProperties': {}, 'keywordMap': {}, 'tagMap': {}})
|
||||
slippers = {'name': 'PracticeClothSlippers', 'primitives': []}
|
||||
measurements = []
|
||||
segments = 32
|
||||
for side in ['L', 'R']:
|
||||
foot_node = next(i for i, n in enumerate(doc['nodes']) if n.get('name') == f'J_Bip_{side}_Foot')
|
||||
joint = doc['skins'][node['skin']]['joints'].index(foot_node)
|
||||
inverse_bind = read(doc['skins'][node['skin']]['inverseBindMatrices'])[joint].reshape(4, 4).T
|
||||
foot_bind = np.linalg.inv(inverse_bind)
|
||||
sign = 1 if foot_bind[0, 3] > 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('<III', 0x46546C67, 2, 28 + len(encoded) + len(binary)))
|
||||
stream.write(struct.pack('<II', len(encoded), 0x4E4F534A))
|
||||
stream.write(encoded)
|
||||
stream.write(struct.pack('<II', len(binary), 0x004E4942))
|
||||
stream.write(binary)
|
||||
return {'source_sha256': ORIGINAL[person], 'output_sha256': hashlib.file_digest(target.open('rb'), 'sha256').hexdigest(),
|
||||
'slippers': measurements}
|
||||
|
||||
|
||||
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()
|
||||
report = {person: prepare(args.source_dir / f'{person}.vrm', args.output_dir / f'{person}.vrm', person)
|
||||
for person in ORIGINAL}
|
||||
(args.output_dir / 'slippers.json').write_text(json.dumps(report, indent=2) + '\n')
|
||||
print('Prepared both cloth-slipper models; measurements: shared/figure/slippers.json')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
+21
-45
@@ -21,58 +21,34 @@
|
||||
a VRM humanoid skeleton with hair spring bones. 27,068 and 24,858
|
||||
triangles.
|
||||
|
||||
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.
|
||||
## Bare feet and meditation attire
|
||||
|
||||
Reproduce from the original files (checksums above), kept in the ignored
|
||||
`backup/figure-source/` directory during development:
|
||||
The figures use the original bare feet, including toe geometry, skin texture
|
||||
and UV layout. The generator removes shoe primitives and levels the plantar
|
||||
surface below the ankle. The same original leg weights blend the skin above
|
||||
the sole into the ankle. `attire.json` records the finished asset checksums,
|
||||
triangle and contact counts, and each heel-to-ball span.
|
||||
|
||||
```sh
|
||||
python3 figure/tools/prepare_slippers.py --source-dir backup/figure-source
|
||||
python3 tests/slippers_test.py --source-dir backup/figure-source
|
||||
```
|
||||
Kryon's importer loads these models through `figure_model`. The retargeter
|
||||
measures the skinned soles and fits the foot length to the solver's heel/ball
|
||||
span. It keeps the loaded pivot in contact as the feet roll and lets the toes
|
||||
flex at the floor. The foot mesh uses affine skinning for the length fit,
|
||||
and the rest uses dual quaternions.
|
||||
|
||||
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.
|
||||
The matte linen colors, crossed facings and fitted sash form a traditional
|
||||
wrap. The woman keeps the long-sleeve top and flared skirt. The man wears a
|
||||
cross-collar tunic with relaxed trousers. Blended weights at the sleeves and
|
||||
trouser seat spread deformation through each joint. The generator preserves
|
||||
faces, hair, skeletons, expressions, original textures and CC0 metadata.
|
||||
|
||||
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.
|
||||
The separate `PracticeSkirt` mesh keeps its skinned waist seam. Its lower
|
||||
portion drapes around the legs and sleeves, stays above the floor, and
|
||||
spreads the displacement across neighboring fabric edges. The current pose
|
||||
sets these constraints so seeking and playback produce the same drape.
|
||||
|
||||
## 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.
|
||||
Reproduce from the checksummed originals in `backup/figure-source/`.
|
||||
|
||||
```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
|
||||
```
|
||||
@@ -1,7 +1,23 @@
|
||||
{
|
||||
"woman": {
|
||||
"source_sha256": "adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979",
|
||||
"output_sha256": "286b1f2da9fcd951df819452b4cf9ff2de4c3a7226c500762069b76c4a99e2b3",
|
||||
"output_sha256": "22051fc02f151c35b3fb2d422ced0a12bdf1e216b6805f9bf2d80592078be93f",
|
||||
"bare_feet": [
|
||||
{
|
||||
"side": "L",
|
||||
"vertices": 608,
|
||||
"triangles": 878,
|
||||
"support_vertices": 36,
|
||||
"heel_to_ball": 0.1543569266796112
|
||||
},
|
||||
{
|
||||
"side": "R",
|
||||
"vertices": 608,
|
||||
"triangles": 878,
|
||||
"support_vertices": 36,
|
||||
"heel_to_ball": 0.15435673296451569
|
||||
}
|
||||
],
|
||||
"changed_body_primitives": [
|
||||
{
|
||||
"original_primitive": 4,
|
||||
@@ -9,12 +25,28 @@
|
||||
}
|
||||
],
|
||||
"skirt_preserved": true,
|
||||
"identity": "Original face, hair, body, skeleton and flat slippers retained",
|
||||
"identity": "Original face, hair, body, skeleton and bare feet retained",
|
||||
"style": "Matte linen cross-collar wrap, plain sash and flared skirt"
|
||||
},
|
||||
"man": {
|
||||
"source_sha256": "7aeca142dabbc26ba0f5b9c998c8f3cb6df341287d67788427ac837223785a3f",
|
||||
"output_sha256": "4e37818973181bc3ac52dea275a123b3bb021d82f571577d068fd4bc423370c8",
|
||||
"output_sha256": "12f08ad217679f3c6f17d4e2dc0f04593b84092b08bfd35e5c0c0a8cc98d8685",
|
||||
"bare_feet": [
|
||||
{
|
||||
"side": "L",
|
||||
"vertices": 254,
|
||||
"triangles": 422,
|
||||
"support_vertices": 8,
|
||||
"heel_to_ball": 0.13664749264717102
|
||||
},
|
||||
{
|
||||
"side": "R",
|
||||
"vertices": 254,
|
||||
"triangles": 422,
|
||||
"support_vertices": 8,
|
||||
"heel_to_ball": 0.1366473287343979
|
||||
}
|
||||
],
|
||||
"changed_body_primitives": [
|
||||
{
|
||||
"original_primitive": 4,
|
||||
@@ -26,7 +58,7 @@
|
||||
}
|
||||
],
|
||||
"skirt_preserved": false,
|
||||
"identity": "Original face, hair, body, skeleton and flat slippers retained",
|
||||
"identity": "Original face, hair, body, skeleton and bare feet retained",
|
||||
"style": "Matte linen cross-collar tunic and relaxed trousers; hood/cord meshes removed"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,86 +0,0 @@
|
||||
{
|
||||
"woman": {
|
||||
"source_sha256": "adfd242317aaabc773f31f7fff7b013979fbb5baa47e97427a78913d9cb4e979",
|
||||
"output_sha256": "286b1f2da9fcd951df819452b4cf9ff2de4c3a7226c500762069b76c4a99e2b3",
|
||||
"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": "4e37818973181bc3ac52dea275a123b3bb021d82f571577d068fd4bc423370c8",
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
+33
-4
@@ -1,13 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify real garment edits preserve both selected identities and plain soles."""
|
||||
import argparse
|
||||
import json
|
||||
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
|
||||
from prepare_attire import Asset, ORIGINAL, is_foot_skin, sha
|
||||
|
||||
|
||||
def verify_feet(old, new, receipts):
|
||||
original = next(p for mesh in old.doc['meshes'] for p in mesh['primitives'] if is_foot_skin(old, p))
|
||||
source = {name: old.read(accessor) for name, accessor in original['attributes'].items()}
|
||||
triangles = old.read(original['indices']).reshape(-1, 3)
|
||||
feet = next(mesh for mesh in new.doc['meshes'] if mesh['name'] == 'PracticeBareFeet')
|
||||
assert len(feet['primitives']) == len(receipts) == 2
|
||||
for sign, primitive, receipt in zip((-1, 1), feet['primitives'], receipts):
|
||||
assert primitive['material'] == original['material']
|
||||
expected = triangles[np.all(source['POSITION'][triangles, 0] * sign > 0, axis=1)]
|
||||
indices = new.read(primitive['indices']).reshape(-1, 3)
|
||||
assert len(indices) == len(expected) == receipt['triangles']
|
||||
assert len(np.unique(indices)) == receipt['vertices']
|
||||
attrs = {name: new.read(accessor) for name, accessor in primitive['attributes'].items()}
|
||||
position = attrs['POSITION']
|
||||
assert np.array_equal(position[indices][..., [0, 2]], source['POSITION'][expected][..., [0, 2]])
|
||||
assert np.array_equal(attrs['TEXCOORD_0'][indices], source['TEXCOORD_0'][expected])
|
||||
assert np.isfinite(position).all() and np.isfinite(attrs['NORMAL']).all()
|
||||
assert np.allclose(np.linalg.norm(attrs['NORMAL'], axis=1), 1, atol=1e-5)
|
||||
assert np.allclose(attrs['WEIGHTS_0'].sum(1), 1, atol=1e-5)
|
||||
used = np.unique(indices)
|
||||
assert position[used, 1].min() == 0
|
||||
contact = used[position[used, 1] == 0]
|
||||
assert len(contact) == receipt['support_vertices'] >= 8
|
||||
assert .12 < np.ptp(position[contact, 2]) == receipt['heel_to_ball']
|
||||
assert np.all(attrs['WEIGHTS_0'][contact] == [1, 0, 0, 0])
|
||||
|
||||
|
||||
def main():
|
||||
@@ -33,9 +60,11 @@ def main():
|
||||
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']]
|
||||
expected = [p for p in mesh['primitives']
|
||||
if 'CLOTH' not in o['materials'][p['material']]['name'] and not is_foot_skin(old, p)]
|
||||
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'))
|
||||
verify_feet(old, new, receipts[person]['bare_feet'])
|
||||
garments = []
|
||||
for mesh in d['meshes']:
|
||||
for primitive in mesh['primitives']:
|
||||
@@ -66,7 +95,7 @@ def main():
|
||||
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')
|
||||
print(f'{person}: real linen wrap geometry, original barefoot topology, textures and level soles; CC0 and skeleton preserved')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#import "figure_math"
|
||||
#import "figure_joints"
|
||||
#import "figure_model"
|
||||
#import "figure_cloth"
|
||||
#import "std/byte_text_linux"
|
||||
#import "kryon/scene"
|
||||
#import "kryon/scene_gltf"
|
||||
#import "std/math"
|
||||
@@ -101,6 +103,40 @@ ArmMotion :: (model: *FigureModel, scene: *Scene, path: string) -> bool {
|
||||
return shoulder_change > 0.12 && shoulder_change < 0.24 && largest_step < 0.18 && largest_turn > 0.45
|
||||
}
|
||||
|
||||
SleeveContact :: (model: *FigureModel, scene: *Scene) -> bool {
|
||||
pose := ModelPose(0.0)
|
||||
// Sweep a sleeve close to the front skirt panel during a low reach.
|
||||
min_gap: float64 = 1.0
|
||||
measured: s64
|
||||
for sample: 0..16 {
|
||||
pose.elbows[0] = .{0.20, 0.82, 0.22}
|
||||
pose.wrists[0] = .{0.18, 0.68, 0.21 + 0.05 * cast(float64)sample / 16.0}
|
||||
if !FigureModelPose(model, scene, *pose) { return false }
|
||||
elbow := ModelPoint(model, scene, FigureSideRole(0, FIGURE_LOWER_ARM))
|
||||
wrist := ModelPoint(model, scene, FigureSideRole(0, FIGURE_HAND))
|
||||
root := scene.nodes[model.instance.root_node]
|
||||
for index: 0..model.instance.meshes.count - 1 {
|
||||
inst := *model.instance.meshes[index]
|
||||
source := *model.model.meshes[inst.mesh_index]
|
||||
if TextView(source.name[:]) != "PracticeSkirt" { continue }
|
||||
mesh := scene.meshes[scene.nodes[inst.scene_node].mesh]
|
||||
rest_hips := model.rest_at[model.bones[FIGURE_HIPS]]
|
||||
radius := 0.062 * root.scale.x
|
||||
for vertex: 0..inst.skin.positions.count - 1 {
|
||||
if rest_hips.y - inst.skin.positions[vertex].y < 0.10 { continue }
|
||||
point := FigureAdd(root.position, FigureScale(FigureRotate(model.facing,
|
||||
scene.positions[mesh.first_vertex + vertex]), root.scale.x))
|
||||
restored := FigureClothOutside(point, elbow, wrist, radius, .{1.0, 0.0, 0.0})
|
||||
gap := FigureDistance(restored, point)
|
||||
min_gap = FigureMin(min_gap, radius - gap)
|
||||
measured += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
print("skirt/sleeve contact: % skirt vertices sampled, minimum sleeve radius clearance % m\n", measured, min_gap)
|
||||
return measured >= 17 * 100 && min_gap >= 0.060 * scene.nodes[model.instance.root_node].scale.x
|
||||
}
|
||||
|
||||
main :: () -> s32 {
|
||||
fail: s32
|
||||
paths: [2]string = .["shared/figure/woman.vrm", "shared/figure/man.vrm"]
|
||||
@@ -114,6 +150,7 @@ main :: () -> s32 {
|
||||
print("model pose: could not load %\n", path)
|
||||
return 1
|
||||
}
|
||||
worst_pelvis: float64
|
||||
worst_ankle: float64
|
||||
worst_drift: float64
|
||||
worst_hand: float64
|
||||
@@ -124,6 +161,8 @@ main :: () -> s32 {
|
||||
if !FigureModelPose(*model, *scene, *pose) {
|
||||
return 1
|
||||
}
|
||||
pelvis := ModelPoint(*model, *scene, FIGURE_HIPS)
|
||||
worst_pelvis = FigureMax(worst_pelvis, FigureDistance(pelvis, pose.pelvis))
|
||||
for side: cast(s32)0..1 {
|
||||
ankle := ModelPoint(*model, *scene, FigureSideRole(side, FIGURE_FOOT))
|
||||
if sample == 0 {
|
||||
@@ -139,9 +178,12 @@ main :: () -> s32 {
|
||||
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 {
|
||||
print("model pose: % pelvis error % m, ankle error % m, planted drift % m, wrist error % m, hand direction error %\n",
|
||||
path, worst_pelvis, worst_ankle, worst_drift, worst_wrist, worst_hand)
|
||||
if worst_pelvis > 0.0001 || worst_ankle > 0.0001 || worst_drift > 0.0001 || worst_wrist > 0.0001 || worst_hand > 0.001 {
|
||||
fail += 1
|
||||
}
|
||||
if path == paths[0] && !SleeveContact(*model, *scene) {
|
||||
fail += 1
|
||||
}
|
||||
if !ArmMotion(*model, *scene, path) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Measure the rendered, skinned slipper vertices, not ankle-bone guesses.
|
||||
// Measure the rendered, skinned plantar vertices, not ankle-bone guesses.
|
||||
#import "figure_math"
|
||||
#import "figure_joints"
|
||||
#import "figure_model"
|
||||
@@ -17,6 +17,7 @@ SoleWorld :: (figure: *FigureModel, matrix: GltfMatrix, point: Vector3, scene: *
|
||||
|
||||
SoleCheck :: (figure: *FigureModel, scene: *Scene, path: string) -> s32 {
|
||||
worst_gap: float64
|
||||
worst_penetration: float64
|
||||
worst_flat: float64
|
||||
worst_pivot: float64
|
||||
measured: s64
|
||||
@@ -59,7 +60,7 @@ SoleCheck :: (figure: *FigureModel, scene: *Scene, path: string) -> s32 {
|
||||
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" {
|
||||
if TextView(source_mesh.name[:]) != "PracticeBareFeet" {
|
||||
continue
|
||||
}
|
||||
side := inst.primitive_index
|
||||
@@ -72,11 +73,12 @@ SoleCheck :: (figure: *FigureModel, scene: *Scene, path: string) -> s32 {
|
||||
ball: Vector3
|
||||
for vertex: 0..inst.skin.positions.count - 1 {
|
||||
rest := inst.skin.positions[vertex]
|
||||
actual := SoleWorld(figure, figure.instance.node_world[inst.gltf_node],
|
||||
scene.positions[mesh.first_vertex + vertex], scene)
|
||||
worst_penetration = FigureMax(worst_penetration, -actual.y)
|
||||
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)
|
||||
@@ -94,15 +96,16 @@ SoleCheck :: (figure: *FigureModel, scene: *Scene, path: string) -> s32 {
|
||||
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]
|
||||
heel_down := pose.heels[side].y <= pose.balls[side].y
|
||||
actual := ifx heel_down then heel else ball
|
||||
target := ifx heel_down then pose.heels[side] else pose.balls[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
|
||||
print("sole test: % vertices %, floor error % m, skin penetration % m, flatness % m, heel/ball pivot error % m\n",
|
||||
path, measured, worst_gap, worst_penetration, worst_flat, worst_pivot)
|
||||
return ifx measured < 1000 || worst_gap >= 0.001 || worst_penetration >= 0.001 || worst_flat >= 0.001 || worst_pivot >= 0.001 then 1 else 0
|
||||
}
|
||||
|
||||
main :: () -> s32 {
|
||||
@@ -110,14 +113,16 @@ main :: () -> s32 {
|
||||
paths: [2]string = .["shared/figure/woman.vrm", "shared/figure/man.vrm"]
|
||||
model: FigureModel
|
||||
defer FigureModelRelease(*model)
|
||||
for path: paths {
|
||||
expected: [2]s32 = .[36, 8]
|
||||
for index: 0..paths.count - 1 {
|
||||
path := paths[index]
|
||||
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 {
|
||||
if model.sole_count[0] != expected[index] || model.sole_count[1] != expected[index] {
|
||||
print("sole test: stale measurements after loading %\n", path)
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/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('<III', stream.read(12))[0:2] == (0x46546c67, 2)
|
||||
size, _ = struct.unpack('<II', stream.read(8))
|
||||
doc = json.loads(stream.read(size))
|
||||
size, _ = struct.unpack('<II', stream.read(8))
|
||||
data = stream.read(size)
|
||||
return doc, data
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--source-dir', type=Path)
|
||||
args = parser.parse_args()
|
||||
root = Path('shared/figure')
|
||||
receipts = json.loads((root / 'slippers.json').read_text())
|
||||
for person in ['woman', 'man']:
|
||||
path = root / f'{person}.vrm'
|
||||
doc, data = load(path)
|
||||
assert hashlib.file_digest(path.open('rb'), 'sha256').hexdigest() == receipts[person]['output_sha256']
|
||||
assert doc['extensions']['VRM']['meta']['licenseName'] == 'CC0'
|
||||
mesh = next(m for m in doc['meshes'] if m.get('name') == 'PracticeClothSlippers')
|
||||
assert len(mesh['primitives']) == 2
|
||||
node = next(n for n in doc['nodes'] if n.get('name') == 'PracticeClothSlippers')
|
||||
skin = doc['skins'][node['skin']]
|
||||
|
||||
def read(index):
|
||||
a = doc['accessors'][index]
|
||||
v = doc['bufferViews'][a['bufferView']]
|
||||
dtype = np.dtype({5123: '<u2', 5126: '<f4'}[a['componentType']])
|
||||
width = {'SCALAR': 1, 'VEC3': 3, 'VEC4': 4}[a['type']]
|
||||
return np.ndarray((a['count'], width), dtype=dtype, buffer=data,
|
||||
offset=v.get('byteOffset', 0) + a.get('byteOffset', 0))
|
||||
|
||||
for side, primitive in zip(['L', 'R'], mesh['primitives']):
|
||||
attributes = primitive['attributes']
|
||||
positions, normals = read(attributes['POSITION']), read(attributes['NORMAL'])
|
||||
assert np.isfinite(positions).all() and np.isfinite(normals).all()
|
||||
assert positions[:, 1].min() == 0 and positions[:, 1].max() <= .058
|
||||
assert np.count_nonzero(positions[:, 1] == 0) == 33
|
||||
assert np.allclose(np.linalg.norm(normals, axis=1), 1, atol=1e-5)
|
||||
assert read(primitive['indices']).max() < len(positions)
|
||||
joints, weights = read(attributes['JOINTS_0']), read(attributes['WEIGHTS_0'])
|
||||
foot = skin['joints'][int(joints[0, 0])]
|
||||
assert doc['nodes'][foot]['name'] == f'J_Bip_{side}_Foot'
|
||||
assert (joints[:, 0] == joints[0, 0]).all()
|
||||
assert np.allclose(weights, [1, 0, 0, 0])
|
||||
material = doc['materials'][primitive['material']]['pbrMetallicRoughness']
|
||||
assert 'baseColorTexture' not in material and material['metallicFactor'] == 0
|
||||
assert material['roughnessFactor'] == 1
|
||||
if args.source_dir:
|
||||
original, source = load(args.source_dir / path.name)
|
||||
assert data[:len(source)] == source # Every original bitmap/accessor byte is preserved.
|
||||
for old, new in zip(original['meshes'], doc['meshes']):
|
||||
expected = [p for p in old['primitives'] if 'CLOTH' not in original['materials'][p['material']]['name']]
|
||||
actual = [p for p in new['primitives'] if not doc['materials'][p['material']]['name'].startswith('Practice_')]
|
||||
assert actual == expected
|
||||
assert doc['extensions']['VRM']['meta'] == original['extensions']['VRM']['meta']
|
||||
print(f'{person}: flat 0 mm sole plane, 57 mm cloth upper, rigid foot weights; CC0, non-clothing geometry and original texture bytes preserved')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -21,3 +21,4 @@ figure_joints = "figure/figure_joints.zi"
|
||||
figure_skin = "figure/figure_skin.zi"
|
||||
figure_finish = "figure/figure_finish.zi"
|
||||
figure_model = "figure/figure_model.zi"
|
||||
figure_stage = "figure/figure_stage.zi"
|
||||
Reference in new issue
Block a user