Rework texture formats so shaders read every data type in the same units
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- data-visualization
Research direction
Start with createBandTexture in packages/deck.gl-geotiff/src/multi-cog-layer.ts, inferRenderPipeline and FORMAT_TABLE in the GeoTIFF package, then follow the sampling and nodata modules. Compare the three options in the issue and trace how each data type reaches shader code. Done means one documented unit convention works for every data type, including signed integers and floats, across the affected pipelines.
Written by the indexing model from the issue text.
Description
[!NOTE]
This issue was written by Claude (Claude Code), not by @kylebarron.
The units a shader reads a sample in depend on the raster's data type, and COGLayer's default pipeline renders only unsigned integers. This tracks reworking texture formats so that every data type reaches the shaders in the same units, and COGLayer can render signed integers and floats.
Today
MultiCOGLayer (createBandTexture):
uint8anduint16upload asr8unormandr16unorm, so shaders read 0-1. WithoutEXT_texture_norm16, as in Firefox,uint16goes tor32floatdivided by 65535, and stays 0-1 (#773).- Every other type uploads as
r32floatwith raw values (#777). TherenderPipelinedocs mark these types as experimental, with units "likely to change".
COGLayer's default pipeline (inferRenderPipeline) handles only unsigned integers, and throws for signed integers and floats. The format table it uses (inferScalarKind, FORMAT_TABLE):
- maps every unsigned type to a
unormformat, so shaders read 0-1. There's no 32-bitunormformat, souint32throws. - maps signed integers to integer formats such as
r16sint.CreateTexturesamples with asampler2D, which can't read integer textures. - maps floats to
r32float, with raw values. - has
uintentries, such asr8uint, that no input reaches.
The shader modules inherit the mix:
- COGLayer scales nodata into 0-1 before
FilterNoDataVal. For raw data, the same module takes the raw value. LinearRescale's docs tell Sentinel-2 users to rescale 0-0.15 for reflectance 0-10000, because ofr16unorm.- So a pipeline written for one data type gives wrong results for another, without an error.
The Zarr examples upload their own textures, as r32float with raw values.
Options
- Raw values for every data type (my pick). Shaders always read the data's own values, so nodata values, rescale ranges and filters are given in the data's units.
- Storage can stay compact.
uint8anduint16can stay inr8unormandr16unorm, with the sampling module multiplying by 255 or 65535 to get the values back. Those formats can also be linearly filtered everywhere, whichr32floatneedsfloat32-filterablefor. - Signed integers and
uint32go tor32float, as MultiCOGLayer does today. #773's fallback would upload raw floats. - Breaking: the ranges in every
uint8anduint16pipeline change, so this should land before 1.0.
- Storage can stay compact.
- Normalized integers, raw floats, as today, but complete: signed integers as
snorm(-1 to 1), or shifted into 0-1, as #180 did with a snorm-to-unorm module. Unsigned pipelines don't change, but floats and integers still differ, and the units of integer data depend on its bit width. - Keep today's rules and document them, and add signed integers and floats to COGLayer's default pipeline only.
Related: #160 (nodata precision for floats), #772 (per-band uploads in COGLayer).
🤖 Written by Claude Code
- Dominant language
- TypeScript
- Stars
- 240
- Forks
- 34
- Avg merge
- 17h 24m
- Merged PRs (30d)
- 62
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/deck.gl-raster
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
developmentseed/deck.gl-raster#589 ·
Maintainers usually reply within 1 day
-
zarr
Difficulty 3/5 1-2 days Newbie friendliness 45/100
developmentseed/deck.gl-raster#889 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
developmentseed/deck.gl-raster#879 ·
Maintainers usually reply within 1 day
-
Zooming in shows a checkerboard of placeholder tiles when overview tiles are smaller than full-resolution tilesPossibly taken @kylebarron claimed this 16 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
developmentseed/deck.gl-raster#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
developmentseed/deck.gl-raster#866 ·
Maintainers usually reply within 1 day
All issues in developmentseed/deck.gl-raster
Similar issues
-
Add Alice&BotOpen
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
midnightntwrk/midnight-faucet-api#215 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NanmiCoder/cc-haha#2034 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
MoonshotAI/kimi-code#5539 ·
Maintainers usually reply within 1 day
-
mobile prio:low
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
digitalfabrik/entitlementcard#3324 ·
Maintainers usually reply within 2 days