dev-docs/RFCs/v7.2/layer-group-and-operation-rfc.md
References:
This RFC proposes a number of ideas around a new system for defining groups of layers, and letting those groups of layers render into masks. After discussion expect this to split into two or more RFCs.
Idea: Use new luma.gl support for stencil buffers to implement GPU clipping of layers against each other layers. Up to 8 independent masks (one for each "bit plane" in stencil buffer). Enable clipping of layers rendered "later" in stack, by union or intersection of a subset of masks (note limitations).
<DeckGL> <PolygonLayer id='mask-1' mask visible={false} .../> <PolygonLayer id='mask-2' invertMask .../> <ScatterplotLayer clipByUnion=['mask-1', 'mask-2']> <PathOutlineLayer clipByIntersection=['mask-1', 'mask-2'> </DeckGL>Notes:
visible=false? Render clipping mask into stencil buffer, but not render visually? (colorMask, depthMask?). Update layers even when visible=false?invertMask when creating masks.Allow loading of external masks?
// External mask example. Maybe could be handled by a really strong BitmapLayer?
If double buffering active, masks must be rendered into both buffers due to technical complications with stencil buffers. Supporting masks makes it harder to support double buffering. Double buffering use cases unclear (except for post-processing, which are separate, so no issue).
Many potential implications, need to be thought through...
One potential use case, clip against stack of layers
<DeckGL> <LayerGroup id='group-1' mask> <PolygonLayer .../> <PolygonLayer .../> </LayerGroup> <LayerGroup id='group-2' mask> <PolygonLayer .../> </LayerGroup> <ScatterplotLayer clipByUnion=['group-1', 'group-2']> <ScatterplotLayer clipByIntersection=['group-1', 'group-2'> </DeckGL>Support full range of new luma.gl postprocessing effects in deck.gl
<View postprocessing=[new FilmPass(), new OutlinePass(), new DotScreenPass(), ...]/>
Idea: Expose Layer Rendering as a "luma.gl" LayerRenderingPass so that deck.gl layers can be used in luma.gl MultiPassRenderer pipelines?
Requires making sure that deck.gl can be called in "componentized fashion".
Required effort and implications unclear.
May be a good fit for changes required for mapbox integration.