MozillaReality / immersive-custom-elements

Immersive Custom Elements
https://mixedreality.mozilla.org/immersive-custom-elements/examples/index.html
Mozilla Public License 2.0
134 stars 8 forks source link

2D canvas component #73

Open joshmarinacci opened 4 years ago

joshmarinacci commented 4 years ago

We should have a component that takes an existing 2D canvas game and projects it into 3d space. At first it should look just like the 2d canvas on the page, but gives you an overlay to enter immersive mode. Then it handles copying content from the canvas to a 3d texture of the correct size and position, and sends emulated mouse events from the immersive controller. It would also let you customize the background when in 3D.

blairmacintyre commented 4 years ago

Why just a canvas? Perhaps thinking about any DOM element (via https://github.com/aelatgt/three-web-layer) and doing some smart things with placement and interaction, would be more interesting / generically useful?

takahirox commented 4 years ago

This idea reminds me of that I put NES emulator I made into VR.

https://github.com/takahirox/nes-js (NES emulator repository) http://takahirox.github.io/nes-js/index3.html (NES emulator in VR demo)

Note that the VR demo doesn't seem to work with actual VR devices. Try with WebVR emulator extension on your desktop instead. And no control emulation. You can control with your keyboard.

Anyways, playing canvas game in VR looks fun. And applying custom shader may sound interesting. In the demo, I apply CRT monitor style postprocessing.

image

takahirox commented 4 years ago

Why just a canvas? Perhaps thinking about any DOM element

That should sound interesting.

doing some smart things with placement and interaction

Yeah, that's the essential key. If we support everything the library and usage can be very huge and complex. I suppose discussing how we support and/or limit may take time, so going with canvas first and then thinking of any DOM element support later sounds good to me. And I guess it might end up with making separated project for any DOM in VR.

joshmarinacci commented 4 years ago

I started with just canvas because doing full DOM in VR is far harder than canvas. The browser doesn't natively support it due to security concerns, so you have to fake it with dom to canvas libs.