Support for more component types in metadata textures
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
**Current state**:
For the structural metadata extension, texels can encode metadata via property textures. Currently, the only supported metadata property type is `UINT8`. A texture can encode a (fixed-size) array of uints (interpreted in the shader as `ivecN`), or normalized uints (interpreted as floats), but it cannot use multiple channels to represent higher-precision numbers.
**Desired state:**
Represent higher precision ints and floats (up to 32 bits - using all 4 channels of each texel), as well as bools and smaller fixed-size arrays of higher precision (e.g. ivec2 with half-precision). Strings and dynamic arrays will not be supported still.
The underlying texture will still be RGB(A)8 format, but the data from each channel will be bit-shifted to form a higher precision format.
Some misc. notes:
- The structural metadata spec states:
> For unsigned integer component types, values are normalized between `[0.0, 1.0]`. For signed integer component types, values are normalized between `[-1.0, 1.0]`
Currently, since we only support the `UINT8` component type, [we only consider the first case](https://github.com/CesiumGS/cesium/blob/9e1f70201baa7f1190fa5b2a28c418e6389899f4/packages/engine/Source/Scene/PropertyTextureProperty.js#L273-L286) here. We'll need to also consider normalized signed integer types going forward.
- webgl 1 does not support uint types in glsl
Contributor guide
Research direction
Start with packages/engine/Source/Scene/PropertyTextureProperty.js, especially the linked normalization logic, and review how structural metadata property textures currently handle UINT8 values. Define support for higher-precision integers and floats, bools, and smaller fixed-size arrays while preserving the RGB(A)8 texture representation; done means signed normalization and WebGL 1 limitations are handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100