Repository navigation
[Bugfix] Fix tile-partition preview/export bounding boxes that bound empty space - #1410
Merged
Merged
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 checkedObject.hide_renderand the per-view-layer visibility toggle, missingCollection.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.cell_bounds_xyinstead 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_xywith 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 forhide_render; viewport check switched toobj.visible_get().group_cell_bounds_xy()now takesobject_boundsand 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 shippedcell_boundsfield (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 passSpatialDebugBoundsCollector.swift,RegistrationSystem.swift) thatcell_boundsis 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