Repository navigation
feat(geo-layers): pace tile creation without losing fallback coverage - #10784
charlieforward9 wants to merge 12 commits into
Conversation
c28bc7c to
27f1336
Compare
[Medium impact] The changes affect Tile3D rendering and picking across Deck applications. Fix the missing follow-up redraw before merging so stencil coverage reliably resumes after post-processing is removed. Findings
SummaryThis PR spreads scenegraph creation across frames and adds optional stencil coverage for replacement tiles.
|
27f1336 to
efdd8a8
Compare
…e-pacing # Conflicts: # docs/whats-new.md # test/modules/core/lib/deck.spec.ts
With `_refinementStencil` enabled, every selected tile was drawn in postorder, so additive parents moved after their children even though additive refinement receives no stencil coverage. Where an additive parent and child were coplanar, the reordered parent then won the depth tie and covered the finer child. Only replacement parents with selected children now draw after the descendants that mask them. Additive parents keep their coarse-to-fine order, and selections without any replacement keep the original draw order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Coverage treated a tile as opaque when its glTF material JSON lacked BLEND and its layer opacity was 1. Models supplied by a custom `getScene`, glTF transmission materials, and layer `parameters` that enable blending could still write coverage, so their translucent pixels hid the parent behind them. Scenegraph sublayers now record whether their created models enable blending before WebGL draws replace model parameters, and also check layer blend parameters. Such selections keep ordinary depth testing in their original order. When models created after the draw plan turn out to be blended, the layer drops the stale plan on its first draw and asks the Tile3DLayer to rebuild it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picking framebuffers always attach stencil, so `_refinementStencil` masked parents while picking even when the color pass fell back to depth testing because the canvas or a post-processing target had no stencil. Clicks could then hit a replacement child that the screen still showed behind its parent. Coverage now records whether the latest color pass could apply it, and the picking pass applies coverage only in that case. The coverage test now also picks with a stencil-less color target. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1d2f762. Configure here.
…ot mask With `_refinementStencil` enabled, the coverage plan drew replacement parents after their children before any draw knew whether masking could run. On WebGPU or WebGL targets without stencil, draws then skipped masking but kept the reversed order, so coplanar parents with `depthCompare: 'less-equal'` covered children that win when the option is disabled. Sublayers now keep their original order unless color targets can mask. The plan starts from the device and canvas stencil, and color passes report their target: a reordered list replans in the original order as soon as a target cannot mask, and a deferred plan reorders once targets can. A masking pass directly after an unmasked one does not count, so frames that mix targets do not alternate. Shadow map passes are ignored, and picking masks only when the list was reordered for color. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`isOpaque` inspected glTF materials only for the `BLEND` alpha mode, while luma.gl also blends `KHR_materials_transmission` materials. Created models record that blending, but the coverage plan runs before models exist and before deferred creation completes, and custom `getScene` models may not carry material parameters. Transmissive children could therefore be planned as opaque and mask the parent behind them. Materials with a positive transmission factor or a transmission texture now count as blended, matching luma.gl and the `_refinementStencil` docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| this.colorMasking = canMask && !this.sawUnmaskedTarget; | ||
| this.sawUnmaskedTarget = !canMask; | ||
| // Replan when the draw order no longer matches: a reordered list that cannot be masked | ||
| // lets coplanar parents cover their children, and an unordered list cannot mask. | ||
| if (this.planned && this.colorMasking !== this.entries.size > 0) this.replan(layer); |
There was a problem hiding this comment.
Stencil coverage stays disabled
Removing a post-processing effect can leave raised parents hiding finished children. The old target leaves sawUnmaskedTarget true, so the first draw back to a stencil canvas keeps colorMasking false and clears sawUnmaskedTarget. Because the draw order already matches that false value, this check requests no further update. An idle Deck then stops drawing before coverage can resume.
Request another redraw when this check needs a second masked pass. The target-switch test forces three frames, which hides this case.
|
Closing in favor of two smaller PRs: #11150 fixes ScenegraphLayer's first-draw signal so loaders.gl keeps fallback parents until their replacement has drawn, and #11151 adds opt-in |

Follow up of visgl/loaders.gl#4090 (skip-LOD refinement, already on master via
@loaders.gl/tiles5.0.0-alpha.11).Tile3DLayercreates GPU resources for every arriving scenegraph tile within the frame, so bursts of tiles stall interaction. When a coarse replacement parent is drawn above its children, depth testing also hides detail that has already loaded.Change List
Tile3DLayer: opt-in_maxTileProcessingTimeper-frame budget for scenegraph creation_refinementStencilfor opaque WebGL scenegraphs: drawn descendants mask only their own replacement ancestorsBLENDorKHR_materials_transmission, or the color target has no stencil (always on WebGPU)DeckPicker: picking framebuffers usedepth24plus-stencil8, so picking matches what is drawnScenegraphLayer: draw options for refinement coveragecleared-recording-github.mp4
Left: the previous candidate. Right: this PR with the loaders.gl changes (capture details). This is not a cold-load or smoothness benchmark.
Questions
DeckPickernow allocatesdepth24plus-stencil8for everyDeck, not only when a layer sets_refinementStencil: twice the picking depth memory ofdepth16unorm, with higher precision. Is that acceptable, or should stencil be allocated only on request?TODO