rerun icon indicating copy to clipboard operation
rerun copied to clipboard

Low-level logging APIs cannot splat

Open teh-cmc opened this issue 1 year ago • 1 comments

The following will not do what you'd expect, since it doesn't know that the main component has multiple instances:

import rerun as rr

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

rr.set_time_sequence("frame", 1)
rr.log("points", rr.Points3D([[0, 0, 0], [1, 1, 1]]))

# This will only color `point[0]`.
rr.set_time_sequence("frame", 2)
rr.log_components("points", [rr.components.ColorBatch([0xFF0000FF])])

Worse, there's no public way to explicitly indicate that we want it to splat.

The only way is to go through multiple layers of private APIs:

rr.log_components("points", [rr.components.ColorBatch([0xFF0000FF]), rr._log._splat()])

and even then, the above does not work, you need to recast it some more for some reason:

rr.log_components("points", [rr.components.ColorBatch([0xFF0000FF]), rr.components.InstanceKeyBatch(rr._log._splat())])

that works.

This would be solved by the "clamp-to-last" data model that we've talked about in Stockholm (for which I still need to write an issue at some point...).

teh-cmc avatar Jan 08 '24 18:01 teh-cmc

You can also do:

rr.log_components("points", [rr.components.ColorBatch([0xFF0000FF])], num_instances=2)

jleibs avatar Jan 08 '24 18:01 jleibs