Giter Club home page Giter Club logo

altspacesdk's Introduction

AltspaceVR SDK

The AltspaceVR SDK can be used together with Three.js or A-Frame to create holographic, multi-user web apps for virtual reality. When running inside AltspaceVR they can be experienced with consumer VR hardware including the Oculus Rift, HTC Vive, Samsung GearVR, and Google Daydream, as well as in non-VR mode for PC.

Three.js is an open-source, renderer-agnostic 3D engine written in Javascript. It is used to construct much of the 3D graphics you see on the web, and can be used to create entire applications, or enhance existing webpages with 3D content. A-Frame is a later addition to the 3D Web family, simplifying the process with the use of HTML-style markup to build 3D scenes instead of Javascript.

If you choose, you can apply for AltspaceVR developer privileges here. You will typically have a response within 2-3 days. Once granted, you will have access to a host of new activity types that are designed for SDK use. This is not required to use the SDK though.

If you are brand new to web development or 3D applications, we recommend you develop with A-Frame, as it's more user-friendly and has more utility built-in. Head over to our A-Frame API Documentation for more info on how to get started using A-Frame with AltspaceVR. You should also check out the official reference from A-Frame.

If you know what you're doing, you have your choice between A-Frame and Three.js. Three.js is lower-level than A-Frame, so it is more flexible, but at the cost of additional complexity. If you think this is for you, you should read our Three.js API Documentation. You'll also need the upstream Three.js Reference.

Resources

  • Developer Portal - Tutorials, projects, initiative program, and app submission
  • The AltspaceVR SDK Wiki - User-contributed tips and tricks
  • Local Dev Setup - Instructions for setting up a local dev environment
  • App Guidelines - Suggestions for building apps that work well in Altspace and Gear VR
  • Slack - Chat with other members of the community and AltspaceVR devs.

altspace.js

altspace.js should be included whenever you use the SDK. It contains core utilities and APIs, and is useful both inside and outside of the client.

Many APIs are present in the client without loading altspace.js, but please still include it, as this may change in the future.

The version baked into the altspace.js script will determine which version of the entire SDK the client will provide your app. This means that if we make any breaking internal changes to things like rendering or cursor events, and you are using an older version of altspace.js, we will try to return legacy behavior appropriate to your version of altspace.js. Versioning will follow SEMVER as closely as possible. Details for each version can be found in the Release Notes.

Latest Version: v2.9.0 -- See Changes

Include the latest version of the SDK in your app with:

<script src="https://sdk.altvr.com/libs/altspace.js/2.9.0/altspace.min.js"></script>

If you use npm, you can install altspace.js with:

npm install altspace

SDK Feature Overview

  • Holographic rendering - Display your 3D models in true-to-life size, stand next to them, walk through them, etc.
  • Cursor emulation* - Receive cursor events on your objects, e.g. cursordown, cursormove, etc.
  • Synchronization - Share app state across all clients, store high scores, etc.
  • Environmental data** - Know the size and relative scale of your app's enclosure, or request access to the entire virtual space.
  • User data - Know info about who is using your app, including a unique identifier, name, and moderator status. (This data is not stored automatically, but is available upon request.)
  • Avatar tracking skeleton - Know the position and orientation of your users' heads, hands, etc.
  • Unity native resources (A-Frame only) - Create proxy objects that let you manipulate native Unity assets, including pre-optimized models, particle effects, colliders, and more.

* For the purposes of cursor collision, meshes are approximated to be a 4/5 scale of their bounding box. If desired, default cursor collision can be disabled.

** Meshes outside the bounds of the enclosure will be culled unless you request full space access.

Debugging SDK Apps

NOTE: these instructions do not apply to Android-based devices!

We provide a standalone debugger that can connect to SDK apps while they're running in Altspace and has the normal functionality of the Chrome developer tools (i.e. you can read console logs, look at the values of variables, execute Javascript, etc.) You can download it here:

Windows Debugger**

