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

Color mapping fails for some class-ids values #1968

Closed
jleibs opened this issue Apr 25, 2023 · 0 comments
Closed

Color mapping fails for some class-ids values #1968

jleibs opened this issue Apr 25, 2023 · 0 comments
Labels
🔺 re_renderer affects re_renderer itself 🦟 regression A thing that used to work in an earlier release

Comments

@jleibs
Copy link
Member

jleibs commented Apr 25, 2023

For certain values of class-id such as "3" we end up showing the color for the previous class.

Minimal repro:

import numpy as np
import rerun as rr

rr.init("seg_fail", spawn=True)

rr.log_annotation_context(
    "seg_fail",
    [(1, "red", (255, 0, 0)), (2, "green", (0, 255, 0)), (3, "blue", (0, 0, 255)), (4, "yellow", (255, 255, 0))],
)

segmentation_img = np.zeros([128, 128], dtype="uint8")
segmentation_img[10:20, 10:118] = 1
segmentation_img[30:40, 10:118] = 2
segmentation_img[50:60, 10:118] = 3
segmentation_img[70:80, 10:118] = 4
rr.log_segmentation_image("seg_fail/img", segmentation_img)

Output:
image

A bit of investigation hints at this being somehow related to inappropriate application of gamma:

if I modify the value normalization:
https://github.com/rerun-io/rerun/blob/main/crates/re_renderer/shader/rectangle_fs.wgsl#L76

To force a gamma of 1.0:

normalized_value = vec4(pow(normalized_value.rgb, vec3(1.0)), normalized_value.a); // TODO(emilk): handle premultiplied alpha

Then everything works.

However, as far as I can tell we are passing gamma of 1.0 for these class-id mappings, so it seems like something is going wrong in the way the uniform is being mapped?

@jleibs jleibs added 🔺 re_renderer affects re_renderer itself 🦟 regression A thing that used to work in an earlier release labels Apr 25, 2023
@emilk emilk closed this as completed May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔺 re_renderer affects re_renderer itself 🦟 regression A thing that used to work in an earlier release
Projects
None yet
Development

No branches or pull requests

2 participants