Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata picking does not properly handle offset and scale #12236

Closed
javagl opened this issue Oct 6, 2024 · 1 comment
Closed

Metadata picking does not properly handle offset and scale #12236

javagl opened this issue Oct 6, 2024 · 1 comment

Comments

@javagl
Copy link
Contributor

javagl commented Oct 6, 2024

Basic support for picking metadata (from property textures) was added in #12075. Most of the tests happened based on the SimplePropertyTexture sample and the examples that are generated on the fly, in the specs. These do not cover the different combinations of offset/scale values that may be defined as part of the 'class property' or based on the 'property texture property' (overriding the one from the 'class property'). This can lead to wrong metadata values to be reported (as noticed in a PR that is supposed to use this new functionality).

An atttempt to summarize the approach and highlight the problem:

  • Values from property textures are converted into "metadata values" as part of the standard metadata handling in the shaders. For example, a "raw" value of 127 that is stored in the texture as a 'normalized UINT8' will be converted into the value ~0.5.
  • The picking writes these values into "colors/color components", which are then written into the metadata picking frame buffer (ending up as values in [0, 256) there)
  • These values are read from the frame buffer, and converted back into the proper "metadata values"

There is quite a lot of back-and-forth conversion going on, depending on the component type, the normalization, and whether the values include an 'offset' or 'scale'. And the latter is not properly taken into account. This means that a normalized UINT8 metadata value like 127 with offset=1.0 and scale=2.0 that should be 1.0 + 2.0 * ~0.5 = 2.0 was clamped to 255 in the output, and therefore, converted back to 1.0 instead of 2.0.

@javagl
Copy link
Contributor Author

javagl commented Nov 28, 2024

This was fixed as part of #12237

@javagl javagl closed this as completed Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant