nerfstudio-project / viser

Web-based 3D visualization + Python
https://viser.studio/latest
Apache License 2.0
702 stars 42 forks source link

How can I easily reproduce a special perspective state? #279

Closed JintaoLee-Roger closed 6 days ago

JintaoLee-Roger commented 1 week ago

Hi! I’m encountering some issues while adjusting the initial view state.

I’d be grateful for your help. Thank you!

brentyi commented 1 week 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:

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?

JintaoLee-Roger commented 6 days ago

Yes! I have achived my goal by your advises. Thank you very much.