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

LineStrips3D ignores color if num_strips divisible by four or equals three #8035

Closed
eskjorg opened this issue Nov 7, 2024 · 5 comments · Fixed by #8054
Closed

LineStrips3D ignores color if num_strips divisible by four or equals three #8035

eskjorg opened this issue Nov 7, 2024 · 5 comments · Fixed by #8054
Assignees
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API

Comments

@eskjorg
Copy link

eskjorg commented Nov 7, 2024

Describe the bug
rr.LineStrips3D(strips, colors) ignores the colors argument and makes all lines white if len(strips) % 4 = 0 or len(strips) == 3.

To Reproduce

strips = [[[0, 0, 0], [0, 0, 1]]]
colors = [0x00FF00FF] # green
for n in range(30):
    rr.log(
        "linestrips3d", rr.LineStrips3D(strips=n * strips, colors=n * colors)
    )

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.1

Rerun version
Local client: rerun-cli 0.18.2 [rustc 1.76.0 (07dca489a 2024-02-04), LLVM 17.0.6] aarch64-apple-darwin release-0.18.2 59ff15b, built 2024-08-29T13:55:42Z

@eskjorg eskjorg added 👀 needs triage This issue needs to be triaged by the Rerun team 🪳 bug Something isn't working labels Nov 7, 2024
@Wumpf
Copy link
Member

Wumpf commented Nov 7, 2024

wow. that's.. impressive Oo. Thank you so much for filing!

Repros cleanly on main. It's an SDK issue given that the data doesn't get through. Given how language dependent our serialization is, I strongly suspect it's a Python SDK only issue.

Bad frame:
image
Good frame:
image

(edit: mixed up good/bad)

@Wumpf Wumpf added 🐍 Python API Python logging API and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Nov 7, 2024
@Wumpf Wumpf added this to the 0.20 - Maps, H.264, Undo milestone Nov 7, 2024
@Wumpf Wumpf changed the title LineStrips3D ignores color if num_strips divisible by four or equals tree LineStrips3D ignores color if num_strips divisible by four or equals three Nov 7, 2024
@eskjorg
Copy link
Author

eskjorg commented Nov 7, 2024

wow. that's.. impressive Oo. Thank you so much for filing!

Repros cleanly on main. It's an SDK issue given that the data doesn't get through. Given how language dependent our serialization is, I strongly suspect it's a Python SDK only issue.

Good frame: ...
Bad frame: ...

Thanks @Wumpf for jumping on this fast!

Also, I think you mixed up "good" and "bad" there.

@jleibs
Copy link
Member

jleibs commented Nov 7, 2024

This is a bug in rgba32_ext.py. Confirmed it affects other primitives such as Points3D.

In short, the python API is trying to be way too clever with precedence of multi-representation of colors combined with our lazy batch-conversion.

Concretely consider we support:

  • color = int (0x00ff00)
  • color = [int] ([0, 255, 0] or [0, 255, 0, 255])
  • colors = [color1, color2, color3, color4] ([0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00], ...)
  • colors = color ([0, 255, 0, 255], ...)

It's clear there's an ambiguity between an array of colors represented as ints, and a single RGBA represented as an array.

@jleibs
Copy link
Member

jleibs commented Nov 7, 2024

fwiw, we actually try to handle this ambiguity here, but you need to be explicit about your types.
https://github.com/rerun-io/rerun/blob/jleibs/rrdp_wheels/rerun_py/rerun_sdk/rerun/datatypes/rgba32_ext.py#L76

Confirmed this works around the issue:

import rerun as rr
import numpy as np

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

point = [[0, 0, 0]]
colors = [0x00FF00FF]  # green


for n in range(30):
    colors = np.array(n * colors, dtype=np.uint32)
    rr.log("points3d", rr.Points3D(positions=n * point, colors=colors))

@eskjorg
Copy link
Author

eskjorg commented Nov 7, 2024

Thanks @jleibs for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants