Skip to content

Conversation

@phapalova
Copy link
Contributor

@phapalova phapalova commented Nov 14, 2025

Viewer function for adding and updating the 2D image:

import fvdb

fvdb.viz.init(ip_address="127.0.0.1", port=8080)
scene = fvdb.viz.Scene("My Scene")

width, height = 512, 512
image_data = torch.zeros((height, width, 4), dtype=torch.uint8

for j in range(height):
    for i in range(width):
        image_data[j, i, 0] = (255 * i) // (width - 1)  # R
        image_data[j, i, 1] = (255 * j) // (height - 1)  # G
        image_data[j, i, 2] = 0  # B
        image_data[j, i, 3] = 255  # A

image_view = scene.add_image(
    name="test_image",
    rgba_image=image_data.flatten(),
    width=width,
    height=height,
)
fvdb.viz.show()
fvdb.viz.wait_for_interrupt()
...
image_view.update(new_image_data)

wait_for_interrupt() replaces the time.sleep(10000) which was needed to keep the main thread running so the viewer is not destroyed.

image

Signed-off-by: Petra Hapalova <[email protected]>
Signed-off-by: Petra Hapalova <[email protected]>
Signed-off-by: Petra Hapalova <[email protected]>
@phapalova phapalova marked this pull request as ready for review November 17, 2025 00:30
@phapalova phapalova requested a review from a team as a code owner November 17, 2025 00:30
@phapalova phapalova requested review from sifakis and swahtz November 17, 2025 00:30
Copy link
Contributor

@areidmeyer areidmeyer left a comment

Choose a reason for hiding this comment

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

Looks good to me.
One question/request. Have we exposed add_nanovdb() itself properly yet?
Jonathan did say we now had a customer ask for it.
If not, probably should be another PR anyways, since in practice we probably have to make it all work nicely with GridBatch.

@phapalova phapalova enabled auto-merge (squash) November 18, 2025 13:46
@phapalova phapalova merged commit b604e84 into openvdb:main Nov 18, 2025
32 checks passed
@phapalova phapalova deleted the phapalova/viewer-update-bindings branch November 18, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants