Skip to content

[Bugfix] Fix tile-partition preview/export bounding boxes that bound empty space - #1410

Merged
untoldengine merged 1 commit into
developfrom
issue/1409
Nov 11, 2026
Merged

untoldengine merged 1 commit into
developfrom
issue/1409

Conversation

@untoldengine

Copy link
Copy Markdown
Owner

Summary

Fixes #1409 — kd-tree/quad-tree partition preview boxes (and the exported manifest's cell_bounds) could cover huge empty regions with no real geometry inside them.

Three compounding causes, all fixed:

  • get_candidate_objects() / _collect_objects() only checked Object.hide_render and the per-view-layer visibility toggle, missing Collection.hide_render/hide_viewport (the Outliner's "disable in viewports"/camera icons on a collection itself). A collection disabled that way still contributed to world bounds and the partition tree.
  • The KD-tree's per-axis splitting leaves a leaf's untouched axis at the floor-wide extent; the preview drew that raw cell_bounds_xy instead of the leaf's actual content.
  • _collapse_underfilled_tile_tiers() merges a sparse (node_id, tier) group into its parent node to avoid a near-empty streaming bucket, but overwrites the moved objects' cell_bounds_xy with the parent's full rectangle — which can climb all the way to the floor root for an isolated object.

Changes

  • scripts/tilestreamingpartition.py: _build_collection_render_visibility_map() + _is_render_visible() walk the collection tree for hide_render; viewport check switched to obj.visible_get(). group_cell_bounds_xy() now takes object_bounds and rejects a stored cell whose area exceeds 25x the group's own content area (CELL_BOUNDS_MAX_AREA_RATIO), falling back to the content AABB already used elsewhere. Applied at both manifest-writing call sites, so the shipped cell_bounds field (used by the engine's "Tile Bounds" debug overlay) is correct too.
  • scripts/untold-blender-addon/untold_exporter/viewport_overlay.py: same collection-visibility fix for the live preview; KD-tree boxes always use the tight union AABB; quad-tree boxes apply the same 25x looseness check to both the stored cell and the structurally-reconstructed node box.

Test plan

  • python3 -m unittest discover -s scripts/tests -t . — 270 tests pass
  • Verified against a real downloaded mansion asset with a disabled "grass particles" collection and several collapsed sparse tile groups: root scene bounds went from spanning into empty space down to a tight fit around the building; worst-case node/leaf box-to-content area ratio dropped from >2,000,000x to ≤25x
  • Confirmed via Swift source (SpatialDebugBoundsCollector.swift, RegistrationSystem.swift) that cell_bounds is debug-overlay-only at runtime, not used by streaming/LOD distance logic — so this is a correctness fix with no behavior change to shipped streaming

…empty space (#1409)

Three compounding issues caused kd-tree/quad-tree preview boxes (and the
exported cell_bounds in the manifest) to cover huge empty regions:

- get_candidate_objects()/_collect_objects() only checked Object.hide_render
  and the per-view-layer visibility toggle, missing Collection.hide_render/
  hide_viewport (the Outliner's "disable in viewports"/camera icons on a
  collection), so collections disabled that way still contributed to world
  bounds and the partition.
- The KD-tree's per-axis splitting leaves a leaf's untouched axis at the
  floor-wide extent, and the preview drew that raw cell_bounds_xy instead of
  the leaf's actual content.
- _collapse_underfilled_tile_tiers() merges a sparse (node_id, tier) group
  into its parent node to avoid a near-empty streaming bucket, but overwrites
  the moved objects' cell_bounds_xy with the parent's full rectangle -- which
  can climb all the way to the floor root for an isolated object.

Fixes: use obj.visible_get() plus a collection hide_render reachability map
for visibility, always prefer the tight union AABB for KD-tree boxes, and
reject any stored cell_bounds_xy (or reconstructed quadtree node box) whose
area is more than 25x the group's own content area, falling back to the
union AABB. Applied in both the exporter (tilestreamingpartition.py, so the
shipped manifest's cell_bounds field is correct too) and the Blender add-on
preview (viewport_overlay.py).
@untoldengine
untoldengine merged commit ad9280a into develop Nov 11, 2026
4 checks passed
@untoldengine
untoldengine deleted the issue/1409 branch November 11, 2026 19:20
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.

kd-tree/quad-tree tile-partition preview shows huge boxes not bounding visible geometry

1 participant