Repository navigation
WIP: tier cull distance and a built-once occluder grid (A2.8) - no measured saving yet - #2313
Closed
Noisemaker111 wants to merge 2 commits into
Closed
Noisemaker111 wants to merge 2 commits into
Noisemaker111 wants to merge 2 commits into
Conversation
Core primitives for epic #2312 A2.8. The renderer still submits batches by frame; these give it a data-driven distance and a built-once occluder field to submit from.
Scatter batches compact per instance against the tier distance with hysteresis, and the culling driver builds an occluder grid once from building-sized placed solids so isOccluded receives real occluders.
51 tasks
Owner
Author
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.
Verdict: no saving - the occlusion and distance stages rejected nothing at four of eight cameras, the two shots that differed differed with matched draw counts and moving NPCs, and the grid finds almost no occluders because it trusts only placed solids >= 6 m while Harbor Heat'"'"'s downtown is generated chunks and Brightway Park'"'"'s props are smaller.
Part of epic #2312 A2.8. Closed unmerged; the measured outcome is recorded on the epic. LOD cross-fade is #2316.
What is here:
render/cullPolicy.ts: a tier'"'"'s instance cull distance fromGraphicsQuality+ the profiledrawDistance, per-game scene override wins, ultra resolves toInfinity, hysteresis on the boundary.world/occluderGrid.ts: cell grid built once from authored boxes, queried by sampling the camera ray; a sample counts only when strictly inside a blocker footprint, so it can miss a hidden object but cannot see through a blocking one.scatter/InstancedScatter.tsx: foliage batches re-test instances against the tier distance when the camera moves and setcountto survivors.visibility/CullingProvider.tsx: resolves the policy from the terrain-quality tier and exposes it to batched draws.visibility/cullingDriver.ts: builds the grid once from placed solids with radius >= 6 m and handsisOccludedreal occluders instead of an empty list.Verification:
bun scripts/verify-fast.ts- 12 files, 19 test files, 11 gates, all passed.Before/after pair, both sides from a checkout of
origin/beta(lane-a28-baseline) and this branch, same pinned camera (--look 0,0 --look-from <dist>,<height>,2.4), default graphics tier on both sides (shoot/drivehave no tier flag; #2318 tracks it),debug_reportread in the same run as the shot:Four of eight shots are identical to the draw, so the occlusion and distance stages rejected nothing there. The two Harbor Heat shots that differ differ in both directions and share their draw counts with the noise of a live scene (traffic and NPCs move between runs), so they are not a culling effect.
Why nothing is rejected: the grid trusts only placed solids with radius >= 6 m. Harbor Heat'"'"'s downtown is generated city geometry, not placed objects, and Brightway Park'"'"'s props are all smaller, so both scenes give the grid almost no occluders.
This withdraws the earlier claim in this PR that Brightway Park dropped from ~1,330 to 628 draws (-52.8%): that compared one run against a recorded budget baseline taken with the game'"'"'s own camera, not a pair.
Pixel difference against the baseline shot, mean absolute difference / share of pixels differing by more than 8/255: brightway-park 60 m 1.06 / 3.03%, 180 m 0.04 / 0.05%, 400 m 0.05 / 0.06%, 45 m low 0.58 / 1.19%; harbor-heat 60 m 2.66 / 5.29%, 180 m 2.72 / 4.85%, 400 m 1.82 / 0.20%, 45 m low 4.55 / 13.89%. Separate browser runs of a live sim, so moving entities dominate: Harbor Heat'"'"'s 13.9% sits beside identical draw counts.
Missing: the grid'"'"'s per-frame
testMsagainst the draws it saves.occluderStats()exists on the driver but nothing surfaces it todebug_report, so there is no in-game number.Recommendation: either extend the grid to generated building chunks (the geometry that actually occludes in these games) and re-run this pair, or drop the occlusion half and keep the scatter distance half, which is correct but saved nothing at these distances because tier 400 m already covered the visible scatter.