Skip to content

Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D.

3.1 KB
Raw Blame
# GLB Character Pipeline (img2threejs integration) — config reproducing girl-character's own shipped
# build in the companion img2threejs-showcase repo.
#
# Every CHARACTER_* value here matches the DEFAULT already baked into the packaged scripts (that is not
# a coincidence: the defaults were taken FROM this character). All paths below are relative to
# IMG2THREEJS_SHOWCASE_ROOT, never to this repo. Running
#   IMG2THREEJS_SHOWCASE_ROOT=/path/to/img2threejs-showcase \
#     integrations/glb_character_pipeline/build-character.sh \
#     --config integrations/glb_character_pipeline/configs/girl-character.env
# regenerates surfaceData.ts / surfaceDataLow.ts / surfaceDataMedium.ts inside that showcase checkout
# and should reproduce them byte-for-byte, since nothing about the reconstruction (Stage 2's cell
# sizes, the region map) changed -- only where the scripts read their configuration from did.

# Stage 1 (cross-section loft) is deliberately left unset here: girl-character's own crossSections.ts
# is already built and frozen ("DIMENSIONS ARE FROZEN" -- see build_cross_sections.py's docstring), so
# a routine build should not regenerate it. To reproduce it (proof-by-use, same idea as this file),
# run build-character.sh with these three added on top of this config:
#   CHARACTER_SECTION_REGIONS_JSON=integrations/glb_character_pipeline/configs/girl-character-section-regions.json
#   CHARACTER_SPOKES_JSON=integrations/glb_character_pipeline/configs/girl-character-spokes.json
#   CHARACTER_CROSS_SECTIONS=work/verify-crossSections.ts   # NOT src/demos/... -- don't overwrite the frozen file
# then diff the result against src/demos/girl-character/crossSections.ts by ring/region counts (the
# emitted file now always carries `uv: []`, which the original hand-shipped file predates, so an exact
# byte diff is expected to differ only in that one field per ring).

CHARACTER_GLB="public/mesh/girl-character-baseline.glb"
CHARACTER_DIFFUSE="work/baseline-textures/01-texture_diffuse.png"
CHARACTER_OUT_PREFIX="public/head/sdf-surfaces"
CHARACTER_WORKDIR="work/head"
CHARACTER_BIN_DIR="public/head"
CHARACTER_WORK_TAG=""
CHARACTER_CODEC="src/demos/girl-character/surfaceCodec.ts"
# Empty = use the script's built-in girl-character region map (Stage 2's NODE_REGION dict). A new
# character supplies its own via CHARACTER_REGIONS_JSON pointing at a {"node": "region"} JSON file.
CHARACTER_REGIONS_JSON=""

CHARACTER_DEMO_ID="girl-character"
CHARACTER_NODES="9 6 8 2 4 11 13 10 12 5 7 1 3 15 14 0"
CHARACTER_LEVELS="x2 x3 default"
# x3 coarsens MORE than x2 (bigger cell, fewer vertices), so x3 is "Low" and x2 is "Medium" --
# verified against the real, shipped files, not assumed. Swapping these two writes the wrong
# level's data under the other's filename with no error, since the .ts module's own shape doesn't
# encode which numeric level it is; only the header comment and vertex count reveal a mismatch.
CHARACTER_DEST_X2="src/demos/girl-character/surfaceDataMedium.ts"
CHARACTER_DEST_X3="src/demos/girl-character/surfaceDataLow.ts"
CHARACTER_DEST_DEFAULT="src/demos/girl-character/surfaceData.ts"