@wildshard/sdk 0.0.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUIDE.md +790 -0
- package/README.md +13 -5
- package/bin/wildshard.mjs +38 -0
- package/lint/declaration-config.d.mts +2 -0
- package/lint/declaration-config.mjs +19 -0
- package/lint/engine-plugin.d.mts +2 -0
- package/lint/engine-plugin.mjs +40 -0
- package/lint/host-callbacks.d.mts +6 -0
- package/lint/host-callbacks.mjs +123 -0
- package/lint/host-files.d.mts +1 -0
- package/lint/host-files.mjs +7 -0
- package/lint/layer-exports.d.mts +2 -0
- package/lint/layer-exports.mjs +21 -0
- package/lint/legacy-line-basis.json +995 -0
- package/lint/nine-tiling-baseline.json +35 -0
- package/lint/ratchet.json +11 -0
- package/lint/runtime-files.d.mts +12 -0
- package/lint/runtime-files.json +16 -0
- package/lint/runtime-files.mjs +69 -0
- package/lint/runtime-performance.d.mts +6 -0
- package/lint/runtime-performance.mjs +184 -0
- package/lint/sdk-plugin.d.mts +4 -0
- package/lint/sdk-plugin.mjs +134 -0
- package/lint/shardfile-boundaries.d.mts +10 -0
- package/lint/shardfile-boundaries.mjs +122 -0
- package/lint/tile-bake-debt.json +556 -0
- package/package.json +365 -3
- package/scripts/agent-parity.mjs +1524 -0
- package/scripts/agent-sync.mjs +518 -0
- package/scripts/apfs-clone.mjs +67 -0
- package/scripts/assert-store-layout.mjs +23 -0
- package/scripts/astc6-phone-cap.d.mts +3 -0
- package/scripts/astc6-phone-cap.mjs +137 -0
- package/scripts/audit-assets.d.mts +10 -0
- package/scripts/audit-assets.mjs +151 -0
- package/scripts/bake/coatFiles.d.mts +6 -0
- package/scripts/bake/coatFiles.mjs +37 -0
- package/scripts/bake/environment.d.mts +2 -0
- package/scripts/bake/environment.mjs +58 -0
- package/scripts/bake/far-proxies.mjs +45 -0
- package/scripts/bake/keyed-sky.d.mts +4 -0
- package/scripts/bake/keyed-sky.mjs +34 -0
- package/scripts/bake/movers.mjs +56 -0
- package/scripts/bake/nativeWorld.d.mts +6 -0
- package/scripts/bake/nativeWorld.mjs +43 -0
- package/scripts/bake/navmeshGround.ts +22 -0
- package/scripts/bake/near-placeholder.mjs +331 -0
- package/scripts/bake/placeholderShards.mjs +41 -0
- package/scripts/bake/skins.mjs +15 -0
- package/scripts/bake/template-skins.mjs +33 -0
- package/scripts/bake/viewmodelBytes.ts +26 -0
- package/scripts/bake/viewmodelPage.ts +11 -0
- package/scripts/bake/worldHost.d.mts +35 -0
- package/scripts/bake/worldHost.mjs +110 -0
- package/scripts/bake-astc6.cache.json +80 -0
- package/scripts/bake-astc6.far-reach.cache.json +23 -0
- package/scripts/bake-astc6.list.json +111 -0
- package/scripts/bake-astc6.mjs +279 -0
- package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
- package/scripts/bake-catalogue.mjs +44 -0
- package/scripts/bake-check.mjs +54 -0
- package/scripts/bake-chunk.mjs +124 -0
- package/scripts/bake-cloud-field.mjs +24 -0
- package/scripts/bake-coats.mjs +110 -0
- package/scripts/bake-data-maps.d.mts +24 -0
- package/scripts/bake-data-maps.mjs +72 -0
- package/scripts/bake-entry-programs.mjs +117 -0
- package/scripts/bake-geometry.mjs +106 -0
- package/scripts/bake-hybrid-tiles.mjs +28 -0
- package/scripts/bake-ktx2.cache.json +276 -0
- package/scripts/bake-ktx2.list.json +365 -0
- package/scripts/bake-ktx2.mjs +477 -0
- package/scripts/bake-map-glb.mjs +127 -0
- package/scripts/bake-map-rest.d.mts +7 -0
- package/scripts/bake-map-rest.mjs +50 -0
- package/scripts/bake-maps.mjs +200 -0
- package/scripts/bake-navmesh.mjs +259 -0
- package/scripts/bake-packs.mjs +129 -0
- package/scripts/bake-pickups.mjs +102 -0
- package/scripts/bake-query-terrain.mjs +64 -0
- package/scripts/bake-recurve-pool.mjs +16 -0
- package/scripts/bake-section-schemas.d.mts +3 -0
- package/scripts/bake-template-shardfile.mjs +32 -0
- package/scripts/bake-textures.mjs +80 -0
- package/scripts/bake-viewmodel-sets.json +45 -0
- package/scripts/bake-viewmodel-sets.mjs +137 -0
- package/scripts/bake-voxel-ao.mjs +119 -0
- package/scripts/bake-water-ripples.mjs +25 -0
- package/scripts/blender/README.md +129 -0
- package/scripts/blender/build.sh +166 -0
- package/scripts/blender/lib/export-scene.mjs +129 -0
- package/scripts/blender/lib/glb-digest.mjs +188 -0
- package/scripts/blender/lib/glb.py +68 -0
- package/scripts/blender/lib/save_blend.py +17 -0
- package/scripts/blender/lib/world_fixture.py +55 -0
- package/scripts/blender/targets.json +591 -0
- package/scripts/build-sdk.mjs +95 -0
- package/scripts/build-shardfiles.d.mts +7 -0
- package/scripts/build-shardfiles.mjs +206 -0
- package/scripts/capture-hero.mjs +137 -0
- package/scripts/check-lift-review.mjs +23 -0
- package/scripts/chromium-keychain-check.mjs +139 -0
- package/scripts/chromium-keychain.d.mts +1 -0
- package/scripts/chromium-keychain.mjs +5 -0
- package/scripts/compile-script.d.mts +3 -0
- package/scripts/compile-script.mjs +8 -0
- package/scripts/creature-color.mjs +255 -0
- package/scripts/decide/calibrate.py +127 -0
- package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
- package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
- package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
- package/scripts/decide/decide.py +262 -0
- package/scripts/decide/decide.sh +50 -0
- package/scripts/decide/layer-purity-pilot.mjs +41 -0
- package/scripts/decide/sets/capture-status.json +46 -0
- package/scripts/decide/sets/layer-purity.json +28 -0
- package/scripts/decide/sets/text-garbled.json +17 -0
- package/scripts/decide/test_decide.py +37 -0
- package/scripts/docs.mjs +15 -0
- package/scripts/entry-reads/crawl.ts +152 -0
- package/scripts/entry-reads/tsconfig.json +25 -0
- package/scripts/gen-format-schema.d.mts +2 -0
- package/scripts/gen-format-schema.mjs +21 -0
- package/scripts/gen-host-catalogue.d.mts +14 -0
- package/scripts/gen-host-catalogue.mjs +108 -0
- package/scripts/gen-shard-layout-doc.d.mts +4 -0
- package/scripts/gen-shard-layout-doc.mjs +55 -0
- package/scripts/gen-shards.d.mts +17 -0
- package/scripts/gen-shards.mjs +311 -0
- package/scripts/goldens/capture-inputs.d.mts +4 -0
- package/scripts/goldens/capture-inputs.mjs +34 -0
- package/scripts/goldens/colour_shift.py +27 -0
- package/scripts/goldens/native-residency.d.mts +10 -0
- package/scripts/goldens/native-residency.mjs +104 -0
- package/scripts/goldens/plot-inputs.d.mts +12 -0
- package/scripts/goldens/plot-inputs.mjs +46 -0
- package/scripts/gpu-texmem.mjs +98 -0
- package/scripts/horizon-matte/config.py +24 -0
- package/scripts/horizon-matte/encode.py +91 -0
- package/scripts/horizon-matte/key.py +141 -0
- package/scripts/horizon-matte/mkjobs.py +33 -0
- package/scripts/horizon-matte/mkjobs_day2.py +11 -0
- package/scripts/horizon-matte/overlap.py +80 -0
- package/scripts/horizon-matte/run_codex.py +57 -0
- package/scripts/horizon-matte/stitch.py +133 -0
- package/scripts/img2mesh/CC0.md +105 -0
- package/scripts/img2mesh/README.md +209 -0
- package/scripts/img2mesh/ab_board.py +102 -0
- package/scripts/img2mesh/birds/birds.json +255 -0
- package/scripts/img2mesh/birds/birds_atlas.py +150 -0
- package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
- package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
- package/scripts/img2mesh/birds/birds_pack.py +110 -0
- package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
- package/scripts/img2mesh/birds/birds_post.py +550 -0
- package/scripts/img2mesh/birds/birds_render.py +125 -0
- package/scripts/img2mesh/birds/birds_sheet.py +33 -0
- package/scripts/img2mesh/birds/birds_view.py +60 -0
- package/scripts/img2mesh/board.py +100 -0
- package/scripts/img2mesh/build_cc0.sh +52 -0
- package/scripts/img2mesh/build_driftwood.sh +12 -0
- package/scripts/img2mesh/build_faces.sh +53 -0
- package/scripts/img2mesh/build_props.py +81 -0
- package/scripts/img2mesh/cc0_export.py +186 -0
- package/scripts/img2mesh/driftwood_post.py +571 -0
- package/scripts/img2mesh/e304_faces.sh +67 -0
- package/scripts/img2mesh/face_remaster.py +911 -0
- package/scripts/img2mesh/face_views.py +95 -0
- package/scripts/img2mesh/faces-e304.json +9 -0
- package/scripts/img2mesh/faces.json +30 -0
- package/scripts/img2mesh/head_cut.py +100 -0
- package/scripts/img2mesh/hi3d_paint.py +94 -0
- package/scripts/img2mesh/hi3d_refine.py +161 -0
- package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
- package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
- package/scripts/img2mesh/props/coral-arch.json +32 -0
- package/scripts/img2mesh/props/ember-furnace.json +30 -0
- package/scripts/img2mesh/props/night-market-gate.json +10 -0
- package/scripts/img2mesh/render_still.py +86 -0
- package/scripts/img2mesh/rig_strip.mjs +46 -0
- package/scripts/img2mesh/rig_transfer.mjs +104 -0
- package/scripts/img2mesh/split_sheet.py +48 -0
- package/scripts/img2mesh/trellis_batch.py +110 -0
- package/scripts/img2mesh/versus_board.py +114 -0
- package/scripts/import-bundle.d.mts +2 -0
- package/scripts/import-bundle.mjs +20 -0
- package/scripts/ktx2-ab-board.py +133 -0
- package/scripts/ktx2-ab.mjs +111 -0
- package/scripts/ktx2-settings.mjs +18 -0
- package/scripts/land.d.mts +14 -0
- package/scripts/land.mjs +809 -0
- package/scripts/lint-dispatch.mjs +14 -0
- package/scripts/map-bake-frames.d.mts +4 -0
- package/scripts/map-bake-frames.mjs +23 -0
- package/scripts/map-geometry.d.mts +9 -0
- package/scripts/map-geometry.mjs +29 -0
- package/scripts/map-world.mjs +162 -0
- package/scripts/mockup-local.sh +46 -0
- package/scripts/music/export-midi.mjs +68 -0
- package/scripts/music/gen/analyze.py +308 -0
- package/scripts/music/gen/audio_jobs.py +46 -0
- package/scripts/music/gen/briefs.json +51 -0
- package/scripts/music/gen/build_page.py +334 -0
- package/scripts/music/gen/folk.json +3187 -0
- package/scripts/music/gen/gen_ace_step.py +156 -0
- package/scripts/music/gen/gen_heartmula.py +187 -0
- package/scripts/music/gen/gen_minimax.py +143 -0
- package/scripts/music/gen/gen_sao.py +122 -0
- package/scripts/music/gen/gen_sao_small.py +104 -0
- package/scripts/music/gen/gen_sfx.py +98 -0
- package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
- package/scripts/music/gen/gen_sfx_moss.py +112 -0
- package/scripts/music/gen/models.json +61 -0
- package/scripts/music/gen/nalati-jobs.json +104 -0
- package/scripts/music/gen/nalati-score-build.json +119 -0
- package/scripts/music/gen/nalati-score.json +3448 -0
- package/scripts/music/gen/ob7-fit-decisions.json +38 -0
- package/scripts/music/gen/ob7-score-jobs.json +152 -0
- package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
- package/scripts/music/gen/ob7_build.py +469 -0
- package/scripts/music/gen/ob7_generate.py +67 -0
- package/scripts/music/gen/ob7_run.sh +42 -0
- package/scripts/music/gen/orchestral.json +3187 -0
- package/scripts/music/gen/own_score.py +486 -0
- package/scripts/music/gen/ph-jobs.json +27 -0
- package/scripts/music/gen/ph_page.py +222 -0
- package/scripts/music/gen/piano.json +3175 -0
- package/scripts/music/gen/rank_v3.py +248 -0
- package/scripts/music/gen/sfx-best.json +2486 -0
- package/scripts/music/gen/sfx-ezaudio.json +4082 -0
- package/scripts/music/gen/sfx-jobs.json +57 -0
- package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
- package/scripts/music/gen/sfx-minimax.json +289 -0
- package/scripts/music/gen/sfx-moss.json +4082 -0
- package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
- package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
- package/scripts/music/gen/sfx-nalati.json +11202 -0
- package/scripts/music/gen/sfx-nd-jobs.json +57 -0
- package/scripts/music/gen/sfx-nd-moss.json +2097 -0
- package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
- package/scripts/music/gen/sfx-nd-summary.json +38 -0
- package/scripts/music/gen/sfx-peaks.json +7 -0
- package/scripts/music/gen/sfx-ph-jobs.json +169 -0
- package/scripts/music/gen/sfx-ph-moss.json +6564 -0
- package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
- package/scripts/music/gen/sfx-ph-summary.json +63 -0
- package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
- package/scripts/music/gen/sfx-sa3.json +4082 -0
- package/scripts/music/gen/sfx-summary.json +107 -0
- package/scripts/music/gen/sfx_build.py +332 -0
- package/scripts/music/gen/sfx_merge.py +255 -0
- package/scripts/music/gen/sfx_minimax.py +61 -0
- package/scripts/music/gen/sfx_nalati.py +331 -0
- package/scripts/music/gen/sfx_sprite.py +424 -0
- package/scripts/music/gen/stems.py +539 -0
- package/scripts/music/gen/test_loop_meter.py +29 -0
- package/scripts/music/gen/test_ob7_provenance.py +77 -0
- package/scripts/music/gen/v3-folk-build.json +148 -0
- package/scripts/music/gen/v3-folk.json +1818 -0
- package/scripts/music/gen/v3-jobs.json +145 -0
- package/scripts/music/gen/v3-orchestral-build.json +148 -0
- package/scripts/music/gen/v3-orchestral.json +1813 -0
- package/scripts/music/gen/v3-ph-folk-build.json +94 -0
- package/scripts/music/gen/v3-ph-folk.json +1806 -0
- package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
- package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
- package/scripts/music/gen/v3-ph-piano-build.json +94 -0
- package/scripts/music/gen/v3-ph-piano.json +1818 -0
- package/scripts/music/gen/v3-piano-build.json +148 -0
- package/scripts/music/gen/v3-piano.json +1813 -0
- package/scripts/music/wildshard-theme.mid +0 -0
- package/scripts/music/wildshard-trailer30.mid +0 -0
- package/scripts/named-blob-output.d.mts +8 -0
- package/scripts/named-blob-output.mjs +48 -0
- package/scripts/pack-all.mjs +15 -0
- package/scripts/pid-lock.d.mts +1 -0
- package/scripts/pid-lock.mjs +63 -0
- package/scripts/practice/bake_dummy.py +53 -0
- package/scripts/practice/build_dummies.sh +43 -0
- package/scripts/practice/dummy_parts.py +568 -0
- package/scripts/practice/dummy_rig_gate.py +139 -0
- package/scripts/practice/gate_sheet.py +36 -0
- package/scripts/practice/generate_dummy_unimate.py +132 -0
- package/scripts/practice/pack_dummy.mjs +59 -0
- package/scripts/practice/repair_dummy_weights.mjs +68 -0
- package/scripts/practice/rig_dummy.py +828 -0
- package/scripts/practice/verify_unimate_skin.mjs +356 -0
- package/scripts/preparation-seed.mjs +15 -0
- package/scripts/prepare-basis-tool.mjs +6 -0
- package/scripts/prepare-product.d.mts +14 -0
- package/scripts/prepare-product.mjs +101 -0
- package/scripts/product-build-tools.d.mts +3 -0
- package/scripts/product-build-tools.json +3 -0
- package/scripts/product-build-tools.mjs +31 -0
- package/scripts/publish-public.mjs +7 -0
- package/scripts/push-tables.d.mts +1 -0
- package/scripts/push-tables.mjs +28 -0
- package/scripts/record-shard-mounts.mjs +133 -0
- package/scripts/sdk-externals.d.mts +2 -0
- package/scripts/sdk-externals.mjs +2 -0
- package/scripts/section-inventory.ts +209 -0
- package/scripts/select-candidate.mjs +15 -0
- package/scripts/shard-build-pool.d.mts +4 -0
- package/scripts/shard-build-pool.mjs +53 -0
- package/scripts/shard-line-baseline.json +17 -0
- package/scripts/shard-milestones.d.mts +15 -0
- package/scripts/shard-milestones.mjs +105 -0
- package/scripts/shard-output-report.d.mts +9 -0
- package/scripts/shard-output-report.mjs +85 -0
- package/scripts/shard-platform-cli.mjs +93 -0
- package/scripts/shard-progress.mjs +212 -0
- package/scripts/shard-timelapse.py +102 -0
- package/scripts/shardfile-cold-boot.mjs +79 -0
- package/scripts/shardfile-vite.d.mts +4 -0
- package/scripts/shardfile-vite.mjs +20 -0
- package/scripts/simplify-models.mjs +24 -0
- package/scripts/site-facts.mjs +88 -0
- package/scripts/test-template-gate.mjs +44 -0
- package/scripts/test_golden_compare.py +68 -0
- package/scripts/tex-tiers.cache.json +181 -0
- package/scripts/tex-tiers.mjs +240 -0
- package/scripts/texmem-probe.mjs +184 -0
- package/scripts/unused-assets.mjs +173 -0
- package/scripts/vite-tmp.d.mts +23 -0
- package/scripts/vite-tmp.mjs +157 -0
- package/scripts/wave-line-baselines.json +32 -0
- package/scripts/wildshard.d.mts +4 -0
- package/scripts/wildshard.mjs +105 -0
- package/scripts/witness-checkpoints.d.mts +10 -0
- package/scripts/witness-checkpoints.mjs +84 -0
- package/scripts/witness-generation.d.mts +10 -0
- package/scripts/witness-generation.mjs +45 -0
- package/scripts/witness-manifests.d.mts +8 -0
- package/scripts/witness-manifests.mjs +157 -0
- package/scripts/worktree-ignore.d.mts +4 -0
- package/scripts/worktree-ignore.mjs +36 -0
- package/scripts/worktree-reap.mjs +214 -0
- package/scripts/worktree.mjs +396 -0
- package/scripts/worldclaw/capture-front.sh +28 -0
- package/scripts/worldclaw/design-template.md +62 -0
- package/scripts/worldclaw/spec-map.py +92 -0
- package/scripts/worldclaw/spec.ts +96 -0
- package/skills/wildshard/SKILL.md +50 -0
- package/skills/wildshard-goldens/SKILL.md +54 -0
- package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
- package/skills/wildshard-upgrade/SKILL.md +46 -0
- package/src/.oxfmtrc.json +50 -0
- package/src/.oxlintrc.json +173 -0
- package/src/cli/account/account.ts +199 -0
- package/src/cli/account/command.ts +193 -0
- package/src/cli/account/key.ts +154 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/audio/audio.ts +24 -0
- package/src/cli/bin.mjs +8 -0
- package/src/cli/delete/delete.ts +258 -0
- package/src/cli/help.ts +196 -0
- package/src/cli/hero/adopt.ts +103 -0
- package/src/cli/hero/hero.ts +112 -0
- package/src/cli/hero/stamp.ts +298 -0
- package/src/cli/main.ts +292 -0
- package/src/cli/report.ts +16 -0
- package/src/cli/shardfile/command.ts +50 -0
- package/src/cli/shardfile/shardfile.ts +192 -0
- package/src/cli/upload/api.ts +246 -0
- package/src/cli/upload/compress.ts +55 -0
- package/src/cli/upload/hero.ts +62 -0
- package/src/cli/upload/placement.ts +115 -0
- package/src/cli/upload/provenance.ts +192 -0
- package/src/cli/upload/signature.ts +30 -0
- package/src/cli/upload/upload.ts +269 -0
- package/src/cli/upload/validate.ts +74 -0
- package/src/cli/upload/wire.ts +147 -0
- package/src/cli/version.ts +63 -0
- package/src/commons/bake/portableMath.ts +187 -0
- package/src/commons/catalogue.ts +10 -0
- package/src/commons/courseProgram.ts +32 -0
- package/src/commons/practiceCourse.ts +16 -0
- package/src/commons/scripts/abi.as +14 -0
- package/src/commons/scripts/bridge.as +14 -0
- package/src/commons/scripts/course.as +63 -0
- package/src/scripts/ask-new.sh +29 -0
- package/src/scripts/asks.mjs +141 -0
- package/src/scripts/herdr-prompt.sh +34 -0
- package/src/scripts/herdr-question-open.sh +67 -0
- package/src/scripts/md-wrap.mjs +229 -0
- package/src/server/app.ts +19 -0
- package/src/server/serve.ts +49 -0
- package/src/sharddev/admission.ts +7 -0
- package/src/sharddev/arenaView.ts +15 -0
- package/src/sharddev/as/groupBankV2.ts +36 -0
- package/src/sharddev/as/groupStepV2.ts +13 -0
- package/src/sharddev/as/ws.ts +30 -0
- package/src/sharddev/as/wsV2.ts +180 -0
- package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
- package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
- package/src/sharddev/assetHandle.ts +84 -0
- package/src/sharddev/assetOwner.ts +70 -0
- package/src/sharddev/assetScope.ts +30 -0
- package/src/sharddev/assets.ts +21 -0
- package/src/sharddev/audio.ts +9 -0
- package/src/sharddev/audioEncode.ts +211 -0
- package/src/sharddev/author.ts +3 -0
- package/src/sharddev/authorError.ts +28 -0
- package/src/sharddev/authorManifest.ts +39 -0
- package/src/sharddev/bake/annulus.ts +19 -0
- package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
- package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
- package/src/sharddev/bake/authoredWorld.ts +201 -0
- package/src/sharddev/bake/basisEncoder.ts +95 -0
- package/src/sharddev/bake/basisGlb.ts +85 -0
- package/src/sharddev/bake/basisTool.ts +74 -0
- package/src/sharddev/bake/basisToolInputs.ts +476 -0
- package/src/sharddev/bake/byteCodec.ts +33 -0
- package/src/sharddev/bake/canvasAtlas.ts +406 -0
- package/src/sharddev/bake/coarseCopy.ts +59 -0
- package/src/sharddev/bake/colliders.ts +87 -0
- package/src/sharddev/bake/compactGlb.ts +224 -0
- package/src/sharddev/bake/compileScript.ts +119 -0
- package/src/sharddev/bake/compileScriptV2.ts +75 -0
- package/src/sharddev/bake/contactRows.ts +84 -0
- package/src/sharddev/bake/creaturePlacement.ts +117 -0
- package/src/sharddev/bake/export.ts +67 -0
- package/src/sharddev/bake/facetedGeometry.ts +379 -0
- package/src/sharddev/bake/farImpostor.ts +120 -0
- package/src/sharddev/bake/forest.ts +100 -0
- package/src/sharddev/bake/format-hook.mjs +2 -0
- package/src/sharddev/bake/generatorGlb.ts +23 -0
- package/src/sharddev/bake/geometryBounds.ts +77 -0
- package/src/sharddev/bake/geometryError.ts +48 -0
- package/src/sharddev/bake/glb.ts +355 -0
- package/src/sharddev/bake/glbCompression.ts +143 -0
- package/src/sharddev/bake/gltfSource.ts +59 -0
- package/src/sharddev/bake/groundMap.ts +142 -0
- package/src/sharddev/bake/image.ts +20 -0
- package/src/sharddev/bake/isleMap.ts +64 -0
- package/src/sharddev/bake/json.mjs +84 -0
- package/src/sharddev/bake/keyedSky.ts +47 -0
- package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
- package/src/sharddev/bake/kinds.ts +137 -0
- package/src/sharddev/bake/lightSources.ts +31 -0
- package/src/sharddev/bake/mapAssembly.ts +84 -0
- package/src/sharddev/bake/mapRaster.ts +173 -0
- package/src/sharddev/bake/mapRest.ts +57 -0
- package/src/sharddev/bake/mapScenes.ts +234 -0
- package/src/sharddev/bake/materialGraph.ts +32 -0
- package/src/sharddev/bake/meadow.ts +27 -0
- package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
- package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
- package/src/sharddev/bake/nativeLattice.ts +178 -0
- package/src/sharddev/bake/nativeRaster.ts +106 -0
- package/src/sharddev/bake/nativeTerrainField.ts +11 -0
- package/src/sharddev/bake/navigation-json.mjs +38 -0
- package/src/sharddev/bake/navigation.ts +113 -0
- package/src/sharddev/bake/navigationAsset.ts +18 -0
- package/src/sharddev/bake/nearPlaceholder.ts +206 -0
- package/src/sharddev/bake/normalizeRig.ts +80 -0
- package/src/sharddev/bake/phoneAstc.ts +93 -0
- package/src/sharddev/bake/placeholders.ts +581 -0
- package/src/sharddev/bake/placement.ts +80 -0
- package/src/sharddev/bake/portableBytes.ts +18 -0
- package/src/sharddev/bake/portableBytesMemo.ts +50 -0
- package/src/sharddev/bake/practiceCourse.ts +49 -0
- package/src/sharddev/bake/primitives.ts +96 -0
- package/src/sharddev/bake/props.ts +443 -0
- package/src/sharddev/bake/questPlacement.ts +98 -0
- package/src/sharddev/bake/rawTexture.ts +26 -0
- package/src/sharddev/bake/riderArms.ts +97 -0
- package/src/sharddev/bake/rig.ts +95 -0
- package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
- package/src/sharddev/bake/signPlacements.ts +25 -0
- package/src/sharddev/bake/simplifier.ts +52 -0
- package/src/sharddev/bake/skinned.ts +312 -0
- package/src/sharddev/bake/slabChunks.ts +149 -0
- package/src/sharddev/bake/slabs.ts +263 -0
- package/src/sharddev/bake/source-loader.mjs +55 -0
- package/src/sharddev/bake/sourceMetadata.ts +54 -0
- package/src/sharddev/bake/species.ts +368 -0
- package/src/sharddev/bake/specimenCatalogue.ts +47 -0
- package/src/sharddev/bake/splatGround.ts +141 -0
- package/src/sharddev/bake/staticMaterials.ts +171 -0
- package/src/sharddev/bake/terrain.ts +195 -0
- package/src/sharddev/bake/texture.ts +33 -0
- package/src/sharddev/bake/textureWasm.ts +81 -0
- package/src/sharddev/bake/tileEncoder.ts +11 -0
- package/src/sharddev/bake/tileGrid.ts +62 -0
- package/src/sharddev/bake/v2Finite.ts +160 -0
- package/src/sharddev/bake/v2Fuel.ts +71 -0
- package/src/sharddev/bake/wholePartition.ts +74 -0
- package/src/sharddev/bake/wholePieceJoin.ts +147 -0
- package/src/sharddev/bake/world.ts +173 -0
- package/src/sharddev/bake/worldCollision.ts +128 -0
- package/src/sharddev/bake/worldGeometry.ts +237 -0
- package/src/sharddev/bake/worldGlb.ts +123 -0
- package/src/sharddev/bake/worldImage.ts +12 -0
- package/src/sharddev/bake/worldLod.ts +128 -0
- package/src/sharddev/bake/worldRows.ts +102 -0
- package/src/sharddev/bake/worldTextureMemo.ts +63 -0
- package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
- package/src/sharddev/bake.ts +193 -0
- package/src/sharddev/bakePublication.ts +31 -0
- package/src/sharddev/behaviourSource.ts +94 -0
- package/src/sharddev/bin/wildshard.mjs +7 -0
- package/src/sharddev/blobBytes.ts +65 -0
- package/src/sharddev/blobs.ts +138 -0
- package/src/sharddev/bootInventory.ts +129 -0
- package/src/sharddev/bossProfiles.ts +18 -0
- package/src/sharddev/buildBehaviour.ts +77 -0
- package/src/sharddev/buildCacheMetrics.ts +17 -0
- package/src/sharddev/buildDecisionScripts.ts +122 -0
- package/src/sharddev/check.ts +117 -0
- package/src/sharddev/checkProject.ts +126 -0
- package/src/sharddev/cli.ts +191 -0
- package/src/sharddev/clientChannels.ts +169 -0
- package/src/sharddev/clientScripts.ts +10 -0
- package/src/sharddev/commons.ts +77 -0
- package/src/sharddev/commonsCosts.ts +11 -0
- package/src/sharddev/compileMovers.ts +11 -0
- package/src/sharddev/configBoundary.ts +6 -0
- package/src/sharddev/cookInput.ts +40 -0
- package/src/sharddev/crowds.ts +6 -0
- package/src/sharddev/decisionBindingMap.ts +11 -0
- package/src/sharddev/decisionScriptBindings.ts +117 -0
- package/src/sharddev/decisionScripts.ts +28 -0
- package/src/sharddev/decisionSource.ts +51 -0
- package/src/sharddev/dev.ts +113 -0
- package/src/sharddev/director.ts +26 -0
- package/src/sharddev/directorAbi.ts +77 -0
- package/src/sharddev/discoveryDocument.ts +97 -0
- package/src/sharddev/draft.ts +11 -0
- package/src/sharddev/eliteEntryRows.ts +29 -0
- package/src/sharddev/entries.ts +76 -0
- package/src/sharddev/entryReads.ts +73 -0
- package/src/sharddev/executeBundle.ts +55 -0
- package/src/sharddev/finds.ts +5 -0
- package/src/sharddev/formatJsonSchema.ts +3 -0
- package/src/sharddev/generationCache.ts +257 -0
- package/src/sharddev/generationRecipe.ts +94 -0
- package/src/sharddev/handwritten.ts +110 -0
- package/src/sharddev/immutable.ts +14 -0
- package/src/sharddev/interactions.ts +38 -0
- package/src/sharddev/kit/bakedGeometry.ts +16 -0
- package/src/sharddev/kit/geometryPack.ts +110 -0
- package/src/sharddev/ledger.ts +13 -0
- package/src/sharddev/looks/tileField.ts +67 -0
- package/src/sharddev/materialGraphFiles.ts +57 -0
- package/src/sharddev/materials.ts +574 -0
- package/src/sharddev/measure.ts +18 -0
- package/src/sharddev/modes.ts +115 -0
- package/src/sharddev/moverPrograms.ts +213 -0
- package/src/sharddev/movers.ts +75 -0
- package/src/sharddev/nativePopulationRows.ts +46 -0
- package/src/sharddev/newProject.ts +247 -0
- package/src/sharddev/noise.ts +54 -0
- package/src/sharddev/outputProduct.ts +188 -0
- package/src/sharddev/outputRuntime.ts +66 -0
- package/src/sharddev/performancePolicy.ts +18 -0
- package/src/sharddev/phasedBoss.ts +34 -0
- package/src/sharddev/physics.ts +194 -0
- package/src/sharddev/platformSections.ts +42 -0
- package/src/sharddev/plumbing.ts +8 -0
- package/src/sharddev/productOutput.ts +128 -0
- package/src/sharddev/project.ts +337 -0
- package/src/sharddev/projectCompilerIdentity.ts +94 -0
- package/src/sharddev/projectDecisions.ts +66 -0
- package/src/sharddev/projectEntryProof.ts +32 -0
- package/src/sharddev/projectGeneration.ts +219 -0
- package/src/sharddev/projectInputFiles.ts +47 -0
- package/src/sharddev/projectManifest.ts +108 -0
- package/src/sharddev/projectMap.ts +35 -0
- package/src/sharddev/projectOutput.ts +242 -0
- package/src/sharddev/projectPolicy.ts +17 -0
- package/src/sharddev/projectSections.ts +27 -0
- package/src/sharddev/questGraph.ts +25 -0
- package/src/sharddev/quests.ts +65 -0
- package/src/sharddev/random.ts +61 -0
- package/src/sharddev/refusals.ts +234 -0
- package/src/sharddev/reportCard.ts +13 -0
- package/src/sharddev/returnProjectionV2.ts +81 -0
- package/src/sharddev/rows.ts +192 -0
- package/src/sharddev/runtimeImports.ts +38 -0
- package/src/sharddev/runtimeMirrors.ts +39 -0
- package/src/sharddev/runtimePerformance.ts +38 -0
- package/src/sharddev/scene.ts +321 -0
- package/src/sharddev/sceneAnimation.ts +54 -0
- package/src/sharddev/sceneAudio.ts +64 -0
- package/src/sharddev/sceneDeclarations.ts +100 -0
- package/src/sharddev/sceneGraph.ts +139 -0
- package/src/sharddev/sceneTransform.ts +12 -0
- package/src/sharddev/schemaValidation.ts +61 -0
- package/src/sharddev/sections.ts +47 -0
- package/src/sharddev/shardSource.ts +59 -0
- package/src/sharddev/sourceReader.ts +26 -0
- package/src/sharddev/spawns.ts +38 -0
- package/src/sharddev/species/clips.ts +24 -0
- package/src/sharddev/species.ts +29 -0
- package/src/sharddev/speciesBrains.ts +19 -0
- package/src/sharddev/synth.ts +66 -0
- package/src/sharddev/test/compileDualScriptV2.ts +71 -0
- package/src/sharddev/test/compileSimV2.ts +21 -0
- package/src/sharddev/test/diskScriptScenario.ts +86 -0
- package/src/sharddev/test/scriptScenario.ts +249 -0
- package/src/sharddev/test/scriptSource.ts +12 -0
- package/src/sharddev/version.ts +4 -0
- package/src/sharddev/weapons/bowProfile.ts +20 -0
- package/src/sharddev/weapons/firearmRows.ts +11 -0
- package/src/sharddev/weapons/meleeProfile.ts +71 -0
- package/src/sharddev/weapons/thrownProfile.ts +10 -0
- package/src/sharddev/worldScenes.ts +308 -0
- package/src/sharddev/worldSource.ts +82 -0
- package/src/shards/_template/README.md +78 -0
- package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
- package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
- package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
- package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
- package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
- package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
- package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
- package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
- package/src/shards/_template/behaviour/boss.as +39 -0
- package/src/shards/_template/behaviour/door.as +32 -0
- package/src/shards/_template/behaviour/hooks.json +129 -0
- package/src/shards/_template/behaviour/idle.as +75 -0
- package/src/shards/_template/behaviour/items.as +22 -0
- package/src/shards/_template/card/landscape.jpg +0 -0
- package/src/shards/_template/card/portrait.jpg +0 -0
- package/src/shards/_template/card/thumb.jpg +0 -0
- package/src/shards/_template/data/audio.json +45 -0
- package/src/shards/_template/data/bossDecision.json +83 -0
- package/src/shards/_template/data/budgets.json +70 -0
- package/src/shards/_template/data/card.json +281 -0
- package/src/shards/_template/data/clientScripts.json +987 -0
- package/src/shards/_template/data/creatures.json +65 -0
- package/src/shards/_template/data/director.json +39 -0
- package/src/shards/_template/data/encounters.json +96 -0
- package/src/shards/_template/data/items.json +172 -0
- package/src/shards/_template/data/layout.json +66 -0
- package/src/shards/_template/data/ledger.json +32 -0
- package/src/shards/_template/data/look.json +521 -0
- package/src/shards/_template/data/map.json +64 -0
- package/src/shards/_template/data/moves.json +16 -0
- package/src/shards/_template/data/placeholder.json +8 -0
- package/src/shards/_template/data/plumbing.json +32 -0
- package/src/shards/_template/data/quests.json +223 -0
- package/src/shards/_template/data/rows.json +423 -0
- package/src/shards/_template/data/skins.json +66 -0
- package/src/shards/_template/data/spawn.json +6 -0
- package/src/shards/_template/data/targets.json +150 -0
- package/src/shards/_template/data/text.json +12 -0
- package/src/shards/_template/data/ui.json +33 -0
- package/src/shards/_template/data/water.json +13 -0
- package/src/shards/_template/generators/behaviour.ts +34 -0
- package/src/shards/_template/generators/boss.ts +29 -0
- package/src/shards/_template/generators/buildOptions.ts +2 -0
- package/src/shards/_template/generators/cell.ts +224 -0
- package/src/shards/_template/generators/districts.ts +215 -0
- package/src/shards/_template/generators/farLook.ts +15 -0
- package/src/shards/_template/generators/generate.ts +27 -0
- package/src/shards/_template/generators/ground.ts +15 -0
- package/src/shards/_template/generators/kit.ts +69 -0
- package/src/shards/_template/generators/landscape.ts +59 -0
- package/src/shards/_template/generators/landscapeNoise.ts +62 -0
- package/src/shards/_template/generators/mapInputs.ts +10 -0
- package/src/shards/_template/generators/product.ts +100 -0
- package/src/shards/_template/generators/productOutput.ts +18 -0
- package/src/shards/_template/generators/props.ts +9 -0
- package/src/shards/_template/generators/templatePropsSource.ts +58 -0
- package/src/shards/_template/generators/terrain.ts +17 -0
- package/src/shards/_template/generators/world.ts +630 -0
- package/src/shards/_template/hero.json +10 -0
- package/src/shards/_template/look/entry-reads.json +20 -0
- package/src/shards/_template/manifest.json +281 -0
- package/src/shards/_template/shard.config.ts +10 -0
- package/src/shared/health.ts +10 -0
- package/src/tools/build-web.ts +59 -0
- package/src/tsconfig.json +30 -0
- package/src/web/app.tsx +53 -0
- package/src/web/index.html +12 -0
- package/src/web/main.tsx +10 -0
- package/src/web/tsconfig.json +13 -0
- package/tsconfig.author.json +23 -0
- package/tsconfig.commons.json +21 -0
- package/tsconfig.json +47 -0
- package/tsconfig.sharddev.json +20 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""The E285 rig gate for one rigged training dummy: pose extremes, measured and rendered.
|
|
2
|
+
|
|
3
|
+
blender -b -P scripts/practice/dummy_rig_gate.py -- <rigged.glb> <out dir> [--size 360]
|
|
4
|
+
|
|
5
|
+
Poses (the img2-character rig-gate sweep, as the dummy's procedural motion uses it): Spine pitch / lean +-25 deg,
|
|
6
|
+
Chest pitch / lean +-20 deg, Head pitch / turn +-35 deg, and each arm joint (UpperArm, ForeArm, Hand, one at a time, the rest of the chain following)
|
|
7
|
+
+-60 deg forward / back and out / in. For every pose it measures the skinned mesh against the rest mesh:
|
|
8
|
+
- edge stretch: posed / rest length of every edge (a tear shows as a long thin edge): max, p99.9 and min;
|
|
9
|
+
- collapse: the smallest posed / rest area of a triangle (candy-wrapping / pinching).
|
|
10
|
+
The numbers are measurements for the reader of the sheet, not pass bars (E388: the old > 2x and < 20 % flags had no source).
|
|
11
|
+
Writes <out dir>/gate.json and one PNG per pose (front three-quarter view), which scripts/practice/gate_sheet.py
|
|
12
|
+
lays out as a labelled sheet.
|
|
13
|
+
"""
|
|
14
|
+
import json
|
|
15
|
+
import math
|
|
16
|
+
import os
|
|
17
|
+
import sys
|
|
18
|
+
|
|
19
|
+
import bpy
|
|
20
|
+
from mathutils import Euler, Vector
|
|
21
|
+
|
|
22
|
+
argv = sys.argv[sys.argv.index("--") + 1:]
|
|
23
|
+
src, out = argv[0], argv[1]
|
|
24
|
+
size = int(argv[argv.index("--size") + 1]) if "--size" in argv else 360
|
|
25
|
+
os.makedirs(out, exist_ok=True)
|
|
26
|
+
|
|
27
|
+
if src.endswith(".blend"):
|
|
28
|
+
bpy.ops.wm.open_mainfile(filepath=src) # the rig as built: bone axes exactly as rig_dummy.py rolled them
|
|
29
|
+
else:
|
|
30
|
+
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
31
|
+
bpy.ops.import_scene.gltf(filepath=src)
|
|
32
|
+
scene = bpy.context.scene
|
|
33
|
+
arm = next(o for o in scene.objects if o.type == "ARMATURE")
|
|
34
|
+
mesh = next(o for o in scene.objects if o.type == "MESH")
|
|
35
|
+
|
|
36
|
+
POSES = [("rest", {})]
|
|
37
|
+
for bone, deg in (("Spine", 25), ("Chest", 20)):
|
|
38
|
+
for sgn in (1, -1):
|
|
39
|
+
POSES.append((f"{bone} pitch {sgn * deg:+d}", {bone: ("X", sgn * deg)}))
|
|
40
|
+
POSES.append((f"{bone} lean {sgn * deg:+d}", {bone: ("Z", sgn * deg)}))
|
|
41
|
+
for sgn in (1, -1):
|
|
42
|
+
POSES.append((f"Head pitch {sgn * 35:+d}", {"Head": ("X", sgn * 35)}))
|
|
43
|
+
POSES.append((f"Head turn {sgn * 35:+d}", {"Head": ("Y", sgn * 35)}))
|
|
44
|
+
for side in ("Left", "Right"):
|
|
45
|
+
for bone, short in ((f"{side}UpperArm", "upper arm"), (f"{side}ForeArm", "forearm"), (f"{side}Hand", "hand")):
|
|
46
|
+
for axis, label in (("X", "swing"), ("Z", "raise")):
|
|
47
|
+
for sgn in (1, -1):
|
|
48
|
+
POSES.append((f"{side} {short} {label} {sgn * 60:+d}", {bone: (axis, sgn * 60)}))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def evaluated():
|
|
52
|
+
dg = bpy.context.evaluated_depsgraph_get()
|
|
53
|
+
ev = mesh.evaluated_get(dg)
|
|
54
|
+
m = ev.to_mesh()
|
|
55
|
+
pts = [mesh.matrix_world @ v.co for v in m.vertices]
|
|
56
|
+
tris = [tuple(t.vertices) for t in m.loop_triangles] if m.loop_triangles else None
|
|
57
|
+
if tris is None:
|
|
58
|
+
m.calc_loop_triangles()
|
|
59
|
+
tris = [tuple(t.vertices) for t in m.loop_triangles]
|
|
60
|
+
ev.to_mesh_clear()
|
|
61
|
+
return pts, tris
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def reset():
|
|
65
|
+
for pb in arm.pose.bones:
|
|
66
|
+
pb.rotation_mode = "XYZ"
|
|
67
|
+
pb.rotation_euler = Euler((0, 0, 0))
|
|
68
|
+
pb.location = (0, 0, 0)
|
|
69
|
+
bpy.context.view_layer.update()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
reset()
|
|
73
|
+
rest, tris = evaluated()
|
|
74
|
+
edges = set()
|
|
75
|
+
for a, b, c in tris:
|
|
76
|
+
for u, v in ((a, b), (b, c), (c, a)):
|
|
77
|
+
edges.add((min(u, v), max(u, v)))
|
|
78
|
+
edges = list(edges)
|
|
79
|
+
rest_len = [(rest[u] - rest[v]).length for u, v in edges]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def area(p, t):
|
|
83
|
+
a, b, c = t
|
|
84
|
+
return (p[b] - p[a]).cross(p[c] - p[a]).length / 2
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
rest_area = [area(rest, t) for t in tris]
|
|
88
|
+
|
|
89
|
+
# camera + light
|
|
90
|
+
scene.render.engine = "BLENDER_EEVEE"
|
|
91
|
+
scene.render.resolution_x = size
|
|
92
|
+
scene.render.resolution_y = int(size * 1.3)
|
|
93
|
+
world = bpy.data.worlds.new("w")
|
|
94
|
+
scene.world = world
|
|
95
|
+
world.use_nodes = True
|
|
96
|
+
world.node_tree.nodes["Background"].inputs[0].default_value = (0.09, 0.11, 0.14, 1)
|
|
97
|
+
world.node_tree.nodes["Background"].inputs[1].default_value = 1.4
|
|
98
|
+
sun = bpy.data.objects.new("sun", bpy.data.lights.new("sun", "SUN"))
|
|
99
|
+
sun.data.energy = 3.0
|
|
100
|
+
sun.rotation_euler = Euler((math.radians(55), 0, math.radians(-20)))
|
|
101
|
+
scene.collection.objects.link(sun)
|
|
102
|
+
cam = bpy.data.objects.new("cam", bpy.data.cameras.new("cam"))
|
|
103
|
+
cam.data.type = "ORTHO"
|
|
104
|
+
cam.data.ortho_scale = 3.3
|
|
105
|
+
scene.collection.objects.link(cam)
|
|
106
|
+
scene.camera = cam
|
|
107
|
+
target = Vector((0, 0, 1.4))
|
|
108
|
+
a = math.radians(30)
|
|
109
|
+
d = Vector((math.sin(a), -math.cos(a), 0.12)) * 8
|
|
110
|
+
cam.location = target + d
|
|
111
|
+
cam.rotation_euler = (-d).to_track_quat("-Z", "Y").to_euler()
|
|
112
|
+
|
|
113
|
+
results = []
|
|
114
|
+
for i, (name, rots) in enumerate(POSES):
|
|
115
|
+
reset()
|
|
116
|
+
for bname, (axis, deg) in rots.items():
|
|
117
|
+
pb = arm.pose.bones[bname]
|
|
118
|
+
e = [0.0, 0.0, 0.0]
|
|
119
|
+
e["XYZ".index(axis)] = math.radians(deg)
|
|
120
|
+
pb.rotation_euler = Euler(e)
|
|
121
|
+
bpy.context.view_layer.update()
|
|
122
|
+
pts, _ = evaluated()
|
|
123
|
+
ratios = sorted((pts[u] - pts[v]).length / max(rl, 1e-7) for (u, v), rl in zip(edges, rest_len))
|
|
124
|
+
n = len(ratios)
|
|
125
|
+
area_min = min(area(pts, t) / ra for t, ra in zip(tris, rest_area) if ra > 1e-8)
|
|
126
|
+
row = {
|
|
127
|
+
"pose": name,
|
|
128
|
+
"stretch_max": round(ratios[-1], 3),
|
|
129
|
+
"stretch_p999": round(ratios[int(n * 0.999)], 3),
|
|
130
|
+
"shrink_min": round(ratios[0], 3),
|
|
131
|
+
"area_min": round(area_min, 3),
|
|
132
|
+
"tris": len(tris),
|
|
133
|
+
}
|
|
134
|
+
results.append(row)
|
|
135
|
+
scene.render.filepath = os.path.join(out, f"{i:02d}.png")
|
|
136
|
+
bpy.ops.render.render(write_still=True)
|
|
137
|
+
print("GATE", json.dumps(row), flush=True)
|
|
138
|
+
|
|
139
|
+
json.dump({"source": src, "poses": results}, open(os.path.join(out, "gate.json"), "w"), indent=1)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Lay out dummy_rig_gate.py's pose renders as one labelled JPEG sheet.
|
|
2
|
+
|
|
3
|
+
python3 scripts/practice/gate_sheet.py <gate dir> <out.jpg> [--cols 7] [--title "..."]
|
|
4
|
+
"""
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
10
|
+
|
|
11
|
+
d, out = sys.argv[1], sys.argv[2]
|
|
12
|
+
cols = int(sys.argv[sys.argv.index("--cols") + 1]) if "--cols" in sys.argv else 7
|
|
13
|
+
title = sys.argv[sys.argv.index("--title") + 1] if "--title" in sys.argv else ""
|
|
14
|
+
g = json.load(open(os.path.join(d, "gate.json")))
|
|
15
|
+
tiles = [Image.open(os.path.join(d, f"{i:02d}.png")).convert("RGB") for i in range(len(g["poses"]))]
|
|
16
|
+
w, h = tiles[0].size
|
|
17
|
+
rows = (len(tiles) + cols - 1) // cols
|
|
18
|
+
head = 44 if title else 0
|
|
19
|
+
sheet = Image.new("RGB", (w * cols, h * rows + head), (13, 27, 38))
|
|
20
|
+
draw = ImageDraw.Draw(sheet)
|
|
21
|
+
try:
|
|
22
|
+
font = ImageFont.truetype("/System/Library/Fonts/Menlo.ttc", 15)
|
|
23
|
+
big = ImageFont.truetype("/System/Library/Fonts/Menlo.ttc", 24)
|
|
24
|
+
except OSError:
|
|
25
|
+
font = big = ImageFont.load_default()
|
|
26
|
+
if title:
|
|
27
|
+
draw.text((12, 8), title, fill=(143, 227, 255), font=big)
|
|
28
|
+
for i, (t, row) in enumerate(zip(tiles, g["poses"])):
|
|
29
|
+
x, y = (i % cols) * w, (i // cols) * h + head
|
|
30
|
+
sheet.paste(t, (x, y))
|
|
31
|
+
draw.rectangle([x, y, x + w - 1, y + 40], fill=(13, 27, 38))
|
|
32
|
+
draw.text((x + 6, y + 3), row["pose"].upper(), fill=(143, 227, 255), font=font)
|
|
33
|
+
draw.text((x + 6, y + 21), f"stretch {row['stretch_max']}x min area {row['area_min']}", fill=(180, 220, 180), font=font)
|
|
34
|
+
draw.rectangle([x, y, x + w - 1, y + h - 1], outline=(143, 227, 255))
|
|
35
|
+
sheet.save(out, quality=86)
|
|
36
|
+
print(out, sheet.size)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""E336: local text-to-motion on the three original dummy skeletons (no mesh regeneration).
|
|
2
|
+
|
|
3
|
+
PYTHONPATH must include the pinned UniMate checkout, Motion checkout and local deps.
|
|
4
|
+
Run under the machine-wide model lock. Weights remain in ~/projects/weights.
|
|
5
|
+
Writes raw 60-frame features and T-pose-relative model-space rotations for review.
|
|
6
|
+
"""
|
|
7
|
+
import argparse
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
import torch
|
|
15
|
+
from Animation import positions_global, rotations_global
|
|
16
|
+
from Quaternions import Quaternions
|
|
17
|
+
from transformers import T5EncoderModel, T5Tokenizer
|
|
18
|
+
|
|
19
|
+
from data_process.utils.motion_features import process_tpose, build_topology_cond
|
|
20
|
+
from data_process.joint_annotation.names_clean_rule import clean_joint_name, post_process
|
|
21
|
+
from unimate.configs.schema import MainConfig
|
|
22
|
+
from unimate.models.factory import create_model, create_transport
|
|
23
|
+
from unimate.models.flow.transport import Sampler
|
|
24
|
+
from unimate.inference.generate import ClassifierFreeSampleModel
|
|
25
|
+
from unimate.dataset.mixture.collate import mixture_batch_collate
|
|
26
|
+
from unimate.dataset.transforms import build_parent_features
|
|
27
|
+
from unimate.training.ema import EMAModel
|
|
28
|
+
from unimate.utils.motion_utils import hml_rotations_to_bvh_quaternions
|
|
29
|
+
|
|
30
|
+
PROMPTS = {
|
|
31
|
+
'idle': 'An object stands still with its arms hanging loosely and gently sways its upper body.',
|
|
32
|
+
'body-hit': 'An object recoils backward from a hit to the chest and returns to standing upright.',
|
|
33
|
+
'head-hit': 'An object snaps its head backward from a hit and then returns to standing upright.',
|
|
34
|
+
'hit-left': 'An object recoils sideways from a hit on its left shoulder and returns to standing upright.',
|
|
35
|
+
'hit-right': 'An object recoils sideways from a hit on its right shoulder and returns to standing upright.',
|
|
36
|
+
'heavy-hit': 'An object bends forward at the waist from a heavy hit and slowly recovers to standing upright.',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
ap = argparse.ArgumentParser()
|
|
42
|
+
ap.add_argument('--work', required=True)
|
|
43
|
+
ap.add_argument('--weights', default=os.path.expanduser('~/projects/weights/manual/Linzhan/UniMate/unimate_uniml3d_f60_v2'))
|
|
44
|
+
ap.add_argument('--text', default=os.path.expanduser('~/projects/weights/manual/google/flan-t5-base'))
|
|
45
|
+
ap.add_argument('--device', default='mps')
|
|
46
|
+
ap.add_argument('--seed', type=int, default=336)
|
|
47
|
+
args = ap.parse_args()
|
|
48
|
+
work = Path(args.work)
|
|
49
|
+
cfg = MainConfig.from_json(str(Path(args.weights) / 'config.json'))
|
|
50
|
+
stats = np.load(Path(args.weights) / 'dataset_stats.npy', allow_pickle=True).item()['objaverse']
|
|
51
|
+
start = time.monotonic()
|
|
52
|
+
torch.manual_seed(args.seed)
|
|
53
|
+
torch.set_num_threads(4)
|
|
54
|
+
device = torch.device(args.device)
|
|
55
|
+
tok = T5Tokenizer.from_pretrained(args.text, local_files_only=True)
|
|
56
|
+
encoder = T5EncoderModel.from_pretrained(args.text, local_files_only=True).to(device).eval()
|
|
57
|
+
|
|
58
|
+
def embed(texts):
|
|
59
|
+
inputs = tok(texts, padding=True, return_tensors='pt').to(device)
|
|
60
|
+
with torch.inference_mode():
|
|
61
|
+
hidden = encoder(**inputs).last_hidden_state
|
|
62
|
+
mask = inputs.attention_mask[..., None]
|
|
63
|
+
return ((hidden * mask).sum(1) / mask.sum(1)).float().cpu().numpy()
|
|
64
|
+
|
|
65
|
+
batches, rigs = [], {}
|
|
66
|
+
for variant in ['wood', 'straw-cloth', 'wood-steel']:
|
|
67
|
+
raw = json.loads((work / f'{variant}.json').read_text())
|
|
68
|
+
rows = raw['joints']
|
|
69
|
+
q = np.array([r['quaternion'] for r in rows])[:, [3, 0, 1, 2]]
|
|
70
|
+
tpos = {'names': np.array([r['name'] for r in rows]), 'parents': np.array([r['parent'] for r in rows]),
|
|
71
|
+
'rest_local_pos': np.array([r['position'] for r in rows]), 'rest_local_rot': q, 'fps': np.array(30)}
|
|
72
|
+
anim, offsets, scale, ground, parents, names, fps, order, face, axis = process_tpose(
|
|
73
|
+
tpos, face_joints={'r_hip': {'raw': 'RightThigh'}, 'l_hip': {'raw': 'LeftThigh'}})
|
|
74
|
+
clean = [post_process(clean_joint_name(n, variant)) for n in names]
|
|
75
|
+
c = build_topology_cond(variant, parents, offsets, names, clean, positions_global(anim)[0],
|
|
76
|
+
anim.rotations.qs[0], rotations_global(anim).qs[0], face_joint_idxs=face, scale_factor=scale)
|
|
77
|
+
n = len(names)
|
|
78
|
+
mean = np.repeat(stats['mean_local'][None], n, axis=0)
|
|
79
|
+
std = np.repeat(stats['std_local'][None], n, axis=0)
|
|
80
|
+
mean[0], std[0] = stats['mean_root'], stats['std_root']
|
|
81
|
+
ff = np.concatenate([c['tpos_first_frame'], np.tile([1, 0, 0, 0, 1, 0, 0, 0, 0], (n, 1))], axis=-1)
|
|
82
|
+
ff = ((ff - mean) / std).astype(np.float32)
|
|
83
|
+
joint_emb = embed(clean)
|
|
84
|
+
caption_emb = embed(list(PROMPTS.values()))
|
|
85
|
+
rigs[variant] = {'names': names, 'order': [int(x) for x in order], 'parents': [int(x) for x in parents],
|
|
86
|
+
'rest': raw, 'canonicalGlobalQuaternions': c['tpos_global_rotations'].tolist()}
|
|
87
|
+
for i, (clip, prompt) in enumerate(PROMPTS.items()):
|
|
88
|
+
b = {'motion': np.zeros((60, n, 12), np.float32), 'max_motion_length': 60, 'motion_length': 60,
|
|
89
|
+
'max_joints': cfg.dataset.max_joints, 'parents': np.array(parents), 'edge_indexs': c['edge_indexs'],
|
|
90
|
+
'tpos_first_frame': ff, 'offsets': offsets.astype(np.float32),
|
|
91
|
+
'joint_graph_dist': c['joint_graph_dists'], 'joint_relations': c['joint_relations'],
|
|
92
|
+
'joint_depths': np.array(c['joint_depths']), 'spectral_feats': c['spectral_feats'].astype(np.float32),
|
|
93
|
+
'joint_names_emb': joint_emb, 'object_type': variant, 'start_idx': 0,
|
|
94
|
+
'mean': mean.astype(np.float32), 'std': std.astype(np.float32), 'caption_emb': caption_emb[i],
|
|
95
|
+
'clip': clip, 'prompt': prompt}
|
|
96
|
+
b.update(build_parent_features(ff, parents))
|
|
97
|
+
batches.append(b)
|
|
98
|
+
del encoder
|
|
99
|
+
torch.mps.empty_cache() if device.type == 'mps' else None
|
|
100
|
+
model = create_model(cfg.dataset, cfg.model)
|
|
101
|
+
ckpt = torch.load(Path(args.weights) / 'checkpoints/checkpoint_step_100000.pt', map_location='cpu', weights_only=False)
|
|
102
|
+
model.load_state_dict(ckpt['model_state_dict'])
|
|
103
|
+
ema = EMAModel(model.parameters())
|
|
104
|
+
ema.load_state_dict(ckpt['ema_state_dict'])
|
|
105
|
+
ema.copy_to(model.parameters())
|
|
106
|
+
del ckpt, ema
|
|
107
|
+
model = model.to(device).eval()
|
|
108
|
+
guided = ClassifierFreeSampleModel(model, cfg_scale=3)
|
|
109
|
+
sampler = Sampler(create_transport(training_config=cfg.training)).sample_ode(sampling_method='heun2', num_steps=32)
|
|
110
|
+
outputs = []
|
|
111
|
+
for b in batches:
|
|
112
|
+
t = time.monotonic()
|
|
113
|
+
motion, cond = mixture_batch_collate([b])
|
|
114
|
+
cond = {k: v.to(device) if torch.is_tensor(v) else v for k, v in cond.items()}
|
|
115
|
+
with torch.inference_mode():
|
|
116
|
+
result = sampler(torch.randn(motion.shape, device=device), guided, cond=cond)[-1]
|
|
117
|
+
n = len(b['parents'])
|
|
118
|
+
features = result[0, :n].cpu().permute(2, 0, 1).numpy() * b['std'][None] + b['mean'][None]
|
|
119
|
+
if not np.isfinite(features).all():
|
|
120
|
+
raise ValueError('Non-finite generated motion')
|
|
121
|
+
delta = hml_rotations_to_bvh_quaternions(features[:, :, 3:9], b['parents']).qs
|
|
122
|
+
np.save(work / f"{b['object_type']}-{b['clip']}-raw.npy", features)
|
|
123
|
+
outputs.append({'variant': b['object_type'], 'clip': b['clip'], 'prompt': b['prompt'],
|
|
124
|
+
'names': rigs[b['object_type']]['names'], 'parents': rigs[b['object_type']]['parents'],
|
|
125
|
+
'deltaQuaternionsWXYZ': delta.tolist(), 'seconds': round(time.monotonic() - t, 3)})
|
|
126
|
+
print('GENERATED', b['object_type'], b['clip'], outputs[-1]['seconds'], flush=True)
|
|
127
|
+
(work / 'generated.json').write_text(json.dumps({'seed': args.seed, 'device': args.device, 'rigs': rigs, 'clips': outputs}))
|
|
128
|
+
print('TOTAL', round(time.monotonic() - start, 3), 'MPS bytes', torch.mps.driver_allocated_memory() if device.type == 'mps' else 0, flush=True)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == '__main__':
|
|
132
|
+
main()
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Pack a rigged training dummy without changing its skin's metre-scale positions.
|
|
2
|
+
*
|
|
3
|
+
* node scripts/practice/pack_dummy.mjs /tmp/wood-rigged.glb public/assets/practice/dummies/wood-wood.glb
|
|
4
|
+
*
|
|
5
|
+
* WebP textures at 1024² (E285; 512² before), meshopt, and KHR_mesh_quantization on UVs, normals and weights.
|
|
6
|
+
*
|
|
7
|
+
* The glTF-Transform meshopt CLI quantizes skinned POSITION into [-1, 1] here
|
|
8
|
+
* without restoring the node scale. That puts half the dummy under the floor
|
|
9
|
+
* and detaches its visible body from the arena hitboxes. Encode the float
|
|
10
|
+
* accessors directly with EXT_meshopt_compression instead.
|
|
11
|
+
*/
|
|
12
|
+
import { execFileSync } from 'node:child_process';
|
|
13
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
14
|
+
import { tmpdir } from 'node:os';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { NodeIO } from '@gltf-transform/core';
|
|
17
|
+
import { EXTMeshoptCompression, EXTTextureWebP, KHRMeshQuantization } from '@gltf-transform/extensions';
|
|
18
|
+
import { quantize } from '@gltf-transform/functions';
|
|
19
|
+
import { MeshoptEncoder, MeshoptDecoder } from 'meshoptimizer';
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
if (process.argv.length < 4) throw new Error('Usage: node scripts/practice/pack_dummy.mjs <rigged.glb> <shipped.glb>');
|
|
23
|
+
const source = process.argv[2];
|
|
24
|
+
const target = process.argv[3];
|
|
25
|
+
const scratch = mkdtempSync(path.join(tmpdir(), 'wildshard-dummy-'));
|
|
26
|
+
try {
|
|
27
|
+
const resized = path.join(scratch, 'resized.glb');
|
|
28
|
+
execFileSync(path.resolve(import.meta.dirname, '../../node_modules/.bin/gltf-transform'), [
|
|
29
|
+
'optimize', source, resized,
|
|
30
|
+
'--compress', 'false', '--flatten', 'false', '--join', 'false',
|
|
31
|
+
'--instance', 'false', '--simplify', 'false',
|
|
32
|
+
'--texture-compress', 'webp', '--texture-size', '1024',
|
|
33
|
+
], { stdio: 'inherit' });
|
|
34
|
+
await MeshoptEncoder.ready;
|
|
35
|
+
await MeshoptDecoder.ready;
|
|
36
|
+
const io = new NodeIO()
|
|
37
|
+
.registerExtensions([EXTMeshoptCompression, EXTTextureWebP, KHRMeshQuantization])
|
|
38
|
+
.registerDependencies({ 'meshopt.encoder': MeshoptEncoder, 'meshopt.decoder': MeshoptDecoder });
|
|
39
|
+
const document = await io.read(resized);
|
|
40
|
+
// Everything but POSITION may shrink (E285: 40k skinned vertices were ~1.1 MB of the 1.6 MB steel GLB):
|
|
41
|
+
// 16-bit UVs, 8-bit normals and 8-bit weights. POSITION stays float, see above.
|
|
42
|
+
await document.transform(quantize({
|
|
43
|
+
pattern: /^(TEXCOORD|NORMAL|WEIGHTS)/, quantizeTexcoord: 16, quantizeNormal: 8, quantizeWeight: 8,
|
|
44
|
+
}));
|
|
45
|
+
document.createExtension(KHRMeshQuantization).setRequired(true);
|
|
46
|
+
document.createExtension(EXTMeshoptCompression).setRequired(true)
|
|
47
|
+
.setEncoderOptions({ method: EXTMeshoptCompression.EncoderMethod.FILTER });
|
|
48
|
+
await io.write(target, document);
|
|
49
|
+
} finally {
|
|
50
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
await main();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error(error);
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** E336: smooth voxel-binding discontinuities and remove torso leakage down the arms.
|
|
2
|
+
* Preserves positions, indices, skeleton, bind matrices and textures. Input/output may be identical.
|
|
3
|
+
* node scripts/practice/repair_dummy_weights.mjs <source.glb> <target.glb>
|
|
4
|
+
*/
|
|
5
|
+
import { NodeIO } from '@gltf-transform/core';
|
|
6
|
+
import { ALL_EXTENSIONS, EXTMeshoptCompression } from '@gltf-transform/extensions';
|
|
7
|
+
import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
|
|
8
|
+
import { Matrix4, Vector3 } from 'three';
|
|
9
|
+
|
|
10
|
+
const [source, target] = process.argv.slice(2);
|
|
11
|
+
if (!source || !target) throw new Error('Usage: repair_dummy_weights.mjs <source.glb> <target.glb>');
|
|
12
|
+
await Promise.all([MeshoptDecoder.ready, MeshoptEncoder.ready]);
|
|
13
|
+
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS).registerDependencies({ 'meshopt.decoder': MeshoptDecoder, 'meshopt.encoder': MeshoptEncoder });
|
|
14
|
+
const doc = await io.read(source);
|
|
15
|
+
const radius = 0.065, cell = radius, sigma2 = (radius / 2) ** 2;
|
|
16
|
+
for (const node of doc.getRoot().listNodes()) {
|
|
17
|
+
const skin = node.getSkin(), mesh = node.getMesh();
|
|
18
|
+
if (!skin || !mesh) continue;
|
|
19
|
+
const names = skin.listJoints().map((joint) => joint.getName()), count = names.length;
|
|
20
|
+
const matrix = new Matrix4().fromArray(node.getWorldMatrix());
|
|
21
|
+
for (const primitive of mesh.listPrimitives()) {
|
|
22
|
+
const positions = primitive.getAttribute('POSITION'), weights = primitive.getAttribute('WEIGHTS_0'), indices = primitive.getAttribute('JOINTS_0');
|
|
23
|
+
if (!positions || !weights || !indices) throw new Error('Incomplete skin');
|
|
24
|
+
const n = positions.getCount(), dense = new Float64Array(n * count), points = [], cells = new Map();
|
|
25
|
+
const p = [], w = [], ix = [];
|
|
26
|
+
for (let i = 0; i < n; i++) {
|
|
27
|
+
positions.getElement(i, p); weights.getElement(i, w); indices.getElement(i, ix);
|
|
28
|
+
const point = new Vector3().fromArray(p).applyMatrix4(matrix); points.push(point);
|
|
29
|
+
for (let k = 0; k < 4; k++) dense[i * count + ix[k]] += w[k];
|
|
30
|
+
// Old geodesic flood occasionally crossed from an arm into the torso. Fade that contribution out below shoulder.
|
|
31
|
+
const side = point.x > 0 ? 'Left' : 'Right';
|
|
32
|
+
const armAmount = names.reduce((sum, name, j) => sum + (name.startsWith(side) && /Shoulder|Arm|Hand/.test(name) ? dense[i * count + j] : 0), 0);
|
|
33
|
+
const remove = Math.min(1, Math.max(0, (Math.abs(point.x) - 0.23) / 0.12)) * Math.min(1, Math.max(0, (2.05 - point.y) / 0.16));
|
|
34
|
+
if (armAmount > 0.2) for (let j = 0; j < count; j++) {
|
|
35
|
+
if (['Pelvis', 'Spine', 'Chest', 'Neck', 'Head'].includes(names[j])) dense[i * count + j] *= 1 - remove;
|
|
36
|
+
}
|
|
37
|
+
let sum = 0; for (let j = 0; j < count; j++) sum += dense[i * count + j];
|
|
38
|
+
for (let j = 0; j < count; j++) dense[i * count + j] /= sum;
|
|
39
|
+
const key = [point.x, point.y, point.z].map((v) => Math.floor(v / cell)).join(',');
|
|
40
|
+
const list = cells.get(key) ?? []; list.push(i); cells.set(key, list);
|
|
41
|
+
}
|
|
42
|
+
const newWeights = new Float32Array(n * 4), newIndices = new Uint16Array(n * 4);
|
|
43
|
+
for (let i = 0; i < n; i++) {
|
|
44
|
+
const point = points[i], accumulated = new Float64Array(count);
|
|
45
|
+
// The foot/base stays rigid. Smooth the hip/post junction too: a hard height boundary creates new creases.
|
|
46
|
+
if (point.y < 0.2) {
|
|
47
|
+
weights.getElement(i, w); indices.getElement(i, ix);
|
|
48
|
+
newWeights.set(w, i * 4); newIndices.set(ix, i * 4); continue;
|
|
49
|
+
}
|
|
50
|
+
const cx = Math.floor(point.x / cell), cy = Math.floor(point.y / cell), cz = Math.floor(point.z / cell);
|
|
51
|
+
for (let x = cx - 1; x <= cx + 1; x++) for (let y = cy - 1; y <= cy + 1; y++) for (let z = cz - 1; z <= cz + 1; z++) {
|
|
52
|
+
for (const k of cells.get(`${x},${y},${z}`) ?? []) {
|
|
53
|
+
const d2 = point.distanceToSquared(points[k]); if (d2 > radius * radius) continue;
|
|
54
|
+
const influence = Math.exp(-d2 / (2 * sigma2));
|
|
55
|
+
for (let j = 0; j < count; j++) accumulated[j] += influence * dense[k * count + j];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const ranked = Array.from(accumulated, (weight, j) => ({ weight, j })).sort((a, b) => b.weight - a.weight).slice(0, 4);
|
|
59
|
+
const sum = ranked.reduce((total, r) => total + r.weight, 0);
|
|
60
|
+
if (!(sum > 0)) throw new Error('Unbound vertex');
|
|
61
|
+
ranked.forEach((r, k) => { newIndices[i * 4 + k] = r.j; newWeights[i * 4 + k] = r.weight / sum; });
|
|
62
|
+
}
|
|
63
|
+
weights.setArray(newWeights); indices.setArray(newIndices);
|
|
64
|
+
console.log(mesh.getName(), n, 'weights repaired; geometry and rest rig preserved');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
doc.createExtension(EXTMeshoptCompression).setRequired(true).setEncoderOptions({ method: EXTMeshoptCompression.EncoderMethod.FILTER });
|
|
68
|
+
await io.write(target, doc);
|