Keep Only What the Camera's Side Can See in the Layers Skipped at Rest

With the shell at rest and layers merged, the skipped layers kept every segment
exposed to the layer next to it. On the tall fixture that was 25000 wipe tower
segments over its whole height: wherever the tower's footprint edge lands one
grid cell differently from one layer to the next, the cell reads as uncovered,
though hundreds of layers sit on top. The same test also kept whatever lies
under an overhang.

The classification now records the highest and lowest layer occupying each
cell over the whole print, in the pass that already rasterizes the layers, and
a segment is visible from above when its layer is the topmost occupant of at
least half its cells, and from below likewise with the bottommost. A skipped
layer at rest keeps only the segments visible from the side the camera is on,
which the viewer is told along with the stride. The exposed bit stays for the
dragging set, which is not rebuilt with the camera.

On the tall fixture with the shell at rest, against 334 ms at full detail:

  default view    17679 segments   18 ms   (was 37585 / 85 ms)
  from above       7935 segments    7 ms   (was 28682 / 58 ms)

The two-cube fixture still keeps every facing wall, and the classification
stays at 90 ms for 636 layers with the maps merged over each worker's touched
rectangle only.
This commit is contained in:
Hanif Koh
2026-09-11 13:10:09 +08:00
parent f2143d3c91
commit 63d00f7cf1
6 changed files with 127 additions and 4 deletions
+1
View File
@@ -1954,6 +1954,7 @@ void GCodeViewer::update_rest_layer_stride()
const unsigned int stride = (layer_px * MAX_STRIDE <= MERGE_BELOW_PX) ? MAX_STRIDE :
std::clamp(static_cast<unsigned int>(MERGE_BELOW_PX / layer_px), 1u, MAX_STRIDE);
m_viewer.set_rest_layer_stride(stride);
m_viewer.set_rest_view_from_above(camera.get_dir_forward().z() < 0.0);
}
// ORCA: libvgcode only builds a reduced set while its mode is not Off, so the preference switch is