GithubHelp home page GithubHelp logo

jbaicoianu / janusweb Goto Github PK

View Code? Open in Web Editor NEW
176.0 16.0 52.0 60.21 MB

An in-browser implementation of JanusVR

License: MIT License

CSS 3.19% HTML 6.02% JavaScript 47.87% Shell 0.31% GLSL 42.61%
janusvr virtual vive metaverse oculus-rift oculus daydream virtual-reality vr 3d

janusweb's Introduction

JanusWeb

A web framework for building social virtual reality experiences.

SiteVestaExamplesDemoDocs

Examples

Crystalball Augmented Perception Cinema Drag n' Drop Metacade Mansion

Features

  • Build immersive 3D environments for desktop, mobile, and VR devices using HTML and JS
  • Rendering functionality provided by Three.js / WebGL
  • Oculus Rift, Vive, GearVR, Daydream, and Cardboard support via WebVR API
  • Realtime collaboration across all devices via built-in networking
  • Import Collada, OBJ, glTF, and other popular 3d file formats
  • 3D positional audio
  • Gamepad support via the HTML5 Gamepad API
  • Supports hand tracking peripherals like Leap Motion, Oculus Touch, and Vive controllers
  • Support for 2d, sbs3d/ou3d, and 360 degree video textures using HTML5 Video
  • Scriptable client enables many customized uses

Using

There are several different ways to use JanusWeb, depending on how much control you want to have over the whole system.

Use our viewer

Our default viewer is always available at https://web.janusvr.com/. You can write an HTML page with your JanusVR Markup and host it anywhere you would normally host a static website. Any regular webhost, AWS S3 static sites, CDNs, or even more exotic locations like IPFS distributed filesystems will work. You can even put your mark-up onto sites like PasteBin or PiratePad. Then just load the URL in our viewer by entering the URL into the navigation bar, and you can link directly to it, share on social media, or embed our viewer directly into other webpages, blog posts, or articles.

See also Using a specific version of JanusWeb below.

Pull our scripts into your page

Using the above method, all of your links would go through our servers. If you'd prefer to link to your own servers, you can pull our JS into your page and use JanusWeb as a scriptable client via its API. This looks something like this:

<html>
  <head>
    <title>My JanusVR Room</title>
  </head>
  <body>
    <script src="https://web.janusvr.com/janusweb.js"></script>
    <janus-viewer>
      <FireBoxRoom>
        <Room use_local_asset="room1">
          <Object id="cube" pos="0 1 5" />
          <Text col="1 0 0" pos="0 2 4">My First Room</Text>
        </Room>
      </FireBoxRoom>
    </janus-viewer>
  </body>
</html>

The elation.janusweb.init() function can take a number of arguments, and returns a promise which receives an instance of the client. This client reference can be controlled via its API. See the sections on Arguments and Scripting below.

See also Using a specific version of JanusWeb below.

Install from ZIPs

(TODO - we will start shipping zip builds of JanusWeb once we release v1.0)

Install from NPM

(TODO - we will start shipping official NPM packages of JanusWeb once we release v1.0)

npm install janusweb

Build from source

If you'd like to build JanusWeb from source, you can check it out from Github and build using the following steps:

$ git clone https://github.com/jbaicoianu/janusweb
$ cd janusweb
$ npm install --only=prod
$ npm run build

This will give you a full build of the latest verson of JanusWeb in your build/ directory. You can then modify build/index.html however you see fit, and host it as suggested above.

Arguments

JanusWeb supports several arguments at initialization time to control how it behaves.

Name Description Default
autoload Load URL by default or wait for script true
crosshair Show player crosshair true
homepage Default page to go to when user presses home button https://web.janusvr.com/
networking Enable networking true
picking Enable mouse interactions true
resolution If specified, restrict the renderer to the specified size (none)
server Presence server to connect to wss://presence.janusvr.com:5567/
shownavigation Control visibility of navigation bar true
showchat Control visibility of chat true
stats Enable render performance stats false
url Default page to load (homepage)
urltemplate Optional template for generating URLs (none)
useWebVRPolyfill Enable WebVR polyfill for mobile phone compatibility true
usevoip Enable or disable VOIP functionality (NOTE - disabled pending browser support for Opus via WebAudio) false

Scripting

After initializing the client, elation.janusweb.init() returns a Promise which provides a reference to the client. You can programatically control this client to do all sorts of things. For instance, we can make the client load a URL, wait for the world and all of its assets to load, and then take a screenshot of the world after a specified delay:

var pageinfo = elation.utils.parseURL(document.location.href),
    urlargs = pageinfo.args || {},
    hashargs = pageinfo.hash || {};

