Closed JintaoLee-Roger closed 6 days ago
Hi @JintaoLee-Roger!
I think the best we have for all of these is the camera handle API, which lets you read/write the camera state.
For your three questions:
auto_range
, but you can do some math to set the camera position, orientation, look at, FOV, etc programatically.camera.look_at
to a length-3 tuple or numpy array to look at a specific point in the scene.For accessing the camera handle, one option is to do so when the client connects:
server = viser.ViserServer()
@server.on_client_connect
def _(client: viser.ClientHandle) -> None:
client.camera.position = (1., 1., 1.)
If you have any event object (for example, from a GUI callback), you can also access event.client.camera
.
Does that help?
Yes! I have achived my goal by your advises. Thank you very much.
Hi! I’m encountering some issues while adjusting the initial view state.
How can I adjust the initial view size, or is there a function similar to
auto_range
that scales the entire figure to fit within the visible area? Currently, if my images are large, only a small portion is displayed, making the initial view too zoomed in. I know there are parameters likescale
,render_width
, andrender_height
that can be adjusted, but if there are too many images or meshes, adjusting each one individually becomes tedious. Additionally, it’s hard to know the exact values to achieve the desired result.Is there a way to set the coordinate center on the screen? In many cases, the range we’re interested in is greater than zero. For example, I may use three images to represent slices of a 3D medical CT scan or different directions of a 3D geological model, and typically, the coordinates I set are greater than zero. In this case, the generated figure appears shifted towards the top-right corner of the screen instead of being centered, requiring extra dragging to reach the center.
A more general/ultimate question: After adjusting a view (rotating, zooming, panning), how can I easily reproduce this exact state? As you know, when preparing publications or slides for presentations, we often need to display different datasets or results from the same perspective/view to facilitate comparison. This requires capturing the current visualization state after adjusting it to the optimal view, and then applying that state when visualizing other data.
I’d be grateful for your help. Thank you!