Repository navigation
feat(deck.gl-geotiff): add a resampling prop to MultiCOGLayer - #775
Merged
Merged
Conversation
MultiCOGLayer creates its band textures itself, with a hardcoded linear sampler, and offers no way to change it. Linear filtering defeats an exact-match nodata filter: pixels next to nodata blend with the nodata value, no longer match it, and draw as a rim. `resampling: "linear" | "nearest"` (default "linear") picks the filter. It is applied when each tile is rendered, not when its textures are created, so changing it updates tiles that are already loaded without fetching them again. Based on #640 by @willjnz. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: William Jones <[email protected]>
Lets the example switch MultiCOGLayer between linear and nearest resampling, which shows both the smooth and the sharp-pixel view and the rim that linear filtering draws at the scene's nodata edge. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since #773, createBandTexture gives a band nearest filtering when the device can't filter its format, such as a 16-bit band uploaded as r32float without float32-filterable. Applying `resampling: "linear"` at render time switched those textures back to linear, which leaves them incomplete, so they read as 0. Check `isFilterable` there too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
added a commit
that referenced
this pull request
Oct 22, 2026
…COGLayer (experimental) (#777) > [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. `MultiCOGLayer` only uploaded `Uint8Array` and `Uint16Array` bands, so a source with any other sample type, such as Int16 or Float32, threw `Unsupported typed array type` on every tile. Signed integers, `uint32` and floats now upload as `r32float`, converted to `Float32Array` where needed, so the shader reads raw sample values. Integer texture formats would need an integer sampler, which `CompositeBands`' `sampler2D` can't read. Integers past 2^24 and `Float64Array` samples round to float32. These bands sample nearest where the device can't filter float32 textures: `createBandTexture` and the `resampling` prop from #775 both check with `isFilterable` from #773. luma.gl's `isTextureFormatFilterable` reports `r32float` as filterable on every WebGL2 device. A linear sampler without `OES_texture_float_linear` leaves the texture incomplete, so the scene draws black. `uint8` and `uint16` bands still reach the render pipeline normalized to 0-1, while every other type keeps its raw value. The `renderPipeline` docs now say so, since nodata values and rescale ranges depend on it. They also mark the other types as experimental: that split is likely to change so that every type arrives in the same units. The tile cache counts the float32 bytes uploaded, which for Int16 is twice the source size. Thanks to @earlybard for #650, which this finishes. His two commits are kept, followed by merges of main (resolved onto #773's `createBandTexture`) and docs commits. Checked in Chrome 155 on macOS with the Int16 scene from #650 (Digital Earth Australia Sentinel-2 ARD, nodata -999): - main: nothing draws, and every tile throws `Unsupported typed array type: Int16Array`. - This branch: the scene draws, and its nodata area is transparent. - This branch with `OES_texture_float_linear` hidden: the scene draws, sampling nearest. #650's own fallback drew it black. - The Sentinel-2 example's `uint16` scene is unchanged. Closes #650 🤖 Written by [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Dylan Jenkins <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: linear, the default and main's only behavior
After: nearest

Note
This PR was written by Claude (Claude Code), not by @kylebarron.
MultiCOGLayercreates its band textures itself and always filters them linearly, with no way to change it. This addsresampling?: "linear" | "nearest", defaulting to"linear"(today's behavior).Nearest shows the data's own pixels. It also matters with an exact-match nodata filter such as
FilterNoDataVal: linear filtering blends the nodata value into the pixels next to it, so they no longer match it and draw as a rim around nodata areas.The filter is applied each time a tile is rendered, not only when its textures are created. luma.gl stores the filter on each texture, and
renderTileruns for every loaded tile whenever the layer's props change, so switchingresamplingupdates loaded tiles without fetching them again. A band whose format the device can't filter, such as a 16-bit band stored asr32floaton a device withoutfloat32-filterable(#773), stays nearest either way.The Sentinel-2 example gets a Resampling selector.
This replaces #640's
bandSampler: SamplerPropswith a smaller API. Thanks to @willjnz for the original PR, and to @earlybard for the nodata case.Closes #640
Ref #215
🤖 Written by Claude Code