Skip to content

feat: Initial work for MultiCOGLayer: cross-resolution tileset for sentinel/landsat - #408

Merged
kylebarron merged 22 commits into
mainfrom
kyle/plan-multi-resolution-tileset
Apr 10, 2026
Merged

kylebarron merged 22 commits into
mainfrom
kyle/plan-multi-resolution-tileset

Conversation

@kylebarron

@kylebarron kylebarron commented Apr 9, 2026 •

Copy link
Copy Markdown
Member

For #142, related to #147

Change list

  • Write out a claude-brainstormed spec and claude-brainstormed implementation plan into dev-docs
  • Write out helper documentation into gpu-modules.md from claude's brainstorming
  • Create MultiCOGLayer
  • Create CompositeBands shader module that attempts to render textures across multiple resolutions
  • Create LinearRescale shader module to rescale from a [min, max] range to [0, 1]
  • Create MultiTilesetDescriptor interface to manage multiple tilesets across the same extent but with different tile grids with different resolutions.
    • This has a primary descriptor, which is the highest-resolution source, which defines the tile grid,
    • And one or more "secondary" descriptors for other sources that don't match up with the primary tile grid.
  • Create Sentinel-2 example application that supports multiple band combinations across multiple resolutions

Future work:

image image image

kylebarron and others added 21 commits April 9, 2026 15:55
Design for rendering multi-resolution satellite bands (e.g., Sentinel-2
10m/20m/60m) in a single shader pass. Primary tileset drives traversal,
secondary tiles are fetched/stitched with UV transforms for GPU-side
resampling. No CPU resampling needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
6-task plan covering MultiTilesetDescriptor, secondary tile resolver,
CompositeBands GPU module, MultiCOGLayer init/fetch/render, and
integration smoke test.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… add Sentinel-2 test

- Tech stack: @developmentseed/geotiff (not geotiff.js)
- Move multi-tileset files to src/multi-raster-tileset/ directory
- Task 6 now uses real Sentinel-2 TileMatrixSet fixture from geozarr

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Introduces MultiTilesetDescriptor, createMultiTilesetDescriptor,
selectSecondaryLevel, and tilesetLevelsEqual to support multi-resolution
tileset composition for datasets like Sentinel-2 with mixed band resolutions.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Default "closest-finer" prefers the coarsest level that's still finer
than the primary, avoiding unnecessary blur. "closest" picks by smallest
absolute mpp difference for bandwidth optimization.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Implements resolveSecondaryTiles() which finds which secondary tileset
tiles cover a primary tile's CRS extent and computes the [offsetX,
offsetY, scaleX, scaleY] UV transform for shader use.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ution

z (zoom/overview level) is the same for all tiles in a resolution, so it
belongs on the resolution result, not repeated per tile index.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Creates a factory function that builds a luma.gl shader module composing
N named single-band textures into a vec4 output. Each band carries its own
UV transform uniform so the GPU handles resolution-alignment automatically.
Returns a concrete CompositeBandsModule type so callers need no casts.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Introduces MultiCOGLayer, a CompositeLayer that opens multiple COGs in
parallel, builds TilesetDescriptors via TileMatrixSetAdaptor, and groups
them into a MultiTilesetDescriptor. Tile fetching and rendering will be
added in a subsequent task.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Wire up the full pipeline:
- _getTileData: fetches primary + secondary tiles in parallel
- _fetchPrimaryBand: direct fetch with identity UV transform
- _fetchSecondaryBand: uses fetchTiles + assembleTiles for proper
  typed-array-preserving stitching (no Uint8Array casts)
- _renderSubLayers: CompositeBands module binds all band textures
- renderTileLayer: TileLayer with PrimaryTilesetFactory from primary grid

Helper functions selectImage and createBandTexture extracted for clarity.
Texture format is hardcoded to r8unorm for initial implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Visual example using MultiCOGLayer with individual Sentinel-2 band COGs.
Includes presets for true color, false color NIR, SWIR composite, and
vegetation — demonstrating cross-resolution rendering (10m + 20m bands).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sentinel-2 L2A bands are uint16. Infer texture format from the typed
array type: Uint8Array -> r8unorm, Uint16Array -> r16unorm.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
WebGL's UNPACK_ALIGNMENT requires each row to start on a 4-byte
boundary. For 16-bit single-channel data with odd widths, rows are
only 2-byte aligned. Use enforceAlignment (exported from
render-pipeline.ts) to pad rows before texture upload.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Major changes:
- CompositeBands: rewritten as static ShaderModule with 4 fixed sampler
  slots, uniform block for scalars (uvTransforms, channelMap), and
  buildCompositeBandsProps helper for mapping named bands to slots.
  Follows luma.gl pattern: textures via inject, scalars via fs uniform
  block + uniformTypes.
- LinearRescale: new GPU module for [min,max] -> [0,1] color rescaling,
  using uniform block pattern for proper uniform binding.
- RasterModule type widened to accept uniform values (vectors) alongside
  textures.
- Sentinel-2 example app with true color and false color presets.
- enforceAlignment exported from render-pipeline.ts for reuse.
- Documentation: gpu-modules.md (luma.gl binding rules),
  multi-resolution-status.md (current status and known issues).

Known issues: multi-resolution alignment (20m bands), tile cache
invalidation on preset switch, texture format limited to uint8/uint16.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
GPU modules (CompositeBands, LinearRescale, buildCompositeBandsProps)
should only be imported from @developmentseed/deck.gl-raster/gpu-modules,
not from the main package entry point.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@kylebarron kylebarron changed the title Kyle/plan multi resolution tileset feat: Initial work for MultiCOGLayer: cross-resolution tileset for sentinel/landsat Apr 10, 2026
@kylebarron
kylebarron marked this pull request as ready for review April 10, 2026 16:05
@github-actions github-actions Bot added the feat label Apr 10, 2026
@kylebarron
kylebarron merged commit 72ca8ae into main Apr 10, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/plan-multi-resolution-tileset branch April 10, 2026 16:09
@ds-release-bot ds-release-bot Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant