Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WebVR #151

Open
nileshtrivedi opened this issue Jun 4, 2022 · 3 comments
Open

Support WebVR #151

nileshtrivedi opened this issue Jun 4, 2022 · 3 comments

Comments

@nileshtrivedi
Copy link

nileshtrivedi commented Jun 4, 2022

Ganja.js should make it possible to view the scene on a VR device. I suspect this involves rendering it for two cameras - one each for left and right eye - and then responding to the head movement by moving the camera positions.

I don't have a suggestion for an API though. Perhaps something like this?

this.graph([
 ...objects
], {grid:false, animate:false, webvr: true})
@kungfooman
Copy link
Sponsor Contributor

Usually apps print a button "Enter VR" when a headset device is available.

Many web engines (Three/Babylon/PlayCanvas...) support VR already, so the simplest option may be to make the renderer exchangeable/interchangeable. That is usually the prefered way for adding functionality in OOP.

What makes it tricky is probably the different rendering modes... pure GLSL, SVG, WebGL... they would all require their own VR attention to make it work.

I like your idea a lot, it would be nice to drag points with a VR controller and see whats happening while fully visually immersed (probably also helps with concentration).

@danbri
Copy link

danbri commented Jun 5, 2022 via email

@kungfooman
Copy link
Sponsor Contributor

The default idiom of this.graph simply can be reimplemented using e.g. ThreeGraph or PlayCanvasGraph. Personally I prefer PlayCanvas, but that just boils down to personal preference.

I made an example of how to use PlayCanvas as a renderer: https://enkimute.github.io/ganja.js/examples/coffeeshop.html#EYCLOff3B

It is using import to import the PlayCanvas engine and the CoffeeShop currently cannot handle that without rerunning the example (just Shift+Enter or press Run button).

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

No branches or pull requests

3 participants