var url = elation.utils.any(hashargs.url, urlargs.url, 'http://www.janusvr.com/index.html'),
    delay = elation.utils.any(hashargs.delay, urlargs.delay, 1000);

elation.janusweb.init({
  url: url,
  resolution: '1920x1080',
  showchat: false,
  shownavigation: false
}).then(function(client) {
  elation.events.add(client.janusweb.currentroom, 'room_load_complete', function() {
    setTimeout(function() {
      client.hideMenu();
      client.screenshot().then(function(imagefile) {
        // upload imagefile somewhere via XHR
        console.log('Screenshot complete!');
      });
    }, delay);
  });
});

Many other aspects of the JanusWeb client can be controlled this way as well. Our users are always thinking up new and inventive ways of using the JanusWeb client. Embed it in your blog posts, use it to render 3D content behind your 2d webpage, put a virtual security camera in your world and view a live stream of the virtual world from any web browser. Control the virtual world via a web interface. This is your scriptable live portal into the metaverse, to do with whatever you please. The possibilities are endless!

You can even run JanusWeb in NodeJS for headless server-side operations. Use it to write a bot that wanders the metaverse, or run your game logic and physics on a server to have one authoritative source of state for your world. If this sounds interesting to you let us know, we will be more than happy to help you through this (it's all very experimental right now!)

Using a specific version of JanusWeb

If you need to load a specific version of JanusWeb, all previous versions are stores on the same server, and can be accessed by construction a URL of the form https://web.janusvr.com/<version>/. This is useful if you have a room which you know works with a specific version, which relies on features which have since been deprecated or changed, or to determine whether bugs have been introduced.

JanusWeb versions follow the Semantic Versioning 2.0.0 spec, which follows the format <major>.<minor>.<patch> - for example, at the time of writing (March 2017) the current stable release is 1.0.15. So if you want to view this version, you could go to https://web.janusvr.com/1.0.15/ and if you wanted to pull this specific version into your page, you could do so with <script src="https://web.janusvr.com/1.0.15/janusweb.js"></script>. We also support aliases for the most current version - for instance, https://web.janusvr.com/1.0/ will always refer to the most recent 1.0 release, https://web.janusvr.com/0.9/ the final 0.9 release, etc.

Contributing

JanusWeb is open source, and we welcome any contributions! Please do report bugs using GitHub Issues, and all pull requests will be considered. We could especially use help with documentation!

Who is responsible for this?

JanusWeb was created by James Baicoianu, and is now an official open source project of JanusVR, Inc. The JanusWeb software and its API are published under the MIT license, and are free to use for whatever uses you can think of. If you build something cool, let us know!

janusweb's People

Contributors

alfa256 avatar avaer avatar bioid avatar dependabot[bot] avatar foxlet avatar jbaicoianu avatar madjin avatar spyduck 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

janusweb's Issues

Add splash screen to orient first-time users

Currently we just dump the user directly into a full 3d interactive world and let them figure it out. A splash screen would be a good way to explain to the user what they're looking at, tell them which features are supported but may require some input or a choice from them (gamepads, VR, 3D sound), and cover for some of the jankiness during the first-time load.

Portals can't be activated by gamepad

Clicks are currently implemented using mouse events, portals should use the object activation system instead so they can be interacted with using any supported controller type

Skyboxes often load incorrectly

The way skyboxes are handled now is currently pretty flaky. There's a race condition which sometimes causes the default skybox to be loaded even when the room specifies one to be used.

While we're fixing this, skyboxes should be per-room anyway, so they'll work better when we implement portal renderig (issue #5)

Add capsule-mesh collisions for player

Currently the player is being represented by a single sphere, and only primitives like cubes, spheres, and cylinders are supported by the physics engine. Work has begun to add capsule and mesh-triangle colliders, when it's done we can start parsing and using the collision_id parameter for objects and enable gravity for the player.

Objects with material color + texture behave differently from native

Models exported with both a texture and a material color are rendered differently in JanusWeb than in JanusVR Native client. This is because JanusWeb multiplies the color by the texture, whereas JanusVR overrides material color and just uses the texture.

It's debatable which method is better, being able to set material color to blend with the texture color gives you a range of effects that you'd need to use a shader for otherwise. But people often export bakes, etc. with the default material diffuse color, which in Blender is rgb(0.8, 0.8, 0.8) intensity 0.8, which leads to everything looking dull.

We should at least be consistent with Native, but maybe it makes sense to have an option for this?

Need to add in Reddit, imgur, and other room translators

We have basic support for running non-JanusVR worlds through a translator and presenting the default web room with the web content inside. We have the model files and other resources for Flickr, gfycat, imgur, reddit, vrsites, and youtube - just need to write the translator scripts.

Room editing support

Admin mode could be used to provide room editing functionality. Need to fix up some bugs to make it usable before enabling it.

Transparent objects are opaque

It looks like transparency is broken for loaded models, we probably need to set the transparent: true flag somewhere while loading. This worked at some point, and regressed when the threaded asset loader was added.

URLs need more permanent structure

Current url structure is bad for linking and SEO. We shouldn't be using #janus.url=... to set the current room url, we should be using fully-qualified paths. Some examples:

https://web.janusvr.com/sites/http://www.janusvr.com/index.html
https://web.janusvr.com/sites/https://www.metacade.com/
https://web.janusvr.com/sites/ipfs://QmbuyH9yDL5RfSTQPdEtGFKrFdTmNDKFosxfaF1uUjPAEK/

JanusWeb is more sensitive to invalid XML than native

The XML parsing libraries browsers use for DOMParser is a lot more picky about XML validity than the one the JanusVR native client uses. Specifically, one error that frequently causes problems is duplicate attributes on objects, for example:

<Object scale="1 1 1" id="class3" pos="0 0 0" scale="1.1 1.1 1.1" />

Since "scale" is duplicated, strictly speaking this XML is invalid, but it would be nice if we could handle this gracefully.

At the very least we should detect xml parse errors and show a message to the user, rather than dumping them into an empty or partially-complete room. There's also the option of switching to a pure-js XML parser, but this would make XML parsing slower across the board.

Another option worth considering is the idea of running the XML through an XSLT transform before trying to parse it. It may be possible to write an XSLT rule which will strip these duplicates - or it's possible that it will just fail to run because the XML is invalid.

Need portal rendering support

Portals currently act like hrefs on the web, click to visit. They should act like portals in JanusVR, where clicking a portal opens the new room and lets you walk back and forth between them.

Embedding janusweb in remote pages is too picky

It's a bit too difficult to embed JanusWeb into an existing remotely-hosted JanusVR site right now. Common problems:

  • elation.janusweb.init() assumes the page has a <head> and a <body>, should handle gracefully when they're not present
  • elation.janusweb.init() should attach to onload handlers if called from <head>
  • When loading a FireBoxRoom directly from the embedded page, it only works if the markup is enclosed in a <!-- HTML comment -->

lighting=false not working

User alu mentioned that objects with lighting=false are still being light dynamically, need to fix this

Sites which support CORS should be loaded directly

AugmentedPerception.com has a mapping of which rooms and resources send CORS headers and which don't. We'll always need to proxy some amount of content to get around CORS restrictions, but we could save bandwidth and improve speed by accessing supported resources directly from the server they're hosted on.

404 page doesn't render on the first error

The first time you encounter a 404, you end up seeing a black empty room instead of the default 404 error page. Subsequent 404s in the same session work, so it seems this is probably a race condition with the error translator.

Ghost support

Ghosts are unimplemented, and would be useful for adding life to rooms

URL bar should be smarter

The URL bar should be more lenient about accepting input. At the very least, if the user leaves off the http:// we should add it.

In the future we could also get fancy and search your history and auto-complete based on rooms you'd visited before, or once we get the room DB up and running we can provide suggestions from the corpus of all known Janus rooms.

UX issues

-need a turn on xhair option, and or a switch to free cursor mode (i.e. not locked to head). the 2d interface need to be rock solid.
-need a floor for walking and rt click to teleport like in janus native. or maybe just hotspots/anchors/vistas to click to teleport.

Videos not rendering

Videos seem to be loading and playing, but are just showing up as black, maybe some needsUpdate problem?

Script support

JanusVR rooms can specify AssetScript which defines logic for the world, and exposes a basic API for interacting with objects. Need to build a translation layer between that and Elation Engine's objects.

Re-enable drag-drop asset loading

Elation Engine used to have support for dragging and dropping textures and 3d models into the world from your desktop/other sites. Need to brush off this code and tie this in with Janusweb's editing system.

Support text chat

Native client is sending us chat packets, should be pretty easy for us to handle

Chat window on mobile

The chat window takes up quite a bit of space on mobile, could we have an option to have that hidden?

How can use Janusweb ?

Hello ;D
I have clone the source to my server and have install node.js, but how I can start the webclient in my browser ?

Greetings
Bogus

Support voice chat

Native app is sending us voice chat packets, it should be possible to support this but it will take some experimentation

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.