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

Fix noise issue that appears in certain image textures #578

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Mar 1, 2024

🦟 Bug fix

Summary

The issue is that if a pixel's color value in 8 bit format is close 1 (out of 255), when assigned to math::Color, math::Color::Clamp assumes it to be in the floating point range [0.0 - 1.0] instead of 8 bit unsigned range of [0 - 255]. The fix here is to convert colors to floating point at the source instead of relying on Color::Clamp.

Reference glTF file: Damaged helmet

Before

Screenshot 2024-03-01 17 12 39

After

Screenshot 2024-03-01 17 11 08

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

The issue is that if a pixel's color value in 8 bit format is close
1 (out of 255), when assigned to `math::Color`, `math::Color::Clamp`
assumes it to be in the floating point range [0.0 - 1.0] instead of
8 bit unsigned range of [0 - 255]. The fix here is to convert colors
to floating point at the source instead of relying on `Color::Clamp`.

Signed-off-by: Addisu Z. Taddese <[email protected]>
@azeey azeey requested a review from marcoag as a code owner March 1, 2024 23:21
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Mar 1, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.65%. Comparing base (3374a3b) to head (9763548).

Additional details and impacted files
@@             Coverage Diff             @@
##           gz-common5     #578   +/-   ##
===========================================
  Coverage       83.65%   83.65%           
===========================================
  Files              92       92           
  Lines           10285    10287    +2     
===========================================
+ Hits             8604     8606    +2     
  Misses           1681     1681           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch, I remember running into the same issue before and worked around it. We should probably change the way math::Color::Clamp works in main

@ahcorde ahcorde merged commit 3571cb4 into gazebosim:gz-common5 Mar 4, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants