@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.
Files changed (687) hide show
  1. package/GUIDE.md +790 -0
  2. package/README.md +13 -5
  3. package/bin/wildshard.mjs +38 -0
  4. package/lint/declaration-config.d.mts +2 -0
  5. package/lint/declaration-config.mjs +19 -0
  6. package/lint/engine-plugin.d.mts +2 -0
  7. package/lint/engine-plugin.mjs +40 -0
  8. package/lint/host-callbacks.d.mts +6 -0
  9. package/lint/host-callbacks.mjs +123 -0
  10. package/lint/host-files.d.mts +1 -0
  11. package/lint/host-files.mjs +7 -0
  12. package/lint/layer-exports.d.mts +2 -0
  13. package/lint/layer-exports.mjs +21 -0
  14. package/lint/legacy-line-basis.json +995 -0
  15. package/lint/nine-tiling-baseline.json +35 -0
  16. package/lint/ratchet.json +11 -0
  17. package/lint/runtime-files.d.mts +12 -0
  18. package/lint/runtime-files.json +16 -0
  19. package/lint/runtime-files.mjs +69 -0
  20. package/lint/runtime-performance.d.mts +6 -0
  21. package/lint/runtime-performance.mjs +184 -0
  22. package/lint/sdk-plugin.d.mts +4 -0
  23. package/lint/sdk-plugin.mjs +134 -0
  24. package/lint/shardfile-boundaries.d.mts +10 -0
  25. package/lint/shardfile-boundaries.mjs +122 -0
  26. package/lint/tile-bake-debt.json +556 -0
  27. package/package.json +365 -3
  28. package/scripts/agent-parity.mjs +1524 -0
  29. package/scripts/agent-sync.mjs +518 -0
  30. package/scripts/apfs-clone.mjs +67 -0
  31. package/scripts/assert-store-layout.mjs +23 -0
  32. package/scripts/astc6-phone-cap.d.mts +3 -0
  33. package/scripts/astc6-phone-cap.mjs +137 -0
  34. package/scripts/audit-assets.d.mts +10 -0
  35. package/scripts/audit-assets.mjs +151 -0
  36. package/scripts/bake/coatFiles.d.mts +6 -0
  37. package/scripts/bake/coatFiles.mjs +37 -0
  38. package/scripts/bake/environment.d.mts +2 -0
  39. package/scripts/bake/environment.mjs +58 -0
  40. package/scripts/bake/far-proxies.mjs +45 -0
  41. package/scripts/bake/keyed-sky.d.mts +4 -0
  42. package/scripts/bake/keyed-sky.mjs +34 -0
  43. package/scripts/bake/movers.mjs +56 -0
  44. package/scripts/bake/nativeWorld.d.mts +6 -0
  45. package/scripts/bake/nativeWorld.mjs +43 -0
  46. package/scripts/bake/navmeshGround.ts +22 -0
  47. package/scripts/bake/near-placeholder.mjs +331 -0
  48. package/scripts/bake/placeholderShards.mjs +41 -0
  49. package/scripts/bake/skins.mjs +15 -0
  50. package/scripts/bake/template-skins.mjs +33 -0
  51. package/scripts/bake/viewmodelBytes.ts +26 -0
  52. package/scripts/bake/viewmodelPage.ts +11 -0
  53. package/scripts/bake/worldHost.d.mts +35 -0
  54. package/scripts/bake/worldHost.mjs +110 -0
  55. package/scripts/bake-astc6.cache.json +80 -0
  56. package/scripts/bake-astc6.far-reach.cache.json +23 -0
  57. package/scripts/bake-astc6.list.json +111 -0
  58. package/scripts/bake-astc6.mjs +279 -0
  59. package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
  60. package/scripts/bake-catalogue.mjs +44 -0
  61. package/scripts/bake-check.mjs +54 -0
  62. package/scripts/bake-chunk.mjs +124 -0
  63. package/scripts/bake-cloud-field.mjs +24 -0
  64. package/scripts/bake-coats.mjs +110 -0
  65. package/scripts/bake-data-maps.d.mts +24 -0
  66. package/scripts/bake-data-maps.mjs +72 -0
  67. package/scripts/bake-entry-programs.mjs +117 -0
  68. package/scripts/bake-geometry.mjs +106 -0
  69. package/scripts/bake-hybrid-tiles.mjs +28 -0
  70. package/scripts/bake-ktx2.cache.json +276 -0
  71. package/scripts/bake-ktx2.list.json +365 -0
  72. package/scripts/bake-ktx2.mjs +477 -0
  73. package/scripts/bake-map-glb.mjs +127 -0
  74. package/scripts/bake-map-rest.d.mts +7 -0
  75. package/scripts/bake-map-rest.mjs +50 -0
  76. package/scripts/bake-maps.mjs +200 -0
  77. package/scripts/bake-navmesh.mjs +259 -0
  78. package/scripts/bake-packs.mjs +129 -0
  79. package/scripts/bake-pickups.mjs +102 -0
  80. package/scripts/bake-query-terrain.mjs +64 -0
  81. package/scripts/bake-recurve-pool.mjs +16 -0
  82. package/scripts/bake-section-schemas.d.mts +3 -0
  83. package/scripts/bake-template-shardfile.mjs +32 -0
  84. package/scripts/bake-textures.mjs +80 -0
  85. package/scripts/bake-viewmodel-sets.json +45 -0
  86. package/scripts/bake-viewmodel-sets.mjs +137 -0
  87. package/scripts/bake-voxel-ao.mjs +119 -0
  88. package/scripts/bake-water-ripples.mjs +25 -0
  89. package/scripts/blender/README.md +129 -0
  90. package/scripts/blender/build.sh +166 -0
  91. package/scripts/blender/lib/export-scene.mjs +129 -0
  92. package/scripts/blender/lib/glb-digest.mjs +188 -0
  93. package/scripts/blender/lib/glb.py +68 -0
  94. package/scripts/blender/lib/save_blend.py +17 -0
  95. package/scripts/blender/lib/world_fixture.py +55 -0
  96. package/scripts/blender/targets.json +591 -0
  97. package/scripts/build-sdk.mjs +95 -0
  98. package/scripts/build-shardfiles.d.mts +7 -0
  99. package/scripts/build-shardfiles.mjs +206 -0
  100. package/scripts/capture-hero.mjs +137 -0
  101. package/scripts/check-lift-review.mjs +23 -0
  102. package/scripts/chromium-keychain-check.mjs +139 -0
  103. package/scripts/chromium-keychain.d.mts +1 -0
  104. package/scripts/chromium-keychain.mjs +5 -0
  105. package/scripts/compile-script.d.mts +3 -0
  106. package/scripts/compile-script.mjs +8 -0
  107. package/scripts/creature-color.mjs +255 -0
  108. package/scripts/decide/calibrate.py +127 -0
  109. package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
  110. package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
  111. package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
  112. package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
  113. package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
  114. package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
  115. package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
  116. package/scripts/decide/decide.py +262 -0
  117. package/scripts/decide/decide.sh +50 -0
  118. package/scripts/decide/layer-purity-pilot.mjs +41 -0
  119. package/scripts/decide/sets/capture-status.json +46 -0
  120. package/scripts/decide/sets/layer-purity.json +28 -0
  121. package/scripts/decide/sets/text-garbled.json +17 -0
  122. package/scripts/decide/test_decide.py +37 -0
  123. package/scripts/docs.mjs +15 -0
  124. package/scripts/entry-reads/crawl.ts +152 -0
  125. package/scripts/entry-reads/tsconfig.json +25 -0
  126. package/scripts/gen-format-schema.d.mts +2 -0
  127. package/scripts/gen-format-schema.mjs +21 -0
  128. package/scripts/gen-host-catalogue.d.mts +14 -0
  129. package/scripts/gen-host-catalogue.mjs +108 -0
  130. package/scripts/gen-shard-layout-doc.d.mts +4 -0
  131. package/scripts/gen-shard-layout-doc.mjs +55 -0
  132. package/scripts/gen-shards.d.mts +17 -0
  133. package/scripts/gen-shards.mjs +311 -0
  134. package/scripts/goldens/capture-inputs.d.mts +4 -0
  135. package/scripts/goldens/capture-inputs.mjs +34 -0
  136. package/scripts/goldens/colour_shift.py +27 -0
  137. package/scripts/goldens/native-residency.d.mts +10 -0
  138. package/scripts/goldens/native-residency.mjs +104 -0
  139. package/scripts/goldens/plot-inputs.d.mts +12 -0
  140. package/scripts/goldens/plot-inputs.mjs +46 -0
  141. package/scripts/gpu-texmem.mjs +98 -0
  142. package/scripts/horizon-matte/config.py +24 -0
  143. package/scripts/horizon-matte/encode.py +91 -0
  144. package/scripts/horizon-matte/key.py +141 -0
  145. package/scripts/horizon-matte/mkjobs.py +33 -0
  146. package/scripts/horizon-matte/mkjobs_day2.py +11 -0
  147. package/scripts/horizon-matte/overlap.py +80 -0
  148. package/scripts/horizon-matte/run_codex.py +57 -0
  149. package/scripts/horizon-matte/stitch.py +133 -0
  150. package/scripts/img2mesh/CC0.md +105 -0
  151. package/scripts/img2mesh/README.md +209 -0
  152. package/scripts/img2mesh/ab_board.py +102 -0
  153. package/scripts/img2mesh/birds/birds.json +255 -0
  154. package/scripts/img2mesh/birds/birds_atlas.py +150 -0
  155. package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
  156. package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
  157. package/scripts/img2mesh/birds/birds_pack.py +110 -0
  158. package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
  159. package/scripts/img2mesh/birds/birds_post.py +550 -0
  160. package/scripts/img2mesh/birds/birds_render.py +125 -0
  161. package/scripts/img2mesh/birds/birds_sheet.py +33 -0
  162. package/scripts/img2mesh/birds/birds_view.py +60 -0
  163. package/scripts/img2mesh/board.py +100 -0
  164. package/scripts/img2mesh/build_cc0.sh +52 -0
  165. package/scripts/img2mesh/build_driftwood.sh +12 -0
  166. package/scripts/img2mesh/build_faces.sh +53 -0
  167. package/scripts/img2mesh/build_props.py +81 -0
  168. package/scripts/img2mesh/cc0_export.py +186 -0
  169. package/scripts/img2mesh/driftwood_post.py +571 -0
  170. package/scripts/img2mesh/e304_faces.sh +67 -0
  171. package/scripts/img2mesh/face_remaster.py +911 -0
  172. package/scripts/img2mesh/face_views.py +95 -0
  173. package/scripts/img2mesh/faces-e304.json +9 -0
  174. package/scripts/img2mesh/faces.json +30 -0
  175. package/scripts/img2mesh/head_cut.py +100 -0
  176. package/scripts/img2mesh/hi3d_paint.py +94 -0
  177. package/scripts/img2mesh/hi3d_refine.py +161 -0
  178. package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
  179. package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
  180. package/scripts/img2mesh/props/coral-arch.json +32 -0
  181. package/scripts/img2mesh/props/ember-furnace.json +30 -0
  182. package/scripts/img2mesh/props/night-market-gate.json +10 -0
  183. package/scripts/img2mesh/render_still.py +86 -0
  184. package/scripts/img2mesh/rig_strip.mjs +46 -0
  185. package/scripts/img2mesh/rig_transfer.mjs +104 -0
  186. package/scripts/img2mesh/split_sheet.py +48 -0
  187. package/scripts/img2mesh/trellis_batch.py +110 -0
  188. package/scripts/img2mesh/versus_board.py +114 -0
  189. package/scripts/import-bundle.d.mts +2 -0
  190. package/scripts/import-bundle.mjs +20 -0
  191. package/scripts/ktx2-ab-board.py +133 -0
  192. package/scripts/ktx2-ab.mjs +111 -0
  193. package/scripts/ktx2-settings.mjs +18 -0
  194. package/scripts/land.d.mts +14 -0
  195. package/scripts/land.mjs +809 -0
  196. package/scripts/lint-dispatch.mjs +14 -0
  197. package/scripts/map-bake-frames.d.mts +4 -0
  198. package/scripts/map-bake-frames.mjs +23 -0
  199. package/scripts/map-geometry.d.mts +9 -0
  200. package/scripts/map-geometry.mjs +29 -0
  201. package/scripts/map-world.mjs +162 -0
  202. package/scripts/mockup-local.sh +46 -0
  203. package/scripts/music/export-midi.mjs +68 -0
  204. package/scripts/music/gen/analyze.py +308 -0
  205. package/scripts/music/gen/audio_jobs.py +46 -0
  206. package/scripts/music/gen/briefs.json +51 -0
  207. package/scripts/music/gen/build_page.py +334 -0
  208. package/scripts/music/gen/folk.json +3187 -0
  209. package/scripts/music/gen/gen_ace_step.py +156 -0
  210. package/scripts/music/gen/gen_heartmula.py +187 -0
  211. package/scripts/music/gen/gen_minimax.py +143 -0
  212. package/scripts/music/gen/gen_sao.py +122 -0
  213. package/scripts/music/gen/gen_sao_small.py +104 -0
  214. package/scripts/music/gen/gen_sfx.py +98 -0
  215. package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
  216. package/scripts/music/gen/gen_sfx_moss.py +112 -0
  217. package/scripts/music/gen/models.json +61 -0
  218. package/scripts/music/gen/nalati-jobs.json +104 -0
  219. package/scripts/music/gen/nalati-score-build.json +119 -0
  220. package/scripts/music/gen/nalati-score.json +3448 -0
  221. package/scripts/music/gen/ob7-fit-decisions.json +38 -0
  222. package/scripts/music/gen/ob7-score-jobs.json +152 -0
  223. package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
  224. package/scripts/music/gen/ob7_build.py +469 -0
  225. package/scripts/music/gen/ob7_generate.py +67 -0
  226. package/scripts/music/gen/ob7_run.sh +42 -0
  227. package/scripts/music/gen/orchestral.json +3187 -0
  228. package/scripts/music/gen/own_score.py +486 -0
  229. package/scripts/music/gen/ph-jobs.json +27 -0
  230. package/scripts/music/gen/ph_page.py +222 -0
  231. package/scripts/music/gen/piano.json +3175 -0
  232. package/scripts/music/gen/rank_v3.py +248 -0
  233. package/scripts/music/gen/sfx-best.json +2486 -0
  234. package/scripts/music/gen/sfx-ezaudio.json +4082 -0
  235. package/scripts/music/gen/sfx-jobs.json +57 -0
  236. package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
  237. package/scripts/music/gen/sfx-minimax.json +289 -0
  238. package/scripts/music/gen/sfx-moss.json +4082 -0
  239. package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
  240. package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
  241. package/scripts/music/gen/sfx-nalati.json +11202 -0
  242. package/scripts/music/gen/sfx-nd-jobs.json +57 -0
  243. package/scripts/music/gen/sfx-nd-moss.json +2097 -0
  244. package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
  245. package/scripts/music/gen/sfx-nd-summary.json +38 -0
  246. package/scripts/music/gen/sfx-peaks.json +7 -0
  247. package/scripts/music/gen/sfx-ph-jobs.json +169 -0
  248. package/scripts/music/gen/sfx-ph-moss.json +6564 -0
  249. package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
  250. package/scripts/music/gen/sfx-ph-summary.json +63 -0
  251. package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
  252. package/scripts/music/gen/sfx-sa3.json +4082 -0
  253. package/scripts/music/gen/sfx-summary.json +107 -0
  254. package/scripts/music/gen/sfx_build.py +332 -0
  255. package/scripts/music/gen/sfx_merge.py +255 -0
  256. package/scripts/music/gen/sfx_minimax.py +61 -0
  257. package/scripts/music/gen/sfx_nalati.py +331 -0
  258. package/scripts/music/gen/sfx_sprite.py +424 -0
  259. package/scripts/music/gen/stems.py +539 -0
  260. package/scripts/music/gen/test_loop_meter.py +29 -0
  261. package/scripts/music/gen/test_ob7_provenance.py +77 -0
  262. package/scripts/music/gen/v3-folk-build.json +148 -0
  263. package/scripts/music/gen/v3-folk.json +1818 -0
  264. package/scripts/music/gen/v3-jobs.json +145 -0
  265. package/scripts/music/gen/v3-orchestral-build.json +148 -0
  266. package/scripts/music/gen/v3-orchestral.json +1813 -0
  267. package/scripts/music/gen/v3-ph-folk-build.json +94 -0
  268. package/scripts/music/gen/v3-ph-folk.json +1806 -0
  269. package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
  270. package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
  271. package/scripts/music/gen/v3-ph-piano-build.json +94 -0
  272. package/scripts/music/gen/v3-ph-piano.json +1818 -0
  273. package/scripts/music/gen/v3-piano-build.json +148 -0
  274. package/scripts/music/gen/v3-piano.json +1813 -0
  275. package/scripts/music/wildshard-theme.mid +0 -0
  276. package/scripts/music/wildshard-trailer30.mid +0 -0
  277. package/scripts/named-blob-output.d.mts +8 -0
  278. package/scripts/named-blob-output.mjs +48 -0
  279. package/scripts/pack-all.mjs +15 -0
  280. package/scripts/pid-lock.d.mts +1 -0
  281. package/scripts/pid-lock.mjs +63 -0
  282. package/scripts/practice/bake_dummy.py +53 -0
  283. package/scripts/practice/build_dummies.sh +43 -0
  284. package/scripts/practice/dummy_parts.py +568 -0
  285. package/scripts/practice/dummy_rig_gate.py +139 -0
  286. package/scripts/practice/gate_sheet.py +36 -0
  287. package/scripts/practice/generate_dummy_unimate.py +132 -0
  288. package/scripts/practice/pack_dummy.mjs +59 -0
  289. package/scripts/practice/repair_dummy_weights.mjs +68 -0
  290. package/scripts/practice/rig_dummy.py +828 -0
  291. package/scripts/practice/verify_unimate_skin.mjs +356 -0
  292. package/scripts/preparation-seed.mjs +15 -0
  293. package/scripts/prepare-basis-tool.mjs +6 -0
  294. package/scripts/prepare-product.d.mts +14 -0
  295. package/scripts/prepare-product.mjs +101 -0
  296. package/scripts/product-build-tools.d.mts +3 -0
  297. package/scripts/product-build-tools.json +3 -0
  298. package/scripts/product-build-tools.mjs +31 -0
  299. package/scripts/publish-public.mjs +7 -0
  300. package/scripts/push-tables.d.mts +1 -0
  301. package/scripts/push-tables.mjs +28 -0
  302. package/scripts/record-shard-mounts.mjs +133 -0
  303. package/scripts/sdk-externals.d.mts +2 -0
  304. package/scripts/sdk-externals.mjs +2 -0
  305. package/scripts/section-inventory.ts +209 -0
  306. package/scripts/select-candidate.mjs +15 -0
  307. package/scripts/shard-build-pool.d.mts +4 -0
  308. package/scripts/shard-build-pool.mjs +53 -0
  309. package/scripts/shard-line-baseline.json +17 -0
  310. package/scripts/shard-milestones.d.mts +15 -0
  311. package/scripts/shard-milestones.mjs +105 -0
  312. package/scripts/shard-output-report.d.mts +9 -0
  313. package/scripts/shard-output-report.mjs +85 -0
  314. package/scripts/shard-platform-cli.mjs +93 -0
  315. package/scripts/shard-progress.mjs +212 -0
  316. package/scripts/shard-timelapse.py +102 -0
  317. package/scripts/shardfile-cold-boot.mjs +79 -0
  318. package/scripts/shardfile-vite.d.mts +4 -0
  319. package/scripts/shardfile-vite.mjs +20 -0
  320. package/scripts/simplify-models.mjs +24 -0
  321. package/scripts/site-facts.mjs +88 -0
  322. package/scripts/test-template-gate.mjs +44 -0
  323. package/scripts/test_golden_compare.py +68 -0
  324. package/scripts/tex-tiers.cache.json +181 -0
  325. package/scripts/tex-tiers.mjs +240 -0
  326. package/scripts/texmem-probe.mjs +184 -0
  327. package/scripts/unused-assets.mjs +173 -0
  328. package/scripts/vite-tmp.d.mts +23 -0
  329. package/scripts/vite-tmp.mjs +157 -0
  330. package/scripts/wave-line-baselines.json +32 -0
  331. package/scripts/wildshard.d.mts +4 -0
  332. package/scripts/wildshard.mjs +105 -0
  333. package/scripts/witness-checkpoints.d.mts +10 -0
  334. package/scripts/witness-checkpoints.mjs +84 -0
  335. package/scripts/witness-generation.d.mts +10 -0
  336. package/scripts/witness-generation.mjs +45 -0
  337. package/scripts/witness-manifests.d.mts +8 -0
  338. package/scripts/witness-manifests.mjs +157 -0
  339. package/scripts/worktree-ignore.d.mts +4 -0
  340. package/scripts/worktree-ignore.mjs +36 -0
  341. package/scripts/worktree-reap.mjs +214 -0
  342. package/scripts/worktree.mjs +396 -0
  343. package/scripts/worldclaw/capture-front.sh +28 -0
  344. package/scripts/worldclaw/design-template.md +62 -0
  345. package/scripts/worldclaw/spec-map.py +92 -0
  346. package/scripts/worldclaw/spec.ts +96 -0
  347. package/skills/wildshard/SKILL.md +50 -0
  348. package/skills/wildshard-goldens/SKILL.md +54 -0
  349. package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
  350. package/skills/wildshard-upgrade/SKILL.md +46 -0
  351. package/src/.oxfmtrc.json +50 -0
  352. package/src/.oxlintrc.json +173 -0
  353. package/src/cli/account/account.ts +199 -0
  354. package/src/cli/account/command.ts +193 -0
  355. package/src/cli/account/key.ts +154 -0
  356. package/src/cli/args.ts +97 -0
  357. package/src/cli/audio/audio.ts +24 -0
  358. package/src/cli/bin.mjs +8 -0
  359. package/src/cli/delete/delete.ts +258 -0
  360. package/src/cli/help.ts +196 -0
  361. package/src/cli/hero/adopt.ts +103 -0
  362. package/src/cli/hero/hero.ts +112 -0
  363. package/src/cli/hero/stamp.ts +298 -0
  364. package/src/cli/main.ts +292 -0
  365. package/src/cli/report.ts +16 -0
  366. package/src/cli/shardfile/command.ts +50 -0
  367. package/src/cli/shardfile/shardfile.ts +192 -0
  368. package/src/cli/upload/api.ts +246 -0
  369. package/src/cli/upload/compress.ts +55 -0
  370. package/src/cli/upload/hero.ts +62 -0
  371. package/src/cli/upload/placement.ts +115 -0
  372. package/src/cli/upload/provenance.ts +192 -0
  373. package/src/cli/upload/signature.ts +30 -0
  374. package/src/cli/upload/upload.ts +269 -0
  375. package/src/cli/upload/validate.ts +74 -0
  376. package/src/cli/upload/wire.ts +147 -0
  377. package/src/cli/version.ts +63 -0
  378. package/src/commons/bake/portableMath.ts +187 -0
  379. package/src/commons/catalogue.ts +10 -0
  380. package/src/commons/courseProgram.ts +32 -0
  381. package/src/commons/practiceCourse.ts +16 -0
  382. package/src/commons/scripts/abi.as +14 -0
  383. package/src/commons/scripts/bridge.as +14 -0
  384. package/src/commons/scripts/course.as +63 -0
  385. package/src/scripts/ask-new.sh +29 -0
  386. package/src/scripts/asks.mjs +141 -0
  387. package/src/scripts/herdr-prompt.sh +34 -0
  388. package/src/scripts/herdr-question-open.sh +67 -0
  389. package/src/scripts/md-wrap.mjs +229 -0
  390. package/src/server/app.ts +19 -0
  391. package/src/server/serve.ts +49 -0
  392. package/src/sharddev/admission.ts +7 -0
  393. package/src/sharddev/arenaView.ts +15 -0
  394. package/src/sharddev/as/groupBankV2.ts +36 -0
  395. package/src/sharddev/as/groupStepV2.ts +13 -0
  396. package/src/sharddev/as/ws.ts +30 -0
  397. package/src/sharddev/as/wsV2.ts +180 -0
  398. package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
  399. package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
  400. package/src/sharddev/assetHandle.ts +84 -0
  401. package/src/sharddev/assetOwner.ts +70 -0
  402. package/src/sharddev/assetScope.ts +30 -0
  403. package/src/sharddev/assets.ts +21 -0
  404. package/src/sharddev/audio.ts +9 -0
  405. package/src/sharddev/audioEncode.ts +211 -0
  406. package/src/sharddev/author.ts +3 -0
  407. package/src/sharddev/authorError.ts +28 -0
  408. package/src/sharddev/authorManifest.ts +39 -0
  409. package/src/sharddev/bake/annulus.ts +19 -0
  410. package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
  411. package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
  412. package/src/sharddev/bake/authoredWorld.ts +201 -0
  413. package/src/sharddev/bake/basisEncoder.ts +95 -0
  414. package/src/sharddev/bake/basisGlb.ts +85 -0
  415. package/src/sharddev/bake/basisTool.ts +74 -0
  416. package/src/sharddev/bake/basisToolInputs.ts +476 -0
  417. package/src/sharddev/bake/byteCodec.ts +33 -0
  418. package/src/sharddev/bake/canvasAtlas.ts +406 -0
  419. package/src/sharddev/bake/coarseCopy.ts +59 -0
  420. package/src/sharddev/bake/colliders.ts +87 -0
  421. package/src/sharddev/bake/compactGlb.ts +224 -0
  422. package/src/sharddev/bake/compileScript.ts +119 -0
  423. package/src/sharddev/bake/compileScriptV2.ts +75 -0
  424. package/src/sharddev/bake/contactRows.ts +84 -0
  425. package/src/sharddev/bake/creaturePlacement.ts +117 -0
  426. package/src/sharddev/bake/export.ts +67 -0
  427. package/src/sharddev/bake/facetedGeometry.ts +379 -0
  428. package/src/sharddev/bake/farImpostor.ts +120 -0
  429. package/src/sharddev/bake/forest.ts +100 -0
  430. package/src/sharddev/bake/format-hook.mjs +2 -0
  431. package/src/sharddev/bake/generatorGlb.ts +23 -0
  432. package/src/sharddev/bake/geometryBounds.ts +77 -0
  433. package/src/sharddev/bake/geometryError.ts +48 -0
  434. package/src/sharddev/bake/glb.ts +355 -0
  435. package/src/sharddev/bake/glbCompression.ts +143 -0
  436. package/src/sharddev/bake/gltfSource.ts +59 -0
  437. package/src/sharddev/bake/groundMap.ts +142 -0
  438. package/src/sharddev/bake/image.ts +20 -0
  439. package/src/sharddev/bake/isleMap.ts +64 -0
  440. package/src/sharddev/bake/json.mjs +84 -0
  441. package/src/sharddev/bake/keyedSky.ts +47 -0
  442. package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
  443. package/src/sharddev/bake/kinds.ts +137 -0
  444. package/src/sharddev/bake/lightSources.ts +31 -0
  445. package/src/sharddev/bake/mapAssembly.ts +84 -0
  446. package/src/sharddev/bake/mapRaster.ts +173 -0
  447. package/src/sharddev/bake/mapRest.ts +57 -0
  448. package/src/sharddev/bake/mapScenes.ts +234 -0
  449. package/src/sharddev/bake/materialGraph.ts +32 -0
  450. package/src/sharddev/bake/meadow.ts +27 -0
  451. package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
  452. package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
  453. package/src/sharddev/bake/nativeLattice.ts +178 -0
  454. package/src/sharddev/bake/nativeRaster.ts +106 -0
  455. package/src/sharddev/bake/nativeTerrainField.ts +11 -0
  456. package/src/sharddev/bake/navigation-json.mjs +38 -0
  457. package/src/sharddev/bake/navigation.ts +113 -0
  458. package/src/sharddev/bake/navigationAsset.ts +18 -0
  459. package/src/sharddev/bake/nearPlaceholder.ts +206 -0
  460. package/src/sharddev/bake/normalizeRig.ts +80 -0
  461. package/src/sharddev/bake/phoneAstc.ts +93 -0
  462. package/src/sharddev/bake/placeholders.ts +581 -0
  463. package/src/sharddev/bake/placement.ts +80 -0
  464. package/src/sharddev/bake/portableBytes.ts +18 -0
  465. package/src/sharddev/bake/portableBytesMemo.ts +50 -0
  466. package/src/sharddev/bake/practiceCourse.ts +49 -0
  467. package/src/sharddev/bake/primitives.ts +96 -0
  468. package/src/sharddev/bake/props.ts +443 -0
  469. package/src/sharddev/bake/questPlacement.ts +98 -0
  470. package/src/sharddev/bake/rawTexture.ts +26 -0
  471. package/src/sharddev/bake/riderArms.ts +97 -0
  472. package/src/sharddev/bake/rig.ts +95 -0
  473. package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
  474. package/src/sharddev/bake/signPlacements.ts +25 -0
  475. package/src/sharddev/bake/simplifier.ts +52 -0
  476. package/src/sharddev/bake/skinned.ts +312 -0
  477. package/src/sharddev/bake/slabChunks.ts +149 -0
  478. package/src/sharddev/bake/slabs.ts +263 -0
  479. package/src/sharddev/bake/source-loader.mjs +55 -0
  480. package/src/sharddev/bake/sourceMetadata.ts +54 -0
  481. package/src/sharddev/bake/species.ts +368 -0
  482. package/src/sharddev/bake/specimenCatalogue.ts +47 -0
  483. package/src/sharddev/bake/splatGround.ts +141 -0
  484. package/src/sharddev/bake/staticMaterials.ts +171 -0
  485. package/src/sharddev/bake/terrain.ts +195 -0
  486. package/src/sharddev/bake/texture.ts +33 -0
  487. package/src/sharddev/bake/textureWasm.ts +81 -0
  488. package/src/sharddev/bake/tileEncoder.ts +11 -0
  489. package/src/sharddev/bake/tileGrid.ts +62 -0
  490. package/src/sharddev/bake/v2Finite.ts +160 -0
  491. package/src/sharddev/bake/v2Fuel.ts +71 -0
  492. package/src/sharddev/bake/wholePartition.ts +74 -0
  493. package/src/sharddev/bake/wholePieceJoin.ts +147 -0
  494. package/src/sharddev/bake/world.ts +173 -0
  495. package/src/sharddev/bake/worldCollision.ts +128 -0
  496. package/src/sharddev/bake/worldGeometry.ts +237 -0
  497. package/src/sharddev/bake/worldGlb.ts +123 -0
  498. package/src/sharddev/bake/worldImage.ts +12 -0
  499. package/src/sharddev/bake/worldLod.ts +128 -0
  500. package/src/sharddev/bake/worldRows.ts +102 -0
  501. package/src/sharddev/bake/worldTextureMemo.ts +63 -0
  502. package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
  503. package/src/sharddev/bake.ts +193 -0
  504. package/src/sharddev/bakePublication.ts +31 -0
  505. package/src/sharddev/behaviourSource.ts +94 -0
  506. package/src/sharddev/bin/wildshard.mjs +7 -0
  507. package/src/sharddev/blobBytes.ts +65 -0
  508. package/src/sharddev/blobs.ts +138 -0
  509. package/src/sharddev/bootInventory.ts +129 -0
  510. package/src/sharddev/bossProfiles.ts +18 -0
  511. package/src/sharddev/buildBehaviour.ts +77 -0
  512. package/src/sharddev/buildCacheMetrics.ts +17 -0
  513. package/src/sharddev/buildDecisionScripts.ts +122 -0
  514. package/src/sharddev/check.ts +117 -0
  515. package/src/sharddev/checkProject.ts +126 -0
  516. package/src/sharddev/cli.ts +191 -0
  517. package/src/sharddev/clientChannels.ts +169 -0
  518. package/src/sharddev/clientScripts.ts +10 -0
  519. package/src/sharddev/commons.ts +77 -0
  520. package/src/sharddev/commonsCosts.ts +11 -0
  521. package/src/sharddev/compileMovers.ts +11 -0
  522. package/src/sharddev/configBoundary.ts +6 -0
  523. package/src/sharddev/cookInput.ts +40 -0
  524. package/src/sharddev/crowds.ts +6 -0
  525. package/src/sharddev/decisionBindingMap.ts +11 -0
  526. package/src/sharddev/decisionScriptBindings.ts +117 -0
  527. package/src/sharddev/decisionScripts.ts +28 -0
  528. package/src/sharddev/decisionSource.ts +51 -0
  529. package/src/sharddev/dev.ts +113 -0
  530. package/src/sharddev/director.ts +26 -0
  531. package/src/sharddev/directorAbi.ts +77 -0
  532. package/src/sharddev/discoveryDocument.ts +97 -0
  533. package/src/sharddev/draft.ts +11 -0
  534. package/src/sharddev/eliteEntryRows.ts +29 -0
  535. package/src/sharddev/entries.ts +76 -0
  536. package/src/sharddev/entryReads.ts +73 -0
  537. package/src/sharddev/executeBundle.ts +55 -0
  538. package/src/sharddev/finds.ts +5 -0
  539. package/src/sharddev/formatJsonSchema.ts +3 -0
  540. package/src/sharddev/generationCache.ts +257 -0
  541. package/src/sharddev/generationRecipe.ts +94 -0
  542. package/src/sharddev/handwritten.ts +110 -0
  543. package/src/sharddev/immutable.ts +14 -0
  544. package/src/sharddev/interactions.ts +38 -0
  545. package/src/sharddev/kit/bakedGeometry.ts +16 -0
  546. package/src/sharddev/kit/geometryPack.ts +110 -0
  547. package/src/sharddev/ledger.ts +13 -0
  548. package/src/sharddev/looks/tileField.ts +67 -0
  549. package/src/sharddev/materialGraphFiles.ts +57 -0
  550. package/src/sharddev/materials.ts +574 -0
  551. package/src/sharddev/measure.ts +18 -0
  552. package/src/sharddev/modes.ts +115 -0
  553. package/src/sharddev/moverPrograms.ts +213 -0
  554. package/src/sharddev/movers.ts +75 -0
  555. package/src/sharddev/nativePopulationRows.ts +46 -0
  556. package/src/sharddev/newProject.ts +247 -0
  557. package/src/sharddev/noise.ts +54 -0
  558. package/src/sharddev/outputProduct.ts +188 -0
  559. package/src/sharddev/outputRuntime.ts +66 -0
  560. package/src/sharddev/performancePolicy.ts +18 -0
  561. package/src/sharddev/phasedBoss.ts +34 -0
  562. package/src/sharddev/physics.ts +194 -0
  563. package/src/sharddev/platformSections.ts +42 -0
  564. package/src/sharddev/plumbing.ts +8 -0
  565. package/src/sharddev/productOutput.ts +128 -0
  566. package/src/sharddev/project.ts +337 -0
  567. package/src/sharddev/projectCompilerIdentity.ts +94 -0
  568. package/src/sharddev/projectDecisions.ts +66 -0
  569. package/src/sharddev/projectEntryProof.ts +32 -0
  570. package/src/sharddev/projectGeneration.ts +219 -0
  571. package/src/sharddev/projectInputFiles.ts +47 -0
  572. package/src/sharddev/projectManifest.ts +108 -0
  573. package/src/sharddev/projectMap.ts +35 -0
  574. package/src/sharddev/projectOutput.ts +242 -0
  575. package/src/sharddev/projectPolicy.ts +17 -0
  576. package/src/sharddev/projectSections.ts +27 -0
  577. package/src/sharddev/questGraph.ts +25 -0
  578. package/src/sharddev/quests.ts +65 -0
  579. package/src/sharddev/random.ts +61 -0
  580. package/src/sharddev/refusals.ts +234 -0
  581. package/src/sharddev/reportCard.ts +13 -0
  582. package/src/sharddev/returnProjectionV2.ts +81 -0
  583. package/src/sharddev/rows.ts +192 -0
  584. package/src/sharddev/runtimeImports.ts +38 -0
  585. package/src/sharddev/runtimeMirrors.ts +39 -0
  586. package/src/sharddev/runtimePerformance.ts +38 -0
  587. package/src/sharddev/scene.ts +321 -0
  588. package/src/sharddev/sceneAnimation.ts +54 -0
  589. package/src/sharddev/sceneAudio.ts +64 -0
  590. package/src/sharddev/sceneDeclarations.ts +100 -0
  591. package/src/sharddev/sceneGraph.ts +139 -0
  592. package/src/sharddev/sceneTransform.ts +12 -0
  593. package/src/sharddev/schemaValidation.ts +61 -0
  594. package/src/sharddev/sections.ts +47 -0
  595. package/src/sharddev/shardSource.ts +59 -0
  596. package/src/sharddev/sourceReader.ts +26 -0
  597. package/src/sharddev/spawns.ts +38 -0
  598. package/src/sharddev/species/clips.ts +24 -0
  599. package/src/sharddev/species.ts +29 -0
  600. package/src/sharddev/speciesBrains.ts +19 -0
  601. package/src/sharddev/synth.ts +66 -0
  602. package/src/sharddev/test/compileDualScriptV2.ts +71 -0
  603. package/src/sharddev/test/compileSimV2.ts +21 -0
  604. package/src/sharddev/test/diskScriptScenario.ts +86 -0
  605. package/src/sharddev/test/scriptScenario.ts +249 -0
  606. package/src/sharddev/test/scriptSource.ts +12 -0
  607. package/src/sharddev/version.ts +4 -0
  608. package/src/sharddev/weapons/bowProfile.ts +20 -0
  609. package/src/sharddev/weapons/firearmRows.ts +11 -0
  610. package/src/sharddev/weapons/meleeProfile.ts +71 -0
  611. package/src/sharddev/weapons/thrownProfile.ts +10 -0
  612. package/src/sharddev/worldScenes.ts +308 -0
  613. package/src/sharddev/worldSource.ts +82 -0
  614. package/src/shards/_template/README.md +78 -0
  615. package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
  616. package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
  617. package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
  618. package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
  619. package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
  620. package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
  621. package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
  622. package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
  623. package/src/shards/_template/behaviour/boss.as +39 -0
  624. package/src/shards/_template/behaviour/door.as +32 -0
  625. package/src/shards/_template/behaviour/hooks.json +129 -0
  626. package/src/shards/_template/behaviour/idle.as +75 -0
  627. package/src/shards/_template/behaviour/items.as +22 -0
  628. package/src/shards/_template/card/landscape.jpg +0 -0
  629. package/src/shards/_template/card/portrait.jpg +0 -0
  630. package/src/shards/_template/card/thumb.jpg +0 -0
  631. package/src/shards/_template/data/audio.json +45 -0
  632. package/src/shards/_template/data/bossDecision.json +83 -0
  633. package/src/shards/_template/data/budgets.json +70 -0
  634. package/src/shards/_template/data/card.json +281 -0
  635. package/src/shards/_template/data/clientScripts.json +987 -0
  636. package/src/shards/_template/data/creatures.json +65 -0
  637. package/src/shards/_template/data/director.json +39 -0
  638. package/src/shards/_template/data/encounters.json +96 -0
  639. package/src/shards/_template/data/items.json +172 -0
  640. package/src/shards/_template/data/layout.json +66 -0
  641. package/src/shards/_template/data/ledger.json +32 -0
  642. package/src/shards/_template/data/look.json +521 -0
  643. package/src/shards/_template/data/map.json +64 -0
  644. package/src/shards/_template/data/moves.json +16 -0
  645. package/src/shards/_template/data/placeholder.json +8 -0
  646. package/src/shards/_template/data/plumbing.json +32 -0
  647. package/src/shards/_template/data/quests.json +223 -0
  648. package/src/shards/_template/data/rows.json +423 -0
  649. package/src/shards/_template/data/skins.json +66 -0
  650. package/src/shards/_template/data/spawn.json +6 -0
  651. package/src/shards/_template/data/targets.json +150 -0
  652. package/src/shards/_template/data/text.json +12 -0
  653. package/src/shards/_template/data/ui.json +33 -0
  654. package/src/shards/_template/data/water.json +13 -0
  655. package/src/shards/_template/generators/behaviour.ts +34 -0
  656. package/src/shards/_template/generators/boss.ts +29 -0
  657. package/src/shards/_template/generators/buildOptions.ts +2 -0
  658. package/src/shards/_template/generators/cell.ts +224 -0
  659. package/src/shards/_template/generators/districts.ts +215 -0
  660. package/src/shards/_template/generators/farLook.ts +15 -0
  661. package/src/shards/_template/generators/generate.ts +27 -0
  662. package/src/shards/_template/generators/ground.ts +15 -0
  663. package/src/shards/_template/generators/kit.ts +69 -0
  664. package/src/shards/_template/generators/landscape.ts +59 -0
  665. package/src/shards/_template/generators/landscapeNoise.ts +62 -0
  666. package/src/shards/_template/generators/mapInputs.ts +10 -0
  667. package/src/shards/_template/generators/product.ts +100 -0
  668. package/src/shards/_template/generators/productOutput.ts +18 -0
  669. package/src/shards/_template/generators/props.ts +9 -0
  670. package/src/shards/_template/generators/templatePropsSource.ts +58 -0
  671. package/src/shards/_template/generators/terrain.ts +17 -0
  672. package/src/shards/_template/generators/world.ts +630 -0
  673. package/src/shards/_template/hero.json +10 -0
  674. package/src/shards/_template/look/entry-reads.json +20 -0
  675. package/src/shards/_template/manifest.json +281 -0
  676. package/src/shards/_template/shard.config.ts +10 -0
  677. package/src/shared/health.ts +10 -0
  678. package/src/tools/build-web.ts +59 -0
  679. package/src/tsconfig.json +30 -0
  680. package/src/web/app.tsx +53 -0
  681. package/src/web/index.html +12 -0
  682. package/src/web/main.tsx +10 -0
  683. package/src/web/tsconfig.json +13 -0
  684. package/tsconfig.author.json +23 -0
  685. package/tsconfig.commons.json +21 -0
  686. package/tsconfig.json +47 -0
  687. package/tsconfig.sharddev.json +20 -0
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env python3
2
+ """stitch.py [--shard <slug> | --config <json>] <pattern-with-{d}> <out.png> [--seams seams.npy] [--save-seams seams.npy]
3
+
4
+ Projects the shard's perspective segments (its capture: headings t, dir = (cos t, 0, sin t), pitch 0, vfov, frame size;
5
+ Driftwood: six 1536x1024 at t = 0,60..300, vfov 72) into one cylindrical strip W x H (u = azimuth, rows linear in
6
+ elevation EL_MAX..EL_MIN), joins neighbours along a min-cost vertical seam inside their overlap and feathers it.
7
+ Seamless at the 0/360 wrap by construction (the wrap is the middle of segment 0). Parameters:
8
+ src/shards/<shard>/art/horizon-matte.json (capture, strip, stitch).
9
+ """
10
+ import argparse
11
+ import numpy as np
12
+ from PIL import Image
13
+
14
+ import config
15
+
16
+ ap = config.add_args(argparse.ArgumentParser(description='stitch a shard\'s horizon segments into one strip'))
17
+ ap.add_argument('pattern', help='segment paths with {d} = the heading in degrees')
18
+ ap.add_argument('out')
19
+ ap.add_argument('--seams', default=None, help='reuse these seams (the night strip on the day seams)')
20
+ ap.add_argument('--save-seams', default=None)
21
+ ARGS = ap.parse_args()
22
+ CFG = config.load(ARGS)
23
+ W, H = CFG['strip']['width'], CFG['strip']['height']
24
+ EL_MIN, EL_MAX = CFG['strip']['elMin'], CFG['strip']['elMax']
25
+ HEADS = CFG['capture']['headings']
26
+ VFOV = CFG['capture']['vfov']
27
+ IW, IH = CFG['capture']['width'], CFG['capture']['height']
28
+ TV = np.tan(np.radians(VFOV / 2)); TH = TV * IW / IH
29
+ FEATHER = CFG['stitch']['feather'] # px each side
30
+ FEATHER_SKY = CFG['stitch']['featherSky'] # px each side in the open sky
31
+ SEAM_WIN = CFG['stitch']['seamWindow'] # deg each side of a boundary
32
+ HALF = 360 / len(HEADS) / 2 # each segment owns +-HALF deg around its heading
33
+
34
+
35
+ def bilinear(img, x, y):
36
+ h, w, c = img.shape
37
+ x = np.clip(x, 0, w - 1.001); y = np.clip(y, 0, h - 1.001)
38
+ x0 = np.floor(x).astype(int); y0 = np.floor(y).astype(int)
39
+ fx = (x - x0)[..., None]; fy = (y - y0)[..., None]
40
+ a = img[y0, x0]; b = img[y0, x0 + 1]; c_ = img[y0 + 1, x0]; d = img[y0 + 1, x0 + 1]
41
+ return (a * (1 - fx) + b * fx) * (1 - fy) + (c_ * (1 - fx) + d * fx) * fy
42
+
43
+
44
+ def project(img, head_deg):
45
+ th = (np.arange(W) + 0.5) / W * 2 * np.pi
46
+ ph = np.radians(EL_MAX - (EL_MAX - EL_MIN) * (np.arange(H) + 0.5) / H)
47
+ TH_, PH = np.meshgrid(th, ph)
48
+ rel = TH_ - np.radians(head_deg)
49
+ xc = np.cos(PH) * np.sin(rel); zc = np.cos(PH) * np.cos(rel); yc = np.sin(PH)
50
+ ok = zc > 0.05
51
+ zs = np.where(ok, zc, 1)
52
+ px = IW / 2 + (xc / zs) / TH * IW / 2 - 0.5
53
+ py = IH / 2 - (yc / zs) / TV * IH / 2 - 0.5
54
+ ok &= (px >= 0) & (px <= IW - 1) & (py >= 0) & (py <= IH - 1)
55
+ out = bilinear(img, px, py)
56
+ return out, ok
57
+
58
+
59
+ def seam_path(cost):
60
+ """min-cost top-to-bottom path through cost[h, w], steps of -1/0/+1 per row"""
61
+ h, w = cost.shape
62
+ acc = cost.copy(); back = np.zeros((h, w), int)
63
+ for r in range(1, h):
64
+ prev = acc[r - 1]
65
+ cand = np.stack([np.r_[np.inf, prev[:-1]], prev, np.r_[prev[1:], np.inf]])
66
+ k = np.argmin(cand, axis=0)
67
+ acc[r] += cand[k, np.arange(w)]
68
+ back[r] = k - 1
69
+ path = np.zeros(h, int); path[-1] = int(np.argmin(acc[-1]))
70
+ for r in range(h - 1, 0, -1):
71
+ path[r - 1] = path[r] + back[r, path[r]]
72
+ return path
73
+
74
+
75
+ def main():
76
+ pat, out = ARGS.pattern, ARGS.out
77
+ load_seams, save_seams = ARGS.seams, ARGS.save_seams
78
+ layers, masks = [], []
79
+ for d in HEADS:
80
+ img = np.asarray(Image.open(pat.format(d=d)).convert('RGB').resize((IW, IH), Image.LANCZOS), dtype=np.float32) / 255
81
+ l, m = project(img, d)
82
+ layers.append(l); masks.append(m)
83
+ # ownership: segment k owns [t_k - HALF, t_k + HALF]; each boundary b_k at t_k + HALF is replaced by a seam in a
84
+ # +-SEAM_WIN deg window (Driftwood: 30, 11)
85
+ xs = np.arange(W)
86
+ own = np.zeros((H, W), int)
87
+ colt = (xs + 0.5) / W * 360
88
+ for k, d in enumerate(HEADS):
89
+ rel = (colt - d + 180) % 360 - 180
90
+ own[:, np.abs(rel) <= HALF] = k
91
+ seams = np.load(load_seams) if load_seams else np.zeros((len(HEADS), H), int)
92
+ win = int(SEAM_WIN / 360 * W)
93
+ for k, d in enumerate(HEADS):
94
+ k2 = (k + 1) % len(HEADS)
95
+ bx = int(round((d + HALF) / 360 * W))
96
+ cols = (np.arange(bx - win, bx + win)) % W
97
+ if not load_seams:
98
+ A = layers[k][:, cols]; B = layers[k2][:, cols]
99
+ cost = np.abs(A - B).sum(-1)
100
+ cost += 0.02 # prefer straight-ish
101
+ ok = masks[k][:, cols] & masks[k2][:, cols]
102
+ cost[~ok] = 1e3
103
+ seams[k] = seam_path(cost)
104
+ path = seams[k]
105
+ for r in range(H):
106
+ c = path[r]
107
+ own[r, cols[:c]] = k
108
+ own[r, cols[c:]] = k2
109
+ if save_seams: np.save(save_seams, seams)
110
+ # feathered blend: per-layer weight = box-blurred ownership indicator (horizontal, wraps)
111
+ res = np.zeros((H, W, 3), np.float32); wsum = np.zeros((H, W, 1), np.float32)
112
+ # feather per row: wide in the open sky high up (hides the segments' sky-tone steps), narrow where the content is
113
+ el = EL_MAX - (EL_MAX - EL_MIN) * (np.arange(H) + 0.5) / H
114
+ SKY_FROM = CFG['stitch'].get('featherSkyFrom', 7) # deg where the wide sky feather starts (over the tallest content; Driftwood 7)
115
+ rad = np.round(FEATHER + (FEATHER_SKY - FEATHER) * np.clip((el - SKY_FROM) / 6, 0, 1)).astype(int)
116
+ PADN = 160
117
+ for k in range(len(HEADS)):
118
+ ind = (own == k).astype(np.float32)
119
+ pad = np.concatenate([ind[:, -PADN:], ind, ind[:, :PADN]], 1)
120
+ cs = np.cumsum(np.pad(pad, ((0, 0), (1, 0))), axis=1)
121
+ wgt = np.zeros((H, W), np.float32)
122
+ for r in range(H):
123
+ f = rad[r]; i0 = np.arange(W) + PADN - f; i1 = np.arange(W) + PADN + f + 1
124
+ wgt[r] = (cs[r, i1] - cs[r, i0]) / (2 * f + 1)
125
+ wgt *= masks[k]
126
+ res += layers[k] * wgt[..., None]; wsum += wgt[..., None]
127
+ res /= np.maximum(wsum, 1e-6)
128
+ Image.fromarray((np.clip(res, 0, 1) * 255 + 0.5).astype(np.uint8)).save(out)
129
+ print('wrote', out)
130
+
131
+
132
+ if __name__ == '__main__':
133
+ main()
@@ -0,0 +1,105 @@
1
+ # CC0 model library (outside the repo)
2
+
3
+ A local library of CC0 (public domain) low-poly models for Driftwood Isle, downloaded 2026-09-23 into
4
+ `~/models/cc0/<author>/<pack>/`. Nothing here is in git. It is about 791 MB on disk: 304 MB of original
5
+ zips kept in `*/_zips/` and about 487 MB unpacked, with 968 `.glb`/`.gltf` files. Every pack below is
6
+ CC0. The licence was checked in the pack's own `License.txt`, or on its official page where the pack
7
+ ships without one. Helper scripts and raw search results are in `~/models/cc0/_tools/`.
8
+
9
+ Texture note: Kenney Pirate, Survival and Watercraft GLBs load `Textures/colormap.png` from the folder
10
+ next to them. The Quaternius Stylized Nature and Fantasy Props `.gltf` files and the KayKit `.gltf` files
11
+ load `.bin` and `.png` files from their own folder. Keep each folder whole when you copy a model out.
12
+ Kenney Nature Kit GLBs, Quaternius Pirate Kit `.gltf` files (buffers and atlas embedded) and all
13
+ Poly Pizza GLBs are self-contained.
14
+
15
+ ## Kenney (kenney.nl)
16
+
17
+ | Pack | Licence | Source | Local path | Format | Models | Fits Driftwood |
18
+ |---|---|---|---|---|---|---|
19
+ | Pirate Kit | CC0, `kenney/pirate-kit/License.txt` | https://kenney.nl/assets/pirate-kit | `~/models/cc0/kenney/pirate-kit/Models/GLB format/` | GLB, FBX, OBJ | 72 | palm-straight, palm-bend, palm-detailed-straight, palm-detailed-bend, rocks-a/b/c, rocks-sand-a/b/c, patch-sand, boat-row-small/large, ship-wreck, ship-small/medium, structure-platform-dock(-small), platform-planks, barrel, crate, crate-bottles, chest, bottle, mast-ropes, tool-paddle, tool-shovel, cannon |
20
+ | Nature Kit | CC0, `kenney/nature-kit/License.txt` | https://kenney.nl/assets/nature-kit | `~/models/cc0/kenney/nature-kit/Models/GLTF format/` (these are `.glb`) | GLB, FBX, OBJ, DAE, STL | 329 | tree_palm, tree_palmBend, tree_palmTall, tree_palmShort, tree_palmDetailedShort/Tall, rock_largeA–F, rock_tallA–J, rock_smallA–I, stone_tallA–J (monoliths), stone_largeA–F, cliff_*_rock / cliff_*_stone, log, log_large, log_stack, stump_old, canoe, canoe_paddle, bridge_wood, path_wood, campfire_stones, campfire_logs |
21
+ | Survival Kit | CC0, `kenney/survival-kit/License.txt` | https://kenney.nl/assets/survival-kit | `~/models/cc0/kenney/survival-kit/Models/GLB format/` | GLB, FBX, OBJ | 80 | rock-sand-a/b/c, rock-flat, tree-log, tree-log-small, resource-wood, resource-planks, campfire-pit, campfire-fishing-stand, fish, fish-large, bucket, barrel, barrel-open, box, box-large, chest, tent, signpost, fence |
22
+ | Watercraft Pack | CC0, `kenney/watercraft-pack/License.txt` | https://kenney.nl/assets/watercraft-kit | `~/models/cc0/kenney/watercraft-pack/Models/GLB format/` | GLB, FBX, OBJ | 46 | boat-row-small, boat-row-large, boat-sail-a, boat-sail-b, boat-fishing-small, buoy, buoy-flag, cargo-pile-a/b |
23
+
24
+ ## Quaternius (quaternius.com)
25
+
26
+ | Pack | Licence | Source | Local path | Format | Models | Fits Driftwood |
27
+ |---|---|---|---|---|---|---|
28
+ | Pirate Kit | CC0. The Drive folder has no licence file, so this comes from the pack page's licence field (link to creativecommons.org/publicdomain/zero/1.0) | https://quaternius.com/packs/piratekit.html → Google Drive folder `1KjMzhVsDcyvYMWeVjZcRfuu8auBLpNi2`, glTF subfolder | `~/models/cc0/quaternius/pirate-kit/glTF/` | glTF (embedded buffers and atlas) | 72 | Environment_PalmTree_1/2/3, Environment_Rock_1–5, Environment_Cliff1–4, Environment_Dock, Environment_Dock_Broken, Environment_Dock_Pole, Environment_LargeBones (whale ribs), Environment_Skulls, Ship_Small, Ship_Large, Prop_Barrel, Prop_Chest_Closed, Prop_Chest_Gold, Prop_Anchor, Prop_Bucket_Fishes, Prop_Bottle_1/2, Prop_Cannon. Environment_House1–3 are ship-hull taverns, not huts |
29
+ | Ultimate Nature Pack | CC0, `quaternius/ultimate-nature-pack/License.txt` | https://quaternius.itch.io/150-lowpoly-nature-models | `~/models/cc0/quaternius/ultimate-nature-pack/{FBX,OBJ,Blends}/` | FBX, OBJ, .blend (no glTF) | 150 | PalmTree_1–4, Rock_1–7, WoodLog, TreeStump, Plant_1–5, Bush_1/2, Grass |
30
+ | Stylized Nature MegaKit (free Standard) | CC0, `quaternius/stylized-nature-megakit/License_Standard.txt` | https://quaternius.itch.io/stylized-nature-megakit | `~/models/cc0/quaternius/stylized-nature-megakit/glTF/` | glTF + bin + textures, FBX, OBJ | 68 | Rock_Medium_1–3, Pebble_Round_1–5, Pebble_Square_1–6, RockPath_*, DeadTree_1–5 (driftwood shapes), Fern_1, Plant_1/7(_Big), Grass_Wispy_*. There are no palms |
31
+ | Fantasy Props MegaKit (free Standard) | CC0, `quaternius/fantasy-props-megakit/License_Standard.txt` | https://quaternius.itch.io/fantasy-props-megakit | `~/models/cc0/quaternius/fantasy-props-megakit/Exports/glTF/` | glTF + bin + PBR textures, FBX, OBJ | 94 | Barrel, Barrel_Holder, Crate_Wooden, Chest_Wood, Rope_1/2/3, Chain_Coil, Bucket_Wooden_1, Lantern_Wall, Coin_Pile, Stall_Empty, Bench, Stool |
32
+
33
+ ## KayKit (Kay Lousberg)
34
+
35
+ | Pack | Licence | Source | Local path | Format | Models | Fits Driftwood |
36
+ |---|---|---|---|---|---|---|
37
+ | Forest Nature Pack 1.0 (FREE) | CC0, `kaykit/forest-nature-pack/KayKit_Forest_Nature_Pack_1.0_FREE/License.txt` | https://kaylousberg.itch.io/kaykit-forest | `~/models/cc0/kaykit/forest-nature-pack/KayKit_Forest_Nature_Pack_1.0_FREE/Assets/gltf/` | glTF + bin + one shared texture, FBX, OBJ | 105 | Rock_1_A–Q, Rock_2_A–H, Rock_3_A–R (beach and cliff rocks), Tree_Bare_1/2_A–C (driftwood silhouettes), Bush_1–4, Grass_1/2. The trees are not palms |
38
+
39
+ ## Poly Pizza singles (poly.pizza, CC0 only)
40
+
41
+ - **Licence:** CC0 1.0 for every file. This is Poly Pizza's per-model `licence` field. The search used the site's CC0 filter (`/api/search/<q>?lic=1`), and one page was spot-checked (`/m/A6cKJYFsIb` → "CC0 1.0").
42
+ - **Local path and format:** `~/models/cc0/poly-pizza/<category>/<Creator>-<Title>_<id>.glb`, all GLB.
43
+ - **Per-model record:** `~/models/cc0/poly-pizza/manifest.json` holds the id, title, creator, licence, page URL (`https://poly.pizza/m/<id>`), GLB URL and path.
44
+ - **Thumbnails:** `~/models/cc0/poly-pizza/_contact-sheet.png` shows every download.
45
+ - **Set aside:** 5 wrong-looking results are in `poly-pizza/_offtheme/`: "Star" (a collectible star, not a starfish), two alien "Tree Floating", a metal oil drum and a plain cube.
46
+
47
+ | Category | Count | Models (creator) |
48
+ |---|---|---|
49
+ | palm | 8 | Palm Tree x4, Palm Trees (cluster), Bamboo x3 (Quaternius) |
50
+ | beach | 6 | Coconut Half, Mussel Open (Kenney), Sea Urchin Open, Crab Enemy (Quaternius), Seaweed (Mohabins), Coral Reef Set (MiniPoly) |
51
+ | boat | 11 | Boat x2, Sail Boat, Small Ship, Sail Ship, Lifeboat, Raft (inflatable), Raft Paddle, Anchor (Quaternius), Ship, Ship Wreck (Kenney) |
52
+ | pier | 11 | Docks, Dock x3, Dock Long, Dock Long No Rope, Dock Wide, Dock Stairs, Dock Broken, Small Bridge, Bridge (Quaternius) |
53
+ | hut | 8 | Hut x3, Huts, Shack x2, Storage Hut, Tribal (tiki mask creature) (Quaternius) |
54
+ | ruin | 9 | Arch x2, Arch Round, Column, Large Bone (Quaternius), Arch, Pillar, Broken Fence Pillar (Kay Lousberg), Column Wide (Kenney) |
55
+ | driftwood | 10 | Wood Log, Wood Log with Moss, Wood, Logs, Wood Planks, Pallet Broken, Dead Tree x3 (Quaternius), Dead tree (Kay Lousberg) |
56
+ | prop | 23 | Barrel x3, Crate x4, Chest, Chest Closed, Chest Open, Chest Gold, Chest with Gold, Ocean Chest, Wood Chest, Bucket of Fish, Fishing Rod, Cable, Torch, Wooden Torch, Bonfire x2 (Quaternius), Fishing Stand (Kenney), Lantern (Kay Lousberg) |
57
+ | rock | 11 | Rock x3, Rocks x2, Rock Large x3, Rock Medium (Quaternius), Rock Flat, Rock Formation (Kenney) |
58
+
59
+ ## Export these first (top 30)
60
+
61
+ | # | Category | File |
62
+ |---|---|---|
63
+ | 1 | palm | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_PalmTree_1.gltf` |
64
+ | 2 | palm | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_PalmTree_3.gltf` |
65
+ | 3 | palm | `~/models/cc0/kenney/pirate-kit/Models/GLB format/palm-detailed-bend.glb` |
66
+ | 4 | palm | `~/models/cc0/poly-pizza/palm/Quaternius-Palm-Tree_A6cKJYFsIb.glb` |
67
+ | 5 | palm | `~/models/cc0/poly-pizza/palm/Quaternius-Palm-Tree_nr1B5DbICA.glb` (leaning) |
68
+ | 6 | rock | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_Cliff1.gltf` |
69
+ | 7 | rock | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_Rock_2.gltf` |
70
+ | 8 | rock | `~/models/cc0/kenney/pirate-kit/Models/GLB format/rocks-sand-a.glb` |
71
+ | 9 | rock | `~/models/cc0/kenney/nature-kit/Models/GLTF format/rock_largeA.glb` |
72
+ | 10 | rock | `~/models/cc0/poly-pizza/rock/Kenney-Rock-Formation_pRY9BCFbmQ.glb` (sea stack) |
73
+ | 11 | boat | `~/models/cc0/kenney/pirate-kit/Models/GLB format/boat-row-small.glb` |
74
+ | 12 | boat | `~/models/cc0/kenney/pirate-kit/Models/GLB format/ship-wreck.glb` |
75
+ | 13 | boat | `~/models/cc0/quaternius/pirate-kit/glTF/Ship_Small.gltf` |
76
+ | 14 | boat | `~/models/cc0/poly-pizza/boat/Quaternius-Sail-Boat_BgSZXwmm7k.glb` |
77
+ | 15 | pier | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_Dock.gltf` |
78
+ | 16 | pier | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_Dock_Broken.gltf` |
79
+ | 17 | pier | `~/models/cc0/poly-pizza/pier/Quaternius-Dock-Long_bN9Oz3niNm.glb` |
80
+ | 18 | hut | `~/models/cc0/poly-pizza/hut/Quaternius-Hut_4MJWbyd6vw.glb` |
81
+ | 19 | hut | `~/models/cc0/poly-pizza/hut/Quaternius-Huts_j9uMWazOBh.glb` |
82
+ | 20 | prop | `~/models/cc0/quaternius/pirate-kit/glTF/Prop_Barrel.gltf` |
83
+ | 21 | prop | `~/models/cc0/kenney/pirate-kit/Models/GLB format/crate.glb` |
84
+ | 22 | prop | `~/models/cc0/quaternius/pirate-kit/glTF/Prop_Chest_Gold.gltf` |
85
+ | 23 | prop | `~/models/cc0/quaternius/fantasy-props-megakit/Exports/glTF/Rope_1.gltf` (needs its folder's textures; shape not checked) |
86
+ | 24 | clutter | `~/models/cc0/poly-pizza/beach/Kenney-Coconut-Half_ufT2tXnLFc.glb` |
87
+ | 25 | clutter | `~/models/cc0/poly-pizza/beach/Kenney-Mussel-Open_eWHAc3Pq8z.glb` (shell) |
88
+ | 26 | clutter | `~/models/cc0/poly-pizza/driftwood/Kay-Lousberg-Dead-tree_k80NkrvY2f.glb` (driftwood branch) |
89
+ | 27 | clutter | `~/models/cc0/poly-pizza/driftwood/Quaternius-Wood-Log_L4E32Wee6C.glb` |
90
+ | 28 | clutter | `~/models/cc0/quaternius/pirate-kit/glTF/Environment_LargeBones.gltf` (whale ribs) |
91
+ | 29 | ruin | `~/models/cc0/poly-pizza/ruin/Quaternius-Arch-Round_B9QABewqLv.glb` |
92
+ | 30 | ruin | `~/models/cc0/kenney/nature-kit/Models/GLTF format/stone_tallA.glb` (monolith) |
93
+
94
+ ## How each download worked, and what failed
95
+
96
+ - **Kenney:** direct zips from `kenney.nl/media/pages/assets/<pack>/…/kenney_<pack>.zip`, taken from each pack page. The Watercraft page is `/assets/watercraft-kit`; `/assets/watercraft-pack` has no download link.
97
+ - **itch.io (Quaternius Ultimate Nature, Stylized Nature, Fantasy Props; KayKit Forest):** fetched without a browser. The script gets the page's `csrf_token`, then POSTs to `https://<user>.itch.io/<slug>/file/<upload_id>?source=view_game&as_props=1` and gets back a signed URL (see `_tools/itch_get.sh`). The `source=game_download&key=…` route returned "invalid key".
98
+ - **Quaternius Pirate Kit:** only offered as a Google Drive folder. It was listed through `drive.google.com/embeddedfolderview?id=…`, and each file came from `drive.usercontent.google.com/download?id=…&export=download&confirm=t`. This worked, but only the glTF subfolder was taken (no FBX/OBJ/Blends).
99
+ - **Poly Pizza:** scraping model pages hit HTTP 429 quickly. The JSON search endpoint `poly.pizza/api/search/<q>?lic=1` (CC0 only) worked. GLB URL = the result's `previewUrl` with `.webp` changed to `.glb`.
100
+ - **Not found or skipped:**
101
+ - **KayKit Pirate pack:** no such pack exists on KayKit's itch page or GitHub (`KayKit-Game-Assets`).
102
+ - **KayKit Adventurers:** characters only, so skipped.
103
+ - **KayKit Dungeon Remastered:** barrels, crates and chests are already covered, so skipped.
104
+ - **Poly Pizza CC0 gaps:** no CC0 **starfish**, **fishing net** or rope-coil model exists (the rest of those search results were CC-BY and were excluded).
105
+ - **Quaternius packs:** there are no palms in the Stylized Nature MegaKit, and the Ultimate Nature Pack has no glTF (FBX/OBJ/.blend only).
@@ -0,0 +1,209 @@
1
+ # img2mesh: image-to-3D on this Mac (Apple M5 Max, 128 GB, macOS 26.5, no CUDA)
2
+
3
+ Summary (2026-09-23): **TRELLIS.2-4B runs on MPS** through the community port shivampkumar/trellis-mac, and it
4
+ produced every Driftwood hero prop. A prop takes 1–3.5 min to generate plus 3–5 s of texture bake at
5
+ `1024_cascade`, or ~35 s at `512`; the pipeline loads once per batch in ~80–90 s.
6
+ **Hunyuan3D-2's shape model runs on MPS too.** Its texture painter needs a CUDA rasteriser, which I rebuilt for CPU.
7
+ Measured numbers are in §3. Installs and weights live outside the repo:
8
+ - installs: `~/ml/img2mesh/{trellis-mac,Hunyuan3D-2}`;
9
+ - weights: `~/projects/weights/manual/` (the machine's single weight store; see its AGENTS.md);
10
+ - CC0 kits: `~/models/cc0/` (see CC0.md).
11
+
12
+ The box is shared. Every model load goes through the machine-wide lock:
13
+ `~/projects/localai/bin/img2mesh/run-locked.sh <log> <cmd…>` (lockf on `~/projects/localai/.model.lock`; it waits
14
+ until anonymous memory is below 70 GB and evicts afterwards).
15
+
16
+ ## 1. The pipeline
17
+
18
+ ```
19
+ concept art ──codex image_gen──▶ art/driftwood-isle/round-8-assets/ref-<prop>.jpg (one object, white bg, 3/4 view)
20
+ │ (a sheet of small objects: split_sheet.py → one RGBA crop per object: a sheet makes TRELLIS pile them up)
21
+ ▼
22
+ trellis_batch.py (MPS, under the lock) ──▶ ~/ml/img2mesh/out/driftwood/<ref>.glb (~40 k faces, 1024² PBR texture)
23
+ ▼
24
+ driftwood_post.py (Blender 5.2, headless) ──▶ faceted low-poly, one colour per facet (+ optional WebP atlas),
25
+ │ Cycles AO in the vertex alpha, metres, pivot at the base
26
+ ▼
27
+ build_driftwood.sh (gltf-transform meshopt) ──▶ public/assets/models/driftwood-hero/<asset>/<asset>.glb (+ .tex.glb, .json)
28
+ ```
29
+
30
+ | File | What |
31
+ |---|---|
32
+ | `trellis_batch.py` | TRELLIS.2 batch runner: loads once, writes `<stem>.glb` (decimated + baked), `<stem>.hi.obj` (raw), `<stem>.json` (timings) |
33
+ | `driftwood_post.py` | the clean-up: weld → drop crumbs → `--split` sets into assets → decimate (`--simplifier fqmr` quadric / `blender` collapse, `--remesh` voxel first for solid props) → per-facet colour from the generated texture (4 BVH samples, HSV grade, k-means `--quant`) → AO → scale / pivot → glb; `--atlas N` also bakes an N² WebP base-colour atlas (`<asset>.tex.glb`); `--keep-texture` is the PBR mode (below) |
34
+ | `build_props.py` | any shard: `build_props.py <props.json> <out dir> [ref …]`: runs `driftwood_post.py` per prop of the list into a staging folder, then meshopt into `<out dir>/<asset>/` (PH-0.3) |
35
+ | `build_driftwood.sh` | Driftwood's: `build_props.py src/shards/driftwood-isle/art/hero-props.json public/assets/models/driftwood-hero` (the list: every size, budget and option) |
36
+ | `props/<list>.json` | a prop list: `gen` (the generations), `stage`, `args` for every prop (`["--keep-texture"]` for a photoreal shard), `props: [{ref, args}]` |
37
+ | `src/shards/nalati-grasslands/art/model-recipe.json` | not a `build_props.py` list: the recipe of Nalati's models (M10, E315), copied from localai's `bin/img2mesh/nalati-jobs.tsv` and its finish settings. Per model: the generator that ships, the TRELLIS rebake and `blender_post.py` settings, the reference prompt, and what was delivered. The runners stay in localai |
38
+ | `split_sheet.py` | cut a sheet of separate objects on white into one RGBA crop per object |
39
+ | `render_still.py` | a 3/4 Eevee still, the same sun + sky for every model; `a.glb,b.glb,…` lays a set out in a row |
40
+ | `board.py` | the comparison board `art/driftwood-isle/round-8-assets/board.jpg`: concept crop, reference, new asset, current in-game model |
41
+ | `hunyuan_cpu_rasterizer.sh` | builds Hunyuan3D-2's `custom_rasterizer` without CUDA (its CPU path, results copied back to MPS) |
42
+ | `cc0_export.py`, `build_cc0.sh` | CC0 kit models → Driftwood palette (per-face CIELAB snap, `--family rock|bleach|wood`) → `public/assets/models/driftwood-cc0/` |
43
+ | `CC0.md` | the CC0 library: every pack, its licence, URL and local path |
44
+
45
+ The output convention matches `scripts/blender/` and `src/world/BlenderIsland.ts`:
46
+ - `COLOR_0`: rgb is the albedo, a is the baked AO (0.35–1);
47
+ - flat normals, no textures (except `.tex.glb`);
48
+ - metres, Y-up, pivot at the base centre (a leaning palm pivots on its trunk foot);
49
+ - `EXT_meshopt_compression`, so the loader needs `new GLTFLoader().setMeshoptDecoder(MeshoptDecoder)`.
50
+
51
+ **PBR mode (`--keep-texture`, a photoreal shard such as Pine Hollow, PH-0.3).** No facet flattening. The prop is shaded
52
+ smooth, with edges past `--smooth-angle` (40°) kept hard. The generated texture is baked **ungraded** onto the low mesh's
53
+ own UVs (`--atlas`, default 1024). A tangent-space normal map is baked from the high mesh (`--normal-map`, default the
54
+ atlas size). `<asset>.glb` carries that material: WebP base colour + normal, `--roughness`, no `COLOR_0`, no AO bake and
55
+ no `.tex.glb`. Driftwood's outputs are unchanged: `build_driftwood.sh` re-produces the committed `driftwood-hero` files
56
+ byte-for-byte.
57
+
58
+ To regenerate one prop, e.g. the hut:
59
+ ```bash
60
+ A=art/driftwood-isle/round-8-assets
61
+ ~/projects/localai/bin/img2mesh/run-locked.sh ~/ml/img2mesh/logs/driftwood.log \
62
+ ~/ml/img2mesh/trellis-mac/.venv/bin/python scripts/img2mesh/trellis_batch.py --out ~/ml/img2mesh/out/driftwood $A/ref-hut.jpg
63
+ bash scripts/img2mesh/build_driftwood.sh hut
64
+ ```
65
+
66
+ ## 2. Install (exact, as run 2026-09-23)
67
+
68
+ Versions:
69
+ - Python 3.11.15 (uv 0.11.26), torch 2.14.0 (MPS), torchvision 0.29.0, transformers 5.17.0;
70
+ - Blender 5.2.1 LTS (`/opt/homebrew/bin/blender`);
71
+ - trellis-mac `d58628f`, microsoft/TRELLIS.2 `75fbf01`, mtlgemm `566c133`, trellis2-apple `1734724`;
72
+ - Tencent-Hunyuan/Hunyuan3D-2 `f8db630`, diffusers 0.40.0.
73
+
74
+ ### TRELLIS.2 (MIT), via shivampkumar/trellis-mac
75
+
76
+ ```bash
77
+ mkdir -p ~/ml/img2mesh && cd ~/ml/img2mesh
78
+ git clone https://github.com/shivampkumar/trellis-mac.git && cd trellis-mac
79
+ bash setup.sh # venv (py3.11), deps, clones TRELLIS.2 + Pedro Naugusto's Metal backends, applies MPS patches
80
+ # setup.sh's Metal builds all FAIL with torch 2.14 (headers need C++20 / macOS 12; o-voxel needs Eigen). Rebuild:
81
+ brew install eigen
82
+ source .venv/bin/activate
83
+ export MACOSX_DEPLOYMENT_TARGET=12.0 CPATH=/opt/homebrew/include/eigen3
84
+ for d in mtlbvh mtldiffrast mtlmesh mtlgemm trellis2-apple/o-voxel; do uv pip install --no-build-isolation deps/$d; done
85
+ ```
86
+
87
+ Weights (~18 GB) go into `~/projects/weights/manual` with that store's `bin/fetch-repo.sh`, not `hf download`:
88
+ - `microsoft/TRELLIS.2-4B`;
89
+ - `microsoft/TRELLIS-image-large` (only `ckpts/ss_dec_conv3d_16l8_fp16.*`);
90
+ - `facebook/dinov3-vitl16-pretrain-lvd1689m` (gated: request access on HF; this account has it);
91
+ - `ZhengPeng7/BiRefNet`.
92
+
93
+ `~/ml/img2mesh/trellis-view/pipeline.json` is TRELLIS.2's `pipeline.json` with every model path pointed into
94
+ `manual/`. It also swaps the background remover: the hub config names `briaai/RMBG-2.0`, which is gated (no
95
+ access here) and **CC BY-NC**, so it uses **BiRefNet (MIT)**. BiRefNet's weights load as fp16, and
96
+ `trellis_batch.py` casts them to fp32 because the pipeline feeds it fp32.
97
+
98
+ ### Hunyuan3D-2 (allowed for shipped assets, like TRELLIS.2: the game ships in North and South America only)
99
+
100
+ ```bash
101
+ cd ~/ml/img2mesh && git clone --depth 1 https://github.com/Tencent-Hunyuan/Hunyuan3D-2.git && cd Hunyuan3D-2
102
+ uv venv .venv --python 3.11 && source .venv/bin/activate
103
+ uv pip install torch torchvision diffusers einops opencv-python numpy transformers omegaconf tqdm trimesh pymeshlab \
104
+ pygltflib xatlas accelerate rembg onnxruntime ninja pybind11 scikit-image setuptools wheel
105
+ uv pip install -e .
106
+ bash <repo>/scripts/img2mesh/hunyuan_cpu_rasterizer.sh # texture painter: custom_rasterizer without CUDA
107
+ ```
108
+
109
+ Weights: `tencent/Hunyuan3D-2` (`hunyuan3d-dit-v2-0(-turbo)`, `hunyuan3d-vae-v2-0(-turbo)`, `hunyuan3d-paint-v2-0-turbo`,
110
+ `hunyuan3d-delight-v2-0`) and `tencent/Hunyuan3D-2mini` (`hunyuan3d-dit-v2-mini-turbo`, `hunyuan3d-vae-v2-mini`), in
111
+ `manual/tencent/`. The shared runner is `~/projects/localai/bin/img2mesh/hy3d_batch.py`: `--shape turbo|full`,
112
+ `--no-paint`.
113
+
114
+ ### Blender side
115
+
116
+ `driftwood_post.py --simplifier fqmr` imports `fast-simplification`. It is installed next to Blender, not into it:
117
+ ```bash
118
+ /Applications/Blender.app/Contents/Resources/5.2/python/bin/python3.13 -m pip install \
119
+ --target ~/ml/img2mesh/blender-site fast-simplification
120
+ ```
121
+
122
+ ## 3. Measured (M5 Max, 2026-09-23, under the shared lock, other sessions active)
123
+
124
+ TRELLIS.2-4B, `1024_cascade`, seed 42, 12 steps per stage. The pipeline load was 92 s in batch 1 and 82 s in batch 2.
125
+
126
+ | Ref | Generate | Raw faces | Bake → 40 k faces + 1024² | Peak RSS |
127
+ |---|---|---|---|---|
128
+ | boulders (sheet of 5) | 62 s | 1.6 M | 2.5 s | 20.8 GB |
129
+ | palm-a | 89 s | 2.4 M | 3.2 s | |
130
+ | driftwood (sheet of 4) | 119 s | 4.6 M | 3.5 s | |
131
+ | piling | 110 s | 4.0 M | 3.3 s | |
132
+ | palm-b | 142 s | 5.0 M | 4.7 s | |
133
+ | shrine | 136 s | 5.2 M | 4.2 s | |
134
+ | sailboat | 178 s | 7.6 M | 12.8 s | |
135
+ | clutter (sheet; replaced by single crops) | 182 s | 7.7 M | 9.3 s | 21.6 GB |
136
+ | coco (sheet; replaced by single crops) | 196 s | 7.1 M | 4.5 s | 22.4 GB |
137
+ | palm-c | 206 s | 6.9 M | 4.4 s | |
138
+ | wreck | 249 s | 10.9 M | 21.6 s | |
139
+ | hut | 501 s | 16.5 M | 15.2 s | |
140
+
141
+ - **512:** 35 s generate + 7 s bake (palm-a) and 22 s + 8 s (boulders), after a 78 s load.
142
+ - **Post:** `driftwood_post.py` is 1–10 s per prop (Cycles AO on CPU at 64 samples; the atlas bake is 4 samples).
143
+ - **Board stills:** `render_still.py` takes ~1–2 s each.
144
+
145
+ **Hunyuan3D-2 on the same refs** (`hy3d_batch.py --shape turbo`, i.e. `hunyuan3d-dit-v2-0-turbo` with FlashVDM +
146
+ `hunyuan3d-paint-v2-0-turbo`, octree 380):
147
+ - load: 26 s;
148
+ - palm-a: shape 7.4 s (701 k faces → 40 k), paint 18.0 s;
149
+ - hut: shape 4.8 s (1.58 M → 40 k), paint 12.7 s;
150
+ - 94 s wall for both, 34.5 GB peak footprint.
151
+
152
+ That is **~10× faster than TRELLIS.2**, with a comparable hut and a palm whose crown is a better solid mass.
153
+ Its trunk comes back painted in red-and-cream stripes, and its thatch is flatter.
154
+ Side by side: `art/driftwood-isle/round-8-assets/hunyuan-vs-trellis.jpg`.
155
+
156
+ ## 4. What works, what doesn't, and why
157
+
158
+ - **TRELLIS.2 is the one we use.**
159
+ - Best silhouettes of the two, and fast enough to iterate: a whole prop set in two ~15-minute batches.
160
+ - It ships a baked PBR texture, which is what the per-facet colour sampling reads.
161
+ - The Mac port skips hole filling: `cumesh` is CUDA-only and its Metal port segfaults at decoder sizes. So meshes
162
+ keep small holes and open plank shells, and Blender's collapse decimation stalls on them at 3–5× the budget.
163
+ That is why `driftwood_post.py` offers `--simplifier fqmr` (palms), `--remesh` (piling, sailboat) and a plain
164
+ collapse (rocks, driftwood, hut, shrine).
165
+ - The wreck is made of open, single-sided plank shells, and every decimator tore them apart (7.7 k tris at best).
166
+ `--solidify 0.004 --remesh 0.005` thickens the shells first and then voxel-remeshes them. The result is a 3.0 k
167
+ LOD0 plus a 1.4 k `wreck-lod1`, with chunkier planks than the reference.
168
+ - Flat items (starfish) come back as a flat, open sheet. `--up x90` stands them up the right way, then `--remesh 0.025`
169
+ closes them. Before `--up` could rotate anything, the glTF import had to be switched out of QUATERNION mode.
170
+ - Palm frond `frond-a` (a straight pinnate leaf) fell apart into loose leaflets and was dropped. The curled
171
+ `frond-b` survived.
172
+ - A sheet of several objects comes back as one tight pile (the clutter sheet did). So small objects each get
173
+ their own crop via `split_sheet.py`.
174
+ - **Hunyuan3D-2 runs on Apple Silicon, with caveats:**
175
+ - `hy3dgen.shapegen` runs as-is on `device='mps'`;
176
+ - the texture painter's `custom_rasterizer` is a CUDA extension. It does carry a CPU rasteriser, and
177
+ `hunyuan_cpu_rasterizer.sh` builds just that;
178
+ - the multiview paint pipeline also needs `trust_remote_code` for its custom diffusers pipeline.
179
+ - **Which to use:** Hunyuan3D-2 and TRELLIS.2 are equally allowed for shipped game assets (the game ships in
180
+ North and South America only, AGENTS.md). Run both where it matters and ship the better model.
181
+
182
+ ## 4b. Hi3D refine (opt-in, HI3D-REFINE, 2026-10-24)
183
+
184
+ [Hi3D v1.0](https://github.com/hi3d-official/Hi3Dv1.0) refines a generation's mesh against its reference into ~1 M
185
+ clean faces (geometry only). Runtime, numbers and traps: localai [`docs/hi3d.md`](../../../../localai/docs/hi3d.md).
186
+
187
+ ```bash
188
+ L=~/projects/localai/bin/img2mesh/run-locked.sh
189
+ $L ~/ml/img2mesh/logs/<job>-hi3d.log ~/ml/img2mesh/hi3d-mlx/.venv/bin/python -I scripts/img2mesh/hi3d_refine.py \
190
+ --res 1024 ~/ml/img2mesh/out/hi3d/<shard> <gen>/<ref>.glb <ref image> [<gen>/<ref>.glb <ref image> …]
191
+ REFINE=~/ml/img2mesh/out/hi3d/<shard> python3 scripts/img2mesh/build_props.py <list>.json <out dir> <ref> # or "refine": {"dir", "res"} in the list
192
+ ```
193
+
194
+ - `hi3d_refine.py` turns each mesh to the reference's camera (`--turn auto`), refines, fits the result back onto the
195
+ GLB (bbox + ICP) and records time, memory and mesh health. `driftwood_post.py --geo` decimates the refined mesh and
196
+ bakes the normal map from it; colour still comes from the generation. Off by default: outputs rebuild byte-for-byte.
197
+ - **Use it** for messy generator geometry (spikes, torn flaps, holes after decimation), faceted props and normal-mapped
198
+ heroes. **Not** for detail the generator only painted (it carves the reference's version under the old paint) or a
199
+ look without a normal map (no gain). `hi3d_paint.py` (Hunyuan repaint of the refined mesh) lost every test.
200
+ - Boards: `art/hi3d-refine/round-1-heroes/`. Driftwood props built with `--simplifier blender` need `fqmr` under Hi3D
201
+ (the collapse stalls at ~10× the budget on 1 M faces).
202
+
203
+ ## 5. Next
204
+
205
+ - Wreck (V-M2): a hand retopo in Blender so the planks read as planks. The remeshed 3 k LOD0 is blobby next to the
206
+ reference. Hi3D does this at the same 3 k (HI3D-REFINE board-wreck): railings, ribs and planks read.
207
+ - Emissive rune on the shrine: the atlas has the glowing diamond, and the vertex-colour build loses it.
208
+ - Kitbash coconuts into the palms' crowns: the coconut-cluster asset exists, but TRELLIS dropped the nuts from palm-a.
209
+ - Try TRELLIS.2 at `1024_cascade` with 20+ steps for the hut, and check a Hunyuan 2.1 PBR build against it.
@@ -0,0 +1,102 @@
1
+ """A/B(/C) board for the Hi3D refine experiment (HI3D-REFINE H5): one prop's arms side by side, iPhone portrait.
2
+
3
+ python3 scripts/img2mesh/ab_board.py <renders dir> <out.jpg> "<title>" --arm A "today" <dir> --arm B "Hi3D" <dir> \
4
+ [--arm C "Hi3D + repaint" <dir>] name=refpath [name=refpath …]
5
+
6
+ Each <dir> is a build_props.py output dir (<name>/<name>.glb + <name>.json), every arm built with the same
7
+ driftwood_post.py arguments: A as today, B with REFINE=<hi3d dir>, C with GEN=<hi3d_paint.py dir> as well. Per prop,
8
+ three rows: the reference, then every arm at yaw 35°; every arm at yaw 215° (the far side, where Hi3D invents detail);
9
+ a 3× close-up of the 215° view's centre. The first column under the reference lists each arm's triangles and bytes.
10
+ Every render is scripts/img2mesh/render_still.py of the final game GLB (same light, same camera), cached in
11
+ <renders dir>. Each cell is labelled on the image itself.
12
+ """
13
+ import json
14
+ import os
15
+ import subprocess
16
+ import sys
17
+
18
+ from PIL import Image, ImageDraw, ImageFont
19
+
20
+ HERE = os.path.dirname(os.path.abspath(__file__))
21
+ BLENDER = os.environ.get("BLENDER") or "/opt/homebrew/bin/blender"
22
+ W = 1170 # iPhone portrait width
23
+ GAP = 12
24
+ LABEL = 52
25
+ BG, INK, DIM, PANEL = (14, 26, 36), (235, 242, 244), (150, 175, 186), (200, 208, 214)
26
+
27
+
28
+ def render(glb, png, yaw, size):
29
+ if not os.path.exists(png):
30
+ subprocess.run([BLENDER, "-b", "-P", os.path.join(HERE, "render_still.py"), "--", glb, png, "--size",
31
+ str(size), "--yaw", str(yaw)], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
32
+ return Image.open(png)
33
+
34
+
35
+ def fit(img, cell):
36
+ img = img.convert("RGB")
37
+ img.thumbnail((cell, cell))
38
+ out = Image.new("RGB", (cell, cell), PANEL)
39
+ out.paste(img, ((cell - img.width) // 2, (cell - img.height) // 2))
40
+ return out
41
+
42
+
43
+ def stats(d, name):
44
+ glb = os.path.join(d, name, name + ".glb")
45
+ meta = json.load(open(os.path.join(d, name, name + ".json")))
46
+ return f"{meta.get('tris', '?')} tris · {os.path.getsize(glb) / 1024:.0f} KB"
47
+
48
+
49
+ def main():
50
+ rdir, out, title = sys.argv[1:4]
51
+ rest, arms, pairs = sys.argv[4:], [], []
52
+ while rest:
53
+ if rest[0] == "--arm":
54
+ arms.append(tuple(rest[1:4]))
55
+ rest = rest[4:]
56
+ else:
57
+ pairs.append(rest.pop(0).split("=", 1))
58
+ cell = (W - (len(arms) + 2) * GAP) // (len(arms) + 1)
59
+ os.makedirs(rdir, exist_ok=True)
60
+ font = ImageFont.truetype("/System/Library/Fonts/Menlo.ttc", 22)
61
+ small = ImageFont.truetype("/System/Library/Fonts/Menlo.ttc", 17)
62
+ head = 70
63
+ block = 3 * (cell + LABEL + GAP)
64
+ sheet = Image.new("RGB", (W, head + len(pairs) * (block + 16) + GAP), BG)
65
+ d = ImageDraw.Draw(sheet)
66
+ d.text((GAP, 12), title, fill=INK, font=font)
67
+ d.text((GAP, 42), " · ".join(f"{t} = {what}" for t, what, _ in arms) + " · same tris budget", fill=DIM, font=small)
68
+ y = head
69
+ for name, ref in pairs:
70
+ for row, (yaw, view) in enumerate(((35, "yaw 35°"), (215, "yaw 215°"), (None, "close-up ×3"))):
71
+ x = GAP
72
+ if row == 0:
73
+ sheet.paste(fit(Image.open(ref), cell), (x, y))
74
+ d.text((x + 8, y + 6), "ref", fill=(20, 20, 20), font=font)
75
+ d.text((x, y + cell + 6), name, fill=INK, font=small)
76
+ d.text((x, y + cell + 28), "reference", fill=DIM, font=small)
77
+ elif row == 1:
78
+ for i, (tag, _, arm) in enumerate(arms):
79
+ d.text((x, y + 8 + i * 48), tag, fill=INK, font=font)
80
+ d.text((x, y + 34 + i * 48), stats(arm, name), fill=DIM, font=small)
81
+ x += cell + GAP
82
+ for tag, what, arm in arms:
83
+ glb = os.path.join(arm, name, name + ".glb")
84
+ if yaw is None:
85
+ big = render(glb, os.path.join(rdir, f"{name}.{tag}.close.png"), 215, 3 * cell)
86
+ c = big.width // 3
87
+ img = big.crop((c, c, 2 * c, 2 * c))
88
+ else:
89
+ img = render(glb, os.path.join(rdir, f"{name}.{tag}.{yaw}.png"), yaw, cell)
90
+ sheet.paste(fit(img, cell), (x, y))
91
+ d.text((x + 8, y + 6), tag, fill=(20, 20, 20), font=font)
92
+ d.text((x, y + cell + 6), f"{tag} · {what}", fill=INK, font=small)
93
+ d.text((x, y + cell + 28), view, fill=DIM, font=small)
94
+ x += cell + GAP
95
+ y += cell + LABEL + GAP
96
+ y += 16
97
+ sheet.save(out, quality=82, optimize=True)
98
+ print(out, sheet.size)
99
+
100
+
101
+ if __name__ == "__main__":
102
+ main()