Skip to content

fix(world_build): derive LOD ranges from exported placements - #6023

Open
ProbablySyd wants to merge 2 commits into
ItsNotRexed:mainfrom
ProbablySyd:fix/world-lod-distance-samples
Open

ProbablySyd wants to merge 2 commits into
ItsNotRexed:mainfrom
ProbablySyd:fix/world-lod-distance-samples

Conversation

@ProbablySyd

Copy link
Copy Markdown

Claimed in the coordination issue as skipped placements affecting LOD draw ranges.

Why

Skipped placements could collapse a valid LOD chunk's draw range to zero width. The chunk was present on disk, but the viewer could never load it.

What changed

  • Collect distance samples when a placement is assigned to a chunk, after its model has packed successfully.
  • Cover unresolved archetypes, zero scales, and missing OBJ files in a regression test that reads the published manifest.

Scope

The change applies to instanced exports with LOD sets. The existing median and fallback rules still determine the draw ranges.

Verification

  • The synthetic CLI export retained both chunks and restored the LOD band from [500.0, 500.0] to [130.0, 450.0].
  • The Python world suite passed 341 tests with 19 skips. The regression failed on all three cases before the fix.
  • All three viewer LOD tests passed. The full viewer suite passed 56 of 57 on both the base and this branch. PR #5692 covers the existing camera-test failure.

Tested on Linux with synthetic assets and CPU-only tests.

AI-assisted: yes.

  • No game data, keys, or decryption in the change or fixtures.
  • Translator contract rule: not applicable.

@whattheflop

Copy link
Copy Markdown
Contributor

AI-assisted Windows CPU verification of 1c587ebf against round-44 561b65a8, uv CPython 3.12.13 and Node 24.16.0. A synthetic two-cell export had five chunks and six real box instances. An additional valid point-only OBJ resolved as a placement and emitted no triangles.

Decoding the exported GLBs gave a 120 m HD/LOD boundary and 400 m far cutoff. With the geometry-free row present, main published HD [0, 140) and LOD [140, 380). The PR published [0, 120) and [120, 400) on both the node-instanced and GPU-instanced paths. All five GLBs remained byte-identical within each export mode, and the clean-case manifests and orphan-HD control stayed identical.

The production viewer accepted all eight manifests in Node with mocked rendering. Across 320 cold probes and 16 cached round trips, the PR picked the intended LOD tier at 130 m and 395 m, where main picked HD or no LOD-chain tier. The stock instancing suite passed 33/33. The stock viewer had the same #5692 failure on both revisions. Synthetic inputs only, with no browser or GPU measurement.

@SkippySteve

Copy link
Copy Markdown

Tested 1c587ebf3 on Linux (Arch, x86_64, CPython 3.14.8): pass. This is a CPU code check with synthetic fixtures only and no game files. AI-assisted (Claude).

  • PR head: tests.test_world_instancing 33/33 OK, tests.test_world_build 59 OK, tests.test_world_build_output_lock 4 OK (1 skip: 8.3 short names are Windows-only).
  • Negative control: with tools/world_build.py reverted to main and the new test kept, test_only_exported_placements_contribute_to_lod_bands fails in all 3 subtests (unresolved_archetype, degenerate_scale, model_not_loadable), so the test catches the old behaviour.
  • Merged onto current main 867d922f0: the head does not contain it, but the merge is clean (only tools/world_build.py auto-merges). The three suites pass together, 102 tests OK with 2 platform skips.
  • Code read: the LOD distances are now buffered per instance (in pairs, 0.0 meaning absent) and only sampled in the chunk pass, after the summary is None skip. So rows that are unresolved, degenerate or not loadable no longer widen lod_bands. The validation of each value is unchanged. When lod_sets is off, inst_lod_distances is None, so nothing extra is allocated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants