Repository navigation
Conversation
The assemble CLI spent nearly all its time in inspect_seams (run twice) and the culling passes, which rebuilt a triangle hash for every part pair, and in the skinned GLB writer. - inspect_seams / cull_part_overlap narrow each pair query to the triangles whose centroids lie within max(|centroid_tol|, vertex_tol) of the other side's centroid box before calling find_coplanar_overlap_indices. Matching is any-hit and independent per target triangle, so the culled indices and stats are unchanged. Coordinate-space mismatches, non-finite input and malformed triangles fall back to the full query, so errors read as before. - remap_part_joints maps all rows through one lookup table when every source joint resolves cleanly; anything else runs the old slot-by-slot loop. - _pack_f32_vec / _pack_u16_vec4 pack in bounded chunks and fall back to the row loop on any rejected value. - align_part_to_standing_space shifts and converts in one pass; the triangle key/geometry helpers do the same arithmetic with fewer calls; accessor min/max use C-level iteration. Tests compare each fast path with the definition it replaced. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent Windows correctness check of 46bf2e55 with CPython 3.12.8. All 24 tests in I compared two additional synthetic fixtures with the direct parent. The fixtures put triangles on either side of the centroid-distance and vertex-quantization thresholds. Both revisions removed the same triangle indices and reported the same counts. A separate synthetic assembly produced byte-identical GLB and JSON output on both revisions. This check covers output equivalence. Synthetic inputs only. AI-assisted. |
|
Tested 46bf2e5 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
|
Tested
The failures without the change are mostly the new fast-path switches not existing on Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; coordination: #8504. |
AI-assisted (Claude). Claimed in #7496: #7496 (comment)
What was slow
assemblecallsinspect_seamstwice andapply_standard_ped_cullingonce. Each pair of parts rebuilt a full triangle hash of the reference part and scanned every target triangle against it, even for parts that barely touch (head vs. shoes, upper vs. lower body, a shirt vs. pants). The skinned GLB writer then remapped joints slot by slot and packed vertex rows onepack_intoat a time.What changed (
tools/ped_assemble.py)_near_triangle_subsets,_overlap_query, used byinspect_seamsandcull_part_overlap): before callingfind_coplanar_overlap_indices, keep only triangles whose centroid lies withinmax(|centroid_tol|, vertex_tol)(plus a small margin) of the other side's centroid box. A target triangle is removed only by a reference triangle that close (the proximity tier needs centroid distance <=centroid_tol; an exact-key match puts each corner, so the centroid, within one quantization step), and matching is any-hit and independent per target triangle, so the culled indices and the stats are unchanged. Coordinate-space mismatches, non-finite tolerances or coordinates and malformed triangles fall back to the unmodified full query, so errors read as before. Centroid tables are built in bounded chunks and only one target's table is alive at a time.remap_part_joints: one lookup table when every source joint value is anintthat resolves cleanly; anything else (error, unmapped padding slot, ragged rows, float indices) runs the old slot-by-slot loop, so messages are unchanged._pack_f32_vec/_pack_u16_vec4: bounded-chunkstruct.pack, falling back to the row loop on any rejected value.align_part_to_standing_space: shift and axis conversion in one pass;_quantize_point/_canonical_tri_key/_triangle_geometrydo the same arithmetic with fewer calls; accessor min/max via C-level iteration.The bodies of
find_coplanar_overlap_indices,count_mesh_islands,analyze_edge_topologyand the JSON/GLB readers are untouched on purpose: open #7102 rewrites the first three and #6431 / #5824 / #7008 touch the readers.git merge-treeagainst the heads of #7102, #5764, #6004, #6431 and #5824 is clean (#7008 already conflicts withmainon its own).Measurements
Synthetic 9-part layered skinned ped (head, hair, upper/lower body with a 6 mm waist overlap, nipple and genital patches, shirt, pants, shoes; 8 400 triangles per large part, 60-joint rig), Windows 11, CPython 3.12.10, min of 5 alternating runs,
time.perf_counter:inspect_seams(9 parts)apply_standard_ped_cullingbuild_assembled_glb(5 skinned parts)assembleCLI, 9 JSON parts,--compact-verticestracemallocpeak, same scene: pipeline 18.8 MB before and after;inspect_seams11.65 MB before and after; culling 10.07 -> 2.27 MB; GLB build 6.70 -> 6.67 MB. No cache outlives a call.Parity: the pipeline output (seam reports, cull reports, GLB bytes, stats) hashes identically before and after; the CLI's GLB and
--jsonreport are byte-identical; a 300-case randomized comparison of_overlap_queryagainst the full query (random tolerances, jitter, translations,plane_tol,normal_cos_min,vertex_tol) found 0 mismatches, 63 of them with non-empty culls.Tests
New
tests/test_ped_assemble_fast_paths.py(24 tests, no game files) compares each fast path with the definition it replaced: partial overlap bands, near-misses either side of the centroid tolerance, shuffled corner order (exact-key tier), translations,plane_tol/ negative / zero / tiny tolerances, empty and far-apart parts, multiple refs, degenerate triangles, NaN input (same outcome), coordinate-space mismatch still raising,cull_part_overlap/apply_standard_ped_culling/inspect_seamsagainst an un-narrowed run, chunk-boundary and ragged-row packing, error cases of the joint remap,-0.0through alignment, and a wholebuild_assembled_glbwith every fast path disabled. A deliberately too-small margin makes 3 of them fail.Run:
python -m compileall -q tools/ped_assemble.py testsandpython -I tests/test_<name>.pyfortest_ped_assemble.py,test_ped_assemble_fast_paths.py,test_ped_assemble_malformed_glb.py,test_ped_assemble_sparse_glb.py,test_ped_catalogues.py,test_ped_glb_material_defaults.py,test_ped_json_textures.py,test_ped_snorm.py: all pass. (test_image_load_d16_typed.pyneeds pytest and is unrelated.) CPU only, no GPU involved; not thetests/semanticsuite.🤖 Generated with Claude Code