Skip to content

fix(texture): avoid norm16 for 3D textures that cannot be linearly filtered - #3707

Open
GMrrc wants to merge 1 commit into
Kitware:masterfrom
GMrrc:fix/norm16-linear-filtering
Open

GMrrc wants to merge 1 commit into
Kitware:masterfrom
GMrrc:fix/norm16-linear-filtering

Conversation

@GMrrc

@GMrrc GMrrc commented Oct 30, 2026 •

Copy link
Copy Markdown

The volume, reslice and CPR mappers set the scalar texture filter only at render time, so the norm16 linear filtering guard never applied. Also make preferSizeOverAccuracy override norm16 as documented.

#3706

Context

Fixes #3706

On browsers that expose EXT_texture_norm16 but cannot linearly filter norm16 textures (e.g. Firefox on Windows), vtkVolumeMapper, vtkImageResliceMapper and vtkImageCPRMapper render nothing for Int16/Uint16 scalars with linear interpolation. supportsNorm16Linear() correctly returns false there, but the guard added for #3194 only applies when the texture filter is already LINEAR when the format is chosen. These mappers create the scalar texture with the default NEAREST filter and switch to LINEAR afterwards, so the texture is uploaded as norm16 and samples as 0. The texture is also cached per scalars array, so it is never rebuilt when the interpolation changes.

Separately, preferSizeOverAccuracy is documented to override norm16, but on WebGL2 it had no effect when norm16 was available.

Results

Before: on an affected browser, Int16 data with linear interpolation renders nothing (scalar texture R16_SNORM), and preferSizeOverAccuracy keeps norm16.
After: the scalar texture falls back to R32F (or half float when exact), the volume, reslice and CPR render correctly with both linear and nearest interpolation, and preferSizeOverAccuracy uses half float instead of norm16.
Browsers where norm16 linear filtering works (Chrome, Edge) are unchanged.

Changes

  • VolumeMapper, ImageResliceMapper, ImageCPRMapper (OpenGL): only use EXT_texture_norm16 for the scalar texture when supportsNorm16Linear() is true, since the filter is set at render time and the texture is shared between mappers.
  • Texture (OpenGL): preferSizeOverAccuracy now overrides norm16 with half float.
  • VolumeMapper, ImageCPRMapper (OpenGL): pass preferSizeOverAccuracy on partial updates (updatedExtents) too.
  • Tests: testNorm16LinearFiltering (volume and reslice mappers) and testPreferSizeOverAccuracy (Texture).

No API added, removed or changed.

PR Checklist

  • GitHub Actions CI passed: semantic-release commit messages, lint, and tests
  • Test coverage added
  • Documentation and TypeScript definitions are updated to match these changes (no API change)

…ltered

The volume, reslice and CPR mappers set the scalar texture filter only at
render time, so the norm16 linear filtering guard never applied. Also make
preferSizeOverAccuracy override norm16 as documented.

Kitware#3706

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant