raster fixes + cheap opts #40

Merged
embeddedt merged 4 commits from rdh/celeritas:raster-3 into stonecutter 2026-09-05 16:55:36 -04:00
Collaborator

fixes

  • cccluder bounds are block cells, so a model reaching outside its cell could be culled while still on screen. the frustum test already allows a 1-block model extent, but the rasterizer's one-pixel test dilation doesn't substitute for that. margin is now folded into the bounds at build time, clamped to inside the section, which costs very little cull rate. sections running a mesh appender take the whole section.
  • a section awaiting a remesh was tested against its last built mesh's bounds. VisibleChunkCollector only schedules rebuilds for visible sections, so one whose stale bounds tested hidden while its section box was clear was never rebuilt, and kept testing the same stale bounds. now falls back to the section box until the new mesh is put.

optimizations

  • BoxFinder returns once the section pass has consumed every voxel; the passes that follow emit nothing on empty input.
  • the camera section is visited inline and never reached rasterTest, so its walls never entered the coverage buffer. Now drawn after scene prep, before the queue.

numbers from rasterCullRerport

world / camera before after
SURFACE surface 10 915 (−21.3%) 10 922 (−21.3%)
SURFACE treetop 12 262 (−20.6%) 12 268 (−20.5%)
CAVES surface 10 (−99.5%) 7 (−99.6%)
CAVES high 384 (−65.8%) 384 (−65.8%)

BoxFinderBench.findBoxes:

  • SURFACE 82.04 ± 0.68 → 79.39 ± 0.36 µs/op
  • CAVES 70.54 ± 1.51 → 66.75 ± 0.58.

rasterStats SURFACE frametime still at ~0.99 ms

## fixes - cccluder bounds are block cells, so a model reaching outside its cell could be culled while still on screen. the frustum test already allows a 1-block model extent, but the rasterizer's one-pixel test dilation doesn't substitute for that. margin is now folded into the bounds at build time, clamped to inside the section, which costs very little cull rate. sections running a mesh appender take the whole section. - a section awaiting a remesh was tested against its last built mesh's bounds. `VisibleChunkCollector` only schedules rebuilds for visible sections, so one whose stale bounds tested hidden while its section box was clear was never rebuilt, and kept testing the same stale bounds. now falls back to the section box until the new mesh is put. ## optimizations - `BoxFinder` returns once the section pass has consumed every voxel; the passes that follow emit nothing on empty input. - the camera section is visited inline and never reached `rasterTest`, so its walls never entered the coverage buffer. Now drawn after scene prep, before the queue. ## numbers from `rasterCullRerport` | world / camera | before | after | |---|---|---| | SURFACE surface | 10 915 (−21.3%) | 10 922 (−21.3%) | | SURFACE treetop | 12 262 (−20.6%) | 12 268 (−20.5%) | | CAVES surface | 10 (−99.5%) | 7 (−99.6%) | | CAVES high | 384 (−65.8%) | 384 (−65.8%) | `BoxFinderBench.findBoxes`: - SURFACE 82.04 ± 0.68 → 79.39 ± 0.36 µs/op - CAVES 70.54 ± 1.51 → 66.75 ± 0.58. `rasterStats` SURFACE frametime still at ~0.99 ms
rdh added 1 commit 2026-09-05 16:12:33 -04:00
rdh added 3 commits 2026-09-05 16:51:30 -04:00
rdh force-pushed raster-3 from ae37aa9959 to 32bda10337 2026-09-05 16:51:30 -04:00 Compare
embeddedt approved these changes 2026-09-05 16:54:20 -04:00
embeddedt merged commit 261f9f6854 into stonecutter 2026-09-05 16:55:36 -04:00
embeddedt deleted branch raster-3 2026-09-05 16:55:36 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: embeddedt/celeritas#40