Giter Site home page Giter Site logo

exokitxr / exokit Goto Github PK

View Code? Open in Web Editor NEW
985.0 37.0 119.0 239.3 MB

Native VR/AR/XR engine for JavaScript ๐Ÿฆ–

License: MIT License

JavaScript 92.87% HTML 0.03% Dockerfile 0.13% CMake 0.19% Java 0.61% Python 2.69% C++ 0.99% Inno Setup 1.77% Shell 0.70% Batchfile 0.02%
javascript web browser webgl canvas webvr magicleap webxr engine exokit reality xr webrtc a-frame android virtual-reality

exokit's Introduction

Exokit

Exokit

๐Ÿ•ถ๏ธ Native VR and AR engine for JavaScript ๐Ÿฆ–

Discord โ€” Twitter โ€” Email List

Examples

Hands Reality Tab Live Reload Magic Leap Tutorial Reality Tab

Reality Projection with HTC Vive and Magic Leap Emukit Various Exokit Apps

Find more examples here and on YouTube.

Overview

This project enables developers to build XR experiences using the same code that runs on the web. Exokit engine is written on top of Node and emulates a web browser, providing native hooks for WebGL, WebXR, WebAudio, and other APIs used in immersive experiences.

๐Ÿ‘“ Exokit currently targets the following platforms:

  • OpenVR Desktop VR (Steam compatible)
  • Oculus Desktop (Oculus Rift/Rift S)
  • Oculus Mobile (Oculus Quest/Go, GearVR)
  • Magic Leap
  • iOS ARKit *
  • Android ARCore *
  • Google VR (Daydream / Cardboard / Mirage Solo) *
  • any XR device, start a pull request with a native binding if it isn't listed here! *

* not supported yet

๐Ÿ”Œ Since Exokit supports anything that runs on the web, it powers experiences built with:

  • Three.js
  • Unity
  • Pixi.js
  • Babylon.js
  • A-Frame
  • Custom WebGL frameworks
  • WebAssembly, TypeScript, and any language that transpiles to JavaScript

๐Ÿ‘ Why Exokit?

  • You want your WebGL/WebXR to run fast.
  • You want the hot new web APIs.
  • You want to add your own integrations -- including native -- into a browser environment.
  • You want a lightweight browser as a hackable node module.
  • You want to combine the web with a 3D engine like Unity.

๐Ÿ‘Ž Why not Exokit?

  • You're looking for a traditional "web browser".
  • You don't care about 3D or mixed reality.
  • You're looking for strict and/or legacy standards support.

๐Ÿ“– Manifesto

  • The future is immersive. The web is the best application platform. Javascript is the best ecosystem.
  • Content should be hardware agnostic. Tomorrow will have different hardware. VR and AR should be compatible.
  • It's not possible to do both 2D and 3D well. We don't do 2D. We can use an external 2D browser.
  • Use your favorite game engine. Exokit is not a game engine.
  • Legacy browser design choices don't make sense in XR.
  • Exokit empowers and connect apps, even (especially) if they aren't designed to cooperate.
  • Apps should run in "reality tabs", layers of reality that blend together.

Quickstart

Desktop

Run a WebXR site (desktop)

exokit https://aframe.io/a-painter/ # start A-Painter in Exokit

Magic Leap

Run (Magic Leap device)

mldb connect 192.168.0.10:1131 # mldb needs to be connected; see MLDB documentation
mldb install -u exokit.mpk # downloaded or built package
mldb launch com.webmr.exokit -v "ARGS=node . file:///package/examples/hello_ml.html" # or URL to load
mldb log exokit:*

Architecture

Exokit is a Javascript Node.js module.

C++ bindings hook into WebGL, WebXR, Magic Leap, Leap Motion, and various other device APIs.

const {window} = require('exokit')() to get an immersive browser in another project.

Exokit runs on Windows, macOS, Linux (x64), Linux (ARM64), and Magic Leap (ARM64).

Web API support

  • HTTP/S
  • HTML5
  • <script>
  • DOM
  • WebGL
  • WebXR
  • WebVR
  • WebRTC
  • Canvas2D
  • WebSocket
  • Web Workers
  • <img>, <audio>, <video>
  • WebAudio
  • Keyboard/Mouse events
  • Gamepad API
  • <iframe>
  • HTML layout
  • HTML rendering
  • CSS
  • Legacy APIs

Hardware bindings

  • OpenGL
  • OpenVR (Steam VR)
  • Oculus
  • Oculus Mobile
  • Magic Leap
  • Leap Motion

Local Development

See full building instructions in BUILDING.md.

git clone https://github.com/exokitxr/exokit.git
cd exokit
npm install
node . <url> # or node . -h for home

Debugging

Uses ndb.

npm run debug

Then in the console, input:

let window = await require('./src/').load(yourUrl);

Now you have a handle on the window object as you test your application, and you can set debugger breakpoints, inspect memory, profile CPU, etc.

Flags

  • --xr webvr Makes exokit WebVR mode regardless of the webpage. If exokit is always opening in pancake mode you can use this to try to fix that.

Stay in Touch

Contributing

Get involved! Check out the Contributing Guide for how to get started.

License

This program is free software and is distributed under an MIT License.

exokit's People

Contributors

3datawill avatar avaer avatar brianpeiris avatar chrislatorres avatar dmarcos avatar fierent avatar humbletim avatar ich123 avatar j-devel avatar jcc10 avatar machenmusik avatar ngokevin avatar onlinecop avatar palmer-jc avatar rangermauve avatar sbutltmedia avatar shawwn avatar sidequestlegend avatar timkonieczny avatar utopiah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exokit's Issues

Add link traversal support

Basically vrdisplayactivate events need to be emitted when you enter a site.

We actually already have a rough implementation of the emit, but we should clean it up to only emit once, at the right time, and preferably only when the HMD is actually nudged in the first place. I think OpenVR supports querying for this.

Additionally, it's worth thinking about how this should work with our reality tabs (tm :P) interface, where multiple sites are opened at once.

Chromium 2D in 3D

We don't do 2D rendering in the Exokit core, and we probably never will. The future is 3D.

However!

The world needs to catch up, and most of the web is still 2D. So a common request from Exokit is to render 2D sites as a plane. While we don't want to get into implementing the 2D part of the web ourselves, it's not too hard to use another 2D browser engine like Chromium and frame it as a plane in 2D.

We've done this before in Zeo, so we know it's doable. Basically we just need to open a true Chromium instance and feed the framebuffer through to Exokit's GL as a texture. With something like Puppeteer and simple plan intersections emulating mouse/touch events, we would get pretty close to having a 2D browser environment in our 3D browser environment ๐Ÿ’ป.

Warts

  • We need to figure out the web API exposed here. The regular web doesn't normally support this, but some of the extension apis provide inspiration for what it could look like.
  • We need to support Window, OSX, and Linux. Ideally we use a library for doing this that's OS-agnostic.
  • We would need to ship a build of Chromium and keep it up to date. This should be automated, not vendored into our repositories. We have two CI systems that could help.
  • For performance, we probably don't want to use the CPU for this to submit a texture every frame, but instead share the framebuffer.

Oculus HMD testing

We don't have an Oculus headset in the office right now, though it should be supported via OpenVR.

It would be great if a volunteer could check if the basics work in the Oculus VR environment, and file any gotchas/bugs to the main issue tracker on Github.

Spice up the README.md

Exokit does a lot of stuff, such as Magic Leap, Leap Motion, and more. It also runs a ton of VR sites, faster than other browsers. None of this is really mentioned anywhere, and there are no pretty pictures of it in the README.md. Let's fix that!

Basically, it would be great if our frontend content like the README.md had a lot more meat ๐Ÿ–. This is a fairly open-ended issue.

Leap Motion API + docs

We should figure out what the Leap Motion API looks like, as exposed to the use sites.

Ideally we don't stray too far from WebVR/WebXR/device API. Whatever we do should be thoroughly documented on http://docs.webmr.io ๐Ÿ“–

ArrayBuffer species is incorrect after fetch

C:\gh\exokit>node .
> fetch('https://mdn.github.io/fetch-examples/fetch-array-buffer/viper.ogg').then(x => x.arrayBuffer()).then(x => { console.log(x instanceof ArrayBuffer); })
Promise { <pending> }
> false

WebGL2 support

Exokit currently only supports the webgl context. WebGL2 adds a lot of nice stuff to that API.

Worry not! This actually is much easier than it sounds; we already use straight up OpenGL 3.2 for out WebGL backing, which is already a superset of what we need for WebGL2. So implementing WebGL2 would be mostly a matter of exposing/defaulting functionality in Javascript per the spec, rather than implementing much native code.

We should try to follow the WebGL/WebGL2 exposure rules in the spec as much as possible.

Cannot run w/ space in install path

It's seems to be an issue on both Windows (install to C:\Program Files) and OSX (App with space.app).

Should be easy to verify and/or fix! The two files which probably contain the affected code are index.js and core.js.

Merge platform-specific repos

We currently support 5 platforms, with platform-specific repos;

https://github.com/modulesio/exokit-windows
https://github.com/modulesio/exokit-macos
https://github.com/modulesio/exokit-linux
https://github.com/modulesio/exokit-android
https://github.com/modulesio/exokit-ios

There are also a couple of helper repos:

https://github.com/modulesio/exokit // this one, javascript/DOM parts
https://github.com/modulesio/exokit-bindings // native bindings

But there's no good reason to have these hanging around long term -- most of the code is exactly the same, on all platforms, even the native parts. Plus, it would be nice to just npm i exokit anywhere.

This mainly requires figuring out:

  • the npm install build
  • dependency downloads and/or bundling

Running

How would I run this normally, I downloaded the git and when I do npm run it doesn't work I did install the dependencies. please help i'm in the slack

docs.webmr.io improvements

There's some delicious low-hanging fruit in our docs site ๐Ÿ’. Although there is a good framework, we could both clean up and expand the site for commonly asked pointers.

We currently use docsify as a Github page for the docs, but that's amenable to change. Whatever we use should be automatic and ๐Ÿค–.

Frequently asked docs

  • Can I see some screenshots and videos?
  • Which sites can I open right now?
  • How do I run multiplayer?
  • How do I plug in to my node.js app?
  • Does it work with electron?
  • Why doesn't https://youtube.com/ open?
  • What is the "why" of the project?
  • I have bug X.
  • How do I run it in Magic Leap?
  • How do I run it with Leap Motion?
  • When is 1.0?

Chores

  • Remove the huge cover page?
  • <title/> tag?
  • <meta/> tags?

How to fix these

Submit a PR to webmixedreality/webmr-docs ๐Ÿฅ‡

Make Exokit streamable

Streaming is a big thing. I spend more time on Twitch than I'd care to admit.

It would be good to harness that wave by adding stream integration into Exokit.

The integration should be developer-focused at first, since those are who we want streaming Exokit anyway. Maybe we can bundle OBS and make it a one-click setup?

Site test infrastructure

Background

Exokit essentially reimplements all of WebGL.

Problem

We have bugs and regressions with various sites as our code changes, which it does frequently! Some of these are soft-crashes in JS (throws), some is hardcrashes in the native bindings (SEGV, hangs), and some is incorrect rendering.

Solution

We could automate checking a list of sites against a build of Exokit in our CI environments on Appveyor and Travis CI.

In particular it seems it would be straightforward to check that some sites load and run to completion -- the harder part of this is differential rendering verification, which we might want to punt on till later.

One wrinkle is that we might want to make this work for all three OSes we support (Windows, OSX, Linux), so we might need three harnesses. Also, since Exokit is a graphical app that requires either OpenGL or an emulation of it (e.g. mesa on Linux), we'll need to make sure the CI environment runs such support.

This could be broken up into separate issues if this proves to be too much to chew at once ๐Ÿ–.

Getting started

The three.js examples are a goldmine of simple but thorough test suites.

The ratio is high but not all of them examples load and render. However, those that do should continue to do so and can be whitelisted for verification.

Add build instructions

Need to mention:

Requirements

  • windows-build-tools
  • MagicLeap building
  • Node 9

Build methods

  • npm i exokit
  • Github Releases
  • manual build

Releases unpack size is too large

[email protected] postinstall C:\Users\LucidWeb\Downloads\node_modules\exokit
> node downloader.js

[โ–ˆโ–ˆโ–ˆ.................] exokit-windows.zip v0.0.36 2778194 bps 16% 68.8sevents.js:183
     throw er; // Unhandled 'error' event
     ^

Error: invalid distance too far back
   at InflateRaw.zlibOnError (zlib.js:153:15)

Use OpenVR api for models

For responsive triggers/buttons and tooltips. Plus make it actually match the hardware.

Need to expose a web API for it.

libopenvr_api.so missing (linux)

Ran the install script with (X)Ubuntu 16.04 xenial x86_64 Linux 4.4.0-122-generic. Extracted the files just fine, when running exokit however some OpenVR library is missing. Is this expected? Didnt see any prerequisite requirements in the readme.

internal/modules/cjs/loader.js:707
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^
Error: libopenvr_api.so: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:707:18)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/exokit/native-bindings.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)

Isolator crashing on windows

Missing node? Probably needs a full build download.

>exokit

C:\Users\Noah Schiffman\AppData\Roaming\npm\node_modules\exokit>IF EXIST ".\node\node.exe" (.\node_modules\isolator\lib\windows\isolator.exe -- .\node\node.exe .  )  ELSE (.\node_modules\isolator\lib\windows\isolator.exe -- node .  )
*os.PathError fork/exec .\node\node.exe: Access is denied.
C:/Users/Ultimus/go/src/github.com/modulesio/isolator/runner/winsandbox_windows.go:133 (0x8b9e12)
C:/Users/Ultimus/go/src/github.com/modulesio/isolator/cmd/runner/runner.go:156 (0x8bbd2d)
C:/Users/Ultimus/go/src/github.com/modulesio/isolator/cmd/runner/runner.go:36 (0x8bb592)
C:/Users/Ultimus/go/src/github.com/modulesio/isolator/main.go:236 (0x90d919)
C:/Users/Ultimus/go/src/github.com/modulesio/isolator/main.go:125 (0x90cf8a)
C:/Go/src/runtime/proc.go:198 (0x4306fe)
C:/Go/src/runtime/asm_amd64.s:2361 (0x45cbc1)

Youtube player

Would be nice if this worked:

exokit https://www.youtube.com/watch?v=dQw4w9WgXcQ

It could open the video in desktop mode, with enter VR/AR capability.

require("exokit") + exokit.load() does not work

Embedding Exokit in a nodejs project or running it directly from the node prompt does not work.

Code snippet:

Enter node and then paste

const exokit = require("exokit");
exokit.load('https://threejs.org/examples/#webgl_animation_cloth', {})

Magic Leap API + docs

We have supported the Magic Leap simulator for a while now. We will also support the real hardware when it ships!

However our approach/API exposition is not documented anywhere. We should clean up the API to conform to web expectations, with minimal deviation from WebXR, and then write up the documentation on https://docs.webmr.io ๐Ÿ“–.

Fix aframe example

exokit.cmd . https://aframe.io/aframe/examples/animation/aframe-logo/?ui=false

Crashes.

Exokit landing page

Current site: https://exokit.webmr.io/

Needs work! We need to expand the site with:

  • Download link for different OS's (currently https://get.webmr.io/ auto-selects; we should however have separate override links for Windows, macOS, and Linux โ›“
  • Getting started guide ๐Ÿ“š
  • More pretty pictures and videos, maybe a gallery! ๐Ÿ–ผ
  • Entry point to common things in the docs, such as downloading, features, contributing, troubleshooting, and so on ๐Ÿ“–
  • A succinct FAQโ“
  • Entry points to socials we maintain (Twitch, Slack, Discord, Twitter, Youtube) ๐Ÿ‘ฉ

Battery info for controllers

I noticed in some VR game -- I think VRChat -- that you can see the battery level for each controller.

I wanted to add this feature to my own site, but it seems that the WebVR spec doesn't provide the info.

Is there a way battery level could be provided to sites anyway? What would that look like?

We can do something like:

if (navigator.userAgent.startsWith("MixedReality")) { .... }

But that's cumbersome and prone to breakage; probably the worst way to do it.

Loading non-MR site should throw error

Currently loading e.g. http://youtube.com/ will lock up the browser, but it should instead display an error in MR.

TypeError: Cannot read property 'responseStart' of undefined
    at http://youtube.com/:1:1807
    at http://youtube.com/:1:2575
    at _runJavascript (C:\Users\avaer\Documents\GitHub\exokit\core.js:3215:15)
    at HTMLScriptElement.on.innerHTML (C:\Users\avaer\Documents\GitHub\exokit\core.js:2486:9)
    at HTMLScriptElement.emit (events.js:182:13)
    at HTMLScriptElement.EventEmitter.emit (domain.js:442:20)
    at HTMLScriptElement._emit (C:\Users\avaer\Documents\GitHub\exokit\core.js:1343:40)
    at HTMLScriptElement.set innerHTML [as innerHTML] (C:\Users\avaer\Documents\GitHub\exokit\core.js:2528:10)
    at HTMLScriptElement.run (C:\Users\avaer\Documents\GitHub\exokit\core.js:2549:24)
    at element.traverseAsync (C:\Users\avaer\Documents\GitHub\exokit\core.js:3186:16)

CI: do not codesign PRs

Currently our builds will error during a PR build: https://travis-ci.org/webmixedreality/exokit/builds/377086347?utm_source=slack&utm_medium=notification

This is by design: the PRing Github account does not (and should not) have access to secure variables in the build, such as our code signing keys. But it would be nice for the build to not fail, since build success is highly useful info for PRs.

The straightforward fix for this would be to skip the code signing steps (for Windows on Appveyor and OSX on Travis CI if/when the PFX_KEY environment variable is not defined -- and maybe log the fact that this is happening for later debugging in case this behavior leaks into master.

CC @shawwn

Voice chat in home environment

It's almost great, just the ScriptProcessorNode implementation doesn't respect the buffer size, resulting in hitching across two different breeds of browser.

Fix for this is to use the current frame size (128) as a basis and queue up until we have enough data in LabSound to emit an onaudioprocess.

Related repository is the home environment itself: https://github.com/webmixedreality/exokit-home

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.