Looking-Glass / looking-glass-webxr

WebXR for Looking Glass displays
https://docs.lookingglassfactory.com/developer-tools/webxr
Apache License 2.0
66 stars 16 forks source link

Add ability to set `basePoseMatrix` directly or provide external camera #17

Open hybridherbst opened 2 years ago

hybridherbst commented 2 years ago

Currently, in this place:

However, this makes it rather hard and awkward to override the camera pose externally (e.g. through animation, regular OrbitControls, ...).

Would be great if this could be turned off and one could instead just pass a pose matrix + focalDistance in.

hybridherbst commented 2 years ago

Might be even better to simply allow passing in a regular camera to use (and then use also near/far clipping etc. from it, another area that's currently problematic to control).

This would also fix that currently the start pose can't really be nicely defined from an existing camera, and that interactions (e.g. clicking on things, moving things around) don't work at all since an entirely new camera seems to be constructed for the WebXR view.

hybridherbst commented 1 year ago

Would like to bump this - not being able to control the camera is an issue for any kind of loader. E.g. when loading arbitrary objects one wants to set camera, fov, fit into the view, load cameras from the file, ... and that is all hard/impossible right now. I understand it might be desirable to directly solve together with camera interaction but I think it's separate problems.

BryanChrisBrown commented 1 year ago

Hey Herbst!

So, it is possible to control the holographic camera with code, we've got an example using r3f's useFrame hook to set the camera position based on a sin wave. You can set the config settings dynamically so things like depthiness, focus, number of views etc can all be controlled with code.

react-three-fiber example

My thinking here is that this would solve the issue of exposing the base pose matrix, does this fit what you're looking for?

I'll look into adding near/far clip to the settings exposed with the config

hybridherbst commented 1 year ago

Somehow my response here didn't get sent - I know that the data can be set in that format. However, that only maps a subset of possible camera poses (e.g. tilt, non-standard matrices, ...), and still makes it pretty hard to convert from a known cam to the format looking glass wants.

Last but not least, cameras that already have events set up (e.g. clicking and dragging things around) also require external control, not just the base matrix.