From 38f9733eb18a90ea28da1e964107f730fc7ace3e Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sun, 17 May 2026 15:03:33 +0300 Subject: [PATCH] docs(rendering): drop completed Phase 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 2.1/2.2/2.3 landed across the previous commits: - 727992b quadtree primitive - 3e87460 Scene::entity_index lazy build - e43498d wire tessellation uses query_rect - fcf4d4f mesh draw-time frustum cull - b70c9f9 hatch + wipeout draw-time frustum cull What was skipped on purpose: - Octree-with-Aabb3: meshes only carry XY world_aabb today; the pragmatic adaptation is a 4-corner projection test in `compute_mesh_lod`. Revisit if a true 3D viewport mode lands. - Per-mutation incremental quadtree updates: `entity_index_cache` is geometry_epoch-keyed and rebuilds lazily on next query. Full rebuild is ~50 ms on a 100 k-entity doc — acceptable for occasional edits; promote to incremental updates if profiling shows the rebuild cost. Phase 4 (GPU-side culling) remains the next big lever. Co-Authored-By: Claude Opus 4.7 --- RENDERING_OPTIMIZATION.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/RENDERING_OPTIMIZATION.md b/RENDERING_OPTIMIZATION.md index 695294418..6df23f79f 100644 --- a/RENDERING_OPTIMIZATION.md +++ b/RENDERING_OPTIMIZATION.md @@ -12,42 +12,6 @@ Current pipeline order: --- -## Phase 2 — Spatial Acceleration Structure - -**Goal:** O(log n) visibility queries instead of O(n) linear scan. - -### 2.1 Quadtree (2D Documents) - -Partition world space into a quadtree keyed by `Aabb2`. Build once on document load, update -incrementally on entity add/remove/modify. - -``` -QuadTree - ├── query_rect(Aabb2) → Vec - └── insert / remove / update -``` - -Store in `scene/mod.rs` alongside the entity cache. Invalidate only the nodes touched by a -modified entity. - -### 2.2 Octree (3D Solids) - -For `MeshModel` / `solid3d` entities, use an octree with `Aabb3` keys. Query returns candidate -mesh IDs for frustum culling. - -### 2.3 Integration - -Replace linear entity scans in `pipeline/mod.rs` render preparation with spatial queries: - -```rust -let candidates = scene.quadtree.query_rect(view_aabb); -// only upload GPU buffers for candidates -``` - -**Estimated gain:** near-constant frame cost regardless of total entity count when zoomed in. - ---- - ## Phase 4 — GPU-Side Culling (Advanced) **Goal:** Offload culling to the GPU; zero CPU cost for large entity counts. @@ -89,8 +53,6 @@ Relevant only for perspective (3D) mode with many overlapping solids. ## Implementation Order ``` -Phase 2.1 Quadtree for 2D medium complexity, scales 2D docs -Phase 2.2 Octree for 3D medium, needed for dense 3D Phase 4.1 Indirect draw + GPU cull high complexity, defer Phase 4.2 Hi-Z occlusion high complexity, 3D only, last ```