More generally, Altspace browsers are implemented using an embedded Chromium which exposes the Chrome debugging protocol version 1.1. You can find documentation on the protocol and usage here. The protocol is exposed via a WebSocket interface on port 9999, rather than 9222 as is typical for the Chrome desktop browser. You can test it out by accessing http://localhost:9999/json while running Altspace to see a list of active in-world browsers and enclosures in JSON format.

There are many third-party tools that speak this protocol which you can point at running Altspace browsers, e.g.:

  • WebIDE - an implementation of the Firefox developer tools.
  • debugger.html - a reasonably barebones, open-source Javascript debugger.
  • Probably many of the projects listed here.

Note that many of these will expect to be connecting to port 9222, so you might have to forward from that port, e.g. on Windows you can use netsh:

$ netsh interface portproxy add v4tov4 protocol=tcp listenport=9222 listenaddress=127.0.0.1 connectport=9999 connectaddress=127.0.0.1

Graphics Feature Support

AltspaceVR supports Three.js versions r73, r74, r76, and r84. r84 is recommended. A-Frame versions 0.3.0 and 0.7.0 are the only versions tested and known to work, though others may as well.

Currently supported:

  • Object3D transformation and hierarchy
  • Most Geometries
  • MeshBasicMaterial
  • JPEG, PNG, HTML5 Canvas textures
  • Face and vertex colors

Not currently supported:

  • Lighting, custom shaders, screen space effects.
  • Texture filter, format, anisotropy, flip, THREE.MirroredRepeatWrapping.
  • Using GIF images for textures
  • VideoTexture
  • Material blending, depthTest, depthWrite, alphaTest, clippingPlanes
  • Other material types including LineBasicMateral, MeshFaceMaterial, MultiMaterial
  • Wireframes
  • Line Geometries
  • Quad/N-Gon faces
  • Dynamic meshes, skinned meshes
  • Interleaved BufferGeometry attributes
  • Geometries with more than 65,000 vertices (Note: Calculated as <number of faces> * 3)

Habits of Successful AltspaceVR Web Apps

  • If you're loading a texture from a URL, make sure its dimensions are a power-of-two for improved performance.
  • Mind your texture sizes. Large textures can cause frame locking in the client.
  • If your app requires many different textures and geometries, add them to a scene incrementally.
  • Use Object3D transforms (position, rotation, scale) for animation rather than skinned meshes.
  • Get user input via AltspaceVR cursor events or the tracking skeleton rather than from the keyboard.
  • Limit the number of objects per scene and polygons per object.
  • Bake ambient occlusion and other lighting into your models. All models currently render as unlit.
  • Avoid adding too many transparent objects to your scene. Transparency is GPU-intensive, especially on the Gear VR.

Known Issues:

  • Object visibility does not propagate to child objects in the scene graph. You can work around this by recursively setting the visibility on an object and its children.
  • Texture wrap mode is ignored on the wrapT property. The value of wrapS is used for both axes.

Browser Feature Support

Altspace's browser is based on Chromium version 40.

Currently supported:

  • Libre audio and video codecs (ogg, webm)
  • ES2015 Promises

Not currently supported:

  • Proprietary audio and video codecs (h.264, mp4, mp3)
  • WebRTC
  • WebVR
  • Most features of ES2015
  • The <audio> media tag
  • The <a> tag attribute target
  • The <iframe> tag

dev dependency status

altspacesdk's People

Contributors

amberroy avatar brianpeiris avatar enderthexen avatar evhan55 avatar fasani avatar gavanwilhite avatar geary avatar gfodor avatar kichjang avatar mqp avatar netpro2k avatar ngenesis avatar paulmasson avatar philipnavidad avatar robertlong avatar stevenvergenz avatar tuesy 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  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

altspacesdk's Issues

Create synced objects after initial load

Add functionality to create/sync networked objects after initial load, so that the entire scene doesn't need to be "pre-loaded". This should help reduce startup lag for scenes with many objects and just be overall useful.

OBJMTLLoader does apply crossOrigin to MTLLoader

altspace.utilities.shims.OBJMTLLoader does not propagate the crossOrigin property to MTLLoader and OBJLoader. See below for proposed fix:

var OBJMTLLoader = (function () {
        value: function load(objFile, mtlFile, callback) {
            var mtlLoader = new THREE.MTLLoader();
            >>> mtlLoader.setCrossOrigin(this.crossOrigin); <<<

V20 Battlegrid - dragging issues

Dragging objects in the battlegrid app seems to have some issues. The basic error is that the objects disappear while being dragged around, however how this manifests seems to be slightly different in the two places the app is running in: Gaming Space and Admin Tavern. In the former, the tiles disappear as soon as they touch the board; in the latter they tiles disappear if they are moved towards the edges of the board.

Mouse-up event missed on drag-and-drop

@L33TRice reported that in the DnD app, when dragging sometimes the cursor "escapes" the object and if the mouse-button is released, the drag will still continue. Possibly because we are listen for the mouse-up event on the object being dragged, which is no longer under the cursor.

Please remove the THREE.js requirement for including altspace.js

Currently you have to include three.js even if you don't have 3D elements.

<script src="http://sdk.altvr.com/libs/three.js/r71/build/three.min.js"></script>
<script src="http://sdk.altvr.com/libs/altspace.js/latest/altspace.min.js"></script>

Ideally you could just include altspace and make use of the firebase connection for interesting 2D applications in VR.

if you beam a holographic app before it has loaded an object it will go to a 2d enclosure

reported by @GavanWilhite 6/12/2015. We brainstormed possible solutions:

  • beam check at BrowserApi line 99.
  • create a 'Used' flag in ThreeJS Api (needs to be cleared in Clear when the page changes). whenever a load starts, could get the flag flipped early enough to be less of an issue
  • have loading screens that say 'wait until loading is complete before beaming', but the issues is we won't know if the objects are necessarily done loading in threejs
  • do something with the meta viewport tag in HTML
    <meta name="enclosure" content="holographic">

App loading taking >2 minutes

On the Asus laptop in the office (780M GPU, good CPU and RAM), loading any of the apps takes >2 minutes, and the client is frame-locked the entire time. This seems substantially worse than the frame-lock time on other machines.

network sync request

I think it's important we provide our sync libraries in a way that people who use our APIs to build apps are not (technically or conceptually) coupled with firebase. I can see us wanting to retrofit a firebase-like API on top of photon, for example, and have apps switch over to using our own servers without any code changes. I think it might be a good idea to make the sync library not explicitly be "firebase sync" but instead just be cast as "object sync" (analagous to a PUN photon view that syncs transforms) and incidentally use firebase for now (which we can mention in the documentation.) Thoughts?

No mouse cursor shown on Desktop Version using Windows 10

Not sure if you want bugs here or elsewhere.

My mouse cursor does not show while using the Desktop version (read: no headset). I'm using Windows 10. I'd like to show some friends your app but they're not going to be using headsets.

Chess not responding properly to cursor interaction

from @gfodor 6/19/15: also there are two mouse cursor issues, one of them is that the cursor doesn't react at all, and one of them is the highlighted item is wrong (these might be the same underlying bug but i've noticed both things happening) in this case just now it was the cursor not reacting at all

from @ttwu 6/19/15: for the chess app, I just saw the weird thing again where my interaction with it was a few seconds behind. I used to see it catch up after a while but this time it never did, and I was playing with it for a few minutes.

room id 1000 range

Is there a reason we used a max room id of 1000, and aren't worried about collisions?

Puppets App Firebase Permission Denied

When running the puppets app, the debugger shows that firebase is having permission denied issues:
'FIREBASE WARNING: set at /PuppetShow/rooms/-Jt0wLWAAo84DHrIRL-T failed: permission_denied' in firebase.js, line 19, as well as 'firebase error' with code: "PERMISSION_DENIED" in FirebaseSync.js, line 817.

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.