diff --git a/simulation/ai-polygon/project_assets.py b/simulation/ai-polygon/project_assets.py index da818eda..b1711e73 100644 --- a/simulation/ai-polygon/project_assets.py +++ b/simulation/ai-polygon/project_assets.py @@ -25,9 +25,13 @@ def digest(path): def project_members(package, lod): required = {package["visual_path"], package["collision_path"]} + # SplatTransform 3.4 opens the multi-LOD source before applying selectLod. + # Its layout comes from the first LOD-0 chunk, including that chunk's + # textures. A cold package must contain this bootstrap dependency even + # when output uses another LOD; it does not add LOD-0 splats to the output. return [item for item in package["artifacts"] if ( item["logical_path"] in required or - item["logical_path"].startswith((f"streamed/{lod}_", "streamed/env/")))] + item["logical_path"].startswith((f"streamed/{lod}_", "streamed/0_0/", "streamed/env/")))] def prepare_project(client, run, state, episode, job, pulse, isaac, *, lod=0): diff --git a/tests/test_ai_polygon_worker_assets.py b/tests/test_ai_polygon_worker_assets.py index 2b85e4c9..7215f14c 100644 --- a/tests/test_ai_polygon_worker_assets.py +++ b/tests/test_ai_polygon_worker_assets.py @@ -90,4 +90,26 @@ def test_project_package_supports_each_published_lod_without_cropping(monkeypatc package = worlds.package(dict(storage={"project_id":"sim-test"}, sha256="test", local_scene=dict(visual_url=prefix+paths[0], collision_url=prefix+paths[1]))) assert [item["logical_path"] for item in package["artifacts"]] == paths[:-1] - assert [item["logical_path"] for item in module.project_members(package, 1)] == paths[:3]+paths[4:6] + assert [item["logical_path"] for item in module.project_members(package, 1)] == paths[:6] + + +def test_cold_project_package_includes_converter_bootstrap_without_other_lod_payloads(monkeypatch): + monkeypatch.syspath_prepend(str(Path(__file__).parents[1] / "simulation/ai-polygon")) + module = importlib.import_module("project_assets") + names = ["meta.json", "means_l.webp", "means_u.webp", "quats.webp", "scales.webp", + "sh0.webp", "shN_centroids.webp", "shN_labels.webp"] + paths = ["streamed/lod-meta.json", "collision.glb"] + [ + f"streamed/{chunk}/{name}" + for chunk in ("0_0", "0_1", "0_01", "1_0", "1_1", "2_0", "env") + for name in names + ] + package = dict(visual_path=paths[0], collision_path=paths[1], + artifacts=[dict(logical_path=name) for name in paths]) + selected = {item["logical_path"] for item in module.project_members(package, 1)} + # The installed converter opens all eight assets of its first source + # segment to establish SH/layout before selecting the requested LOD. + assert {f"streamed/0_0/{name}" for name in names} <= selected + assert {f"streamed/{chunk}/{name}" for chunk in ("1_0", "1_1", "env") + for name in names} <= selected + assert not any(name.startswith(("streamed/0_1/", "streamed/0_01/", "streamed/2_0/")) + for name in selected)