Skip to content

fix(mapper.js): fix color texture coordinate mapping when using logarithmic scale#3250

Merged
floryst merged 1 commit intoKitware:masterfrom
Quanscient-Public:bugfix/log-texture-mapping
May 16, 2025
Merged

fix(mapper.js): fix color texture coordinate mapping when using logarithmic scale#3250
floryst merged 1 commit intoKitware:masterfrom
Quanscient-Public:bugfix/log-texture-mapping

Conversation

@Antti-Palola
Copy link
Contributor

@Antti-Palola Antti-Palola commented May 2, 2025

Scalars array was already mapped with log scaling but texture coordinates were incorrectly mapped using the linear range and value. Log color mapping was working if scalar interpolation was off when scalars were not directly mapped to textures.

Also added some missing types to ColorTransferFunction.

Context

Results

In the following screenshots the first rectangle has point values of 1 everywhere, second has 100 and the last 1000.

Linear Log before Log after
Screenshot 2025-05-02 at 11 02 06 Screenshot 2025-05-02 at 11 07 54 Screenshot 2025-05-02 at 11 02 24

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js: master (33.0.1)
    • OS: MacOS 15.4.
    • Browser: Latest Chrome, Firefox and Safari

The scalar bar actor example doesn't really work at all with interpolated values (because of the geometry?) but the rim of the cone can be seen barely to see the change.

Before After
Screenshot 2025-05-02 at 12 01 07 Screenshot 2025-05-02 at 12 00 38

…ithmic scale

Scalars array was already mapped with log scaling but texture coordinates were incorrectly mapped
using the linear range and value. Log color mapping was working if scalar interpolation was off when
scalars were not directly mapped to textures.

Also added some missing types to ColorTransferFunction.
@Antti-Palola Antti-Palola mentioned this pull request May 2, 2025
5 tasks
@Antti-Palola
Copy link
Contributor Author

@floryst Do you have time to check this out?

@floryst floryst added this pull request to the merge queue May 16, 2025
Merged via the queue into Kitware:master with commit 7a330c0 May 16, 2025
2 checks passed
@github-actions
Copy link

🎉 This PR is included in version 33.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Automated label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants