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 greyscale colormapping being not gamma-corrected #2456

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jun 16, 2023

What

Fix colormap_srgb outputting linear greyscale map instead of srgb greyscale map.

Note how this method is documented as:
/// Returns a gamma-space sRGB in 0-1 range.
but then a few lines below outputted Vec3(t) directly, i.e. a linear scale.

This became visually apparent when you put a 3 channel image (no color map!) next to a single channel image (greyscale color map applied) next to each other.

Before:
image

After:
image

(this is not what the sample usually looks like, I made both images take the value 128, they are different by default)

Checklist

PR Build Summary: https://build.rerun.io/pr/2456

Docs preview: https://rerun.io/preview/1c35935/docs
Examples preview: https://rerun.io/preview/1c35935/examples

@Wumpf Wumpf added 🪳 bug Something isn't working 🔺 re_renderer affects re_renderer itself labels Jun 16, 2023
@Wumpf
Copy link
Member Author

Wumpf commented Jun 16, 2023

On the tensor demo:

Before:
image

After:
image

@jleibs
Copy link
Member

jleibs commented Jun 16, 2023

Before:
image
After:
image
Matplotlib:
image

@Wumpf Wumpf merged commit 8f55136 into main Jun 16, 2023
@Wumpf Wumpf deleted the andreas/fix-greyscale-colormap-srgb branch June 16, 2023 13:20
Wumpf added a commit that referenced this pull request Jun 16, 2023
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

Fix `colormap_srgb` outputting linear greyscale map instead of srgb
greyscale map.

Note how this method is documented as:
`/// Returns a gamma-space sRGB in 0-1 range.`
but then a few lines below outputted `Vec3(t)` directly, i.e. a linear
scale.

This became visually apparent when you put a 3 channel image (no color
map!) next to a single channel image (greyscale color map applied) next
to each other.

Before:
<img width="402" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/65e0feaa-2443-483b-9b6f-424e6b22c0d7">

After:
<img width="411" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/da1ba05e-7343-4700-a218-c5bb240870cb">


(this is not what the sample usually looks like, I made both images take
the value 128, they are different by default)


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2456

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/1c35935/docs
Examples preview: https://rerun.io/preview/1c35935/examples
<!-- pr-link-docs:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🔺 re_renderer affects re_renderer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants