Giter VIP home page Giter VIP logo

rufus31415 / simple-webxr-unity Goto Github PK

View Code? Open in Web Editor NEW
554.0 554.0 78.0 757.58 MB

⭐ Bringing WebXR to Unity 3D ! B-)

Home Page: https://rufus31415.github.io/webxr/MRTK-HandInteraction/

License: MIT License

C# 45.75% ShaderLab 33.62% HLSL 5.35% JavaScript 10.96% CSS 1.25% HTML 3.06%
augmented-reality csharp firefox-reality hololens javascript mixed-reality-headsets mrtk oculus-browser oculus-quest unity webgl webxr xrtk

simple-webxr-unity's Introduction

simple-webxr-unity's People

Contributors

dawaralvi avatar keveleigh avatar rufus31415 avatar stephenhodgson 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

simple-webxr-unity's Issues

Refactor project

Refactor project :

  • Use only one Unity project
  • Use MRTK as Unity package
  • Move Unity project to root
  • Create a show case carousel

High DPI rendering issue with Unity 2020

With Unity 2020, by default, the rendering of the 2 eyes is not correct:

  • A part of the right eye is rendered on the left eye
  • The right eye is not fully rendered and there is a black border on the left side

The problem does not occur on other browsers

On the Quest 1 : window.devicePixelRatio = 0.800000011920929

Minimal.Framework.js :

  function _JS_SystemInfo_GetPreferredDevicePixelRatio() {
    return Module.devicePixelRatio || window.devicePixelRatio || 1
  }

Either add the property devicePixelRatio: 1 in the config object of index.html or force Module.devicePixelRatio in SimpleWebXR.jspre

com oculus browser-20210601-231905

AR Foundation Image Tracking Demo

Hello there,

i forked Unity-Technologies/arfoundation-demos and setup the project in Unity 2019.4.13f1 as described here by adding the 3 mentioned files the Unity Asset folder and attachting SimpleWebXR MonoBehavior on a game object called WebAR to my scene (commit).

I fired up a simple HTTP Server python -m SimpleHTTPServer 8080 and a tunnel via ngrok http --host-header=rewrite 8080 to access index.html from my actual smartphone (Apple iOS) via a public URL.

The websites loads extremly slow (2-3 Minutes) with a 100Mbit internet connection. After loading finished, there is no camera image (just a black screen) with a Text saying "Wait for tracking to begin."

The Webserver also returns a 404:

GET /sharedassets0.resource              404 File not found

The file sharedassets0.resource is not part of the bundle (not sure if this is important).

Screenshot 2020-10-28 at 11 11 33

Here are my WebGL Player Settings (maybe i forgot a important checkmark somewhere?)

Screenshot 2020-10-28 at 11 21 02

Screenshot 2020-10-28 at 11 21 07

Sidenote: The arfoundation-demos are working as expected when i export the iOS and Android Player and run it on my test devices.

Left and Right camera settings

In some cases, it is desirable to have camera settings like layers, tags and so on exposed for customisation, to enable stereoscopic effects or hiding layers.

Having the camera rig generated at run time is a barrier to this kind of customisation.

Tested on Oculus Quest Browser

MSAA support

would be nice to get anti-aliasing working without the framerate hit. For example 4x MSAA

Tested on Oculus Quest Browser

How to enable Spatial Awareness on Android?

Hi, I am trying to replicate your show case WebXR on Android with MRTK.

I want to enable Spatial Awareness like this.
move

But, I am not able to do it.
I enabled it in MTRK ToolKit. But it doesn't work,
image

What should I do to activate it?
My current set up:
Unity 2019.4.23
MRTK 2.7
Android 8

Thank you for your help

iOS Support for Safari

Hello,

since we have experimental features for WebXR and Safari since iOS 16, I think we should start looking into it. In general, this needs to be enabled first in the Settings for Safari (Advanced > Experimental Features > check all the WebXR thingies).

However, we weren't able to run our application, which works in "WebXR Viewer".

Any ideas, what is missing? I can't debug it right now, since I don't have a Mac at hand but I'll try later.

URP Support (Android)

Hi,

Thanks for putting the tool together.

I'm wondering if it supports URP?.

I managed to succesfully run it using surface shader (3D project) but for URP I'm getting errors.

Tried 2 times once with clean URP project and second with upgrade of existing working surface-shader project to URP - same errors.

Thanks,
Chris

PS: error if that helps at all

exception thrown: RangeError: Maximum call stack size exceeded,RangeError: Maximum call stack size exceeded
    at stackSave (https://192.168.1.114/Build/0.1.wasm:wasm-function[798]:0x6d82e)
    at https://192.168.1.114/Build/0.1.framework.js:27278:36
    at invoke_ii (https://192.168.1.114/Build/0.1.framework.js:17358:11)
    at __ZL34GetTypeInfoFromTypeDefinitionIndexi (https://192.168.1.114/Build/0.1.wasm:wasm-function[37763]:0xdcfdf6)
    at __ZN6il2cpp2vm14GlobalMetadata21GetTypeInfoFromHandleEPK27___Il2CppMetadataTypeHandle (https://192.168.1.114/Build/0.1.wasm:wasm-function[37824]:0xdd184b)
    at __ZN6il2cpp2vm14GlobalMetadata19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37823]:0xdd183e)
    at __ZN6il2cpp2vm13MetadataCache19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37820]:0xdd17fc)
    at __ZN6il2cpp2vm4Type8GetClassEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37724]:0xdcebaf)
    at __ZN6il2cpp2vm5Class14FromIl2CppTypeEPK10Il2CppTypeb (https://192.168.1.114/Build/0.1.wasm:wasm-function[37706]:0xdce56f)
    at __ZL18FromTypeDefinitioni (https://192.168.1.114/Build/0.1.wasm:wasm-function[37764]:0xdd0126)
    at _GC_call_with_alloc_lock (https://192.168.1.114/Build/0.1.wasm:wasm-function[39292]:0xe0133e)
    at Object.dynCall_ii (https://192.168.1.114/Build/0.1.framework.js:27543:37)
    at invoke_ii (https://192.168.1.114/Build/0.1.framework.js:17360:30)
    at __ZL34GetTypeInfoFromTypeDefinitionIndexi (https://192.168.1.114/Build/0.1.wasm:wasm-function[37763]:0xdcfdf6)
    at __ZN6il2cpp2vm14GlobalMetadata21GetTypeInfoFromHandleEPK27___Il2CppMetadataTypeHandle (https://192.168.1.114/Build/0.1.wasm:wasm-function[37824]:0xdd184b)
    at __ZN6il2cpp2vm14GlobalMetadata19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37823]:0xdd183e)
    at __ZN6il2cpp2vm13MetadataCache19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37820]:0xdd17fc)
    at __ZN6il2cpp2vm4Type8GetClassEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37724]:0xdcebaf)
    at __ZN6il2cpp2vm5Class14FromIl2CppTypeEPK10Il2CppTypeb (https://192.168.1.114/Build/0.1.wasm:wasm-function[37706]:0xdce56f)
    at __ZL18FromTypeDefinitioni (https://192.168.1.114/Build/0.1.wasm:wasm-function[37764]:0xdd0126)
    at _GC_call_with_alloc_lock (https://192.168.1.114/Build/0.1.wasm:wasm-function[39292]:0xe0133e)
    at Object.dynCall_ii (https://192.168.1.114/Build/0.1.framework.js:27543:37)
    at invoke_ii (https://192.168.1.114/Build/0.1.framework.js:17360:30)
    at __ZL34GetTypeInfoFromTypeDefinitionIndexi (https://192.168.1.114/Build/0.1.wasm:wasm-function[37763]:0xdcfdf6)
    at __ZN6il2cpp2vm14GlobalMetadata21GetTypeInfoFromHandleEPK27___Il2CppMetadataTypeHandle (https://192.168.1.114/Build/0.1.wasm:wasm-function[37824]:0xdd184b)
    at __ZN6il2cpp2vm14GlobalMetadata19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37823]:0xdd183e)
    at __ZN6il2cpp2vm13MetadataCache19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37820]:0xdd17fc)
    at __ZN6il2cpp2vm4Type8GetClassEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37724]:0xdcebaf)
    at __ZN6il2cpp2vm5Class14FromIl2CppTypeEPK10Il2CppTypeb (https://192.168.1.114/Build/0.1.wasm:wasm-function[37706]:0xdce56f)
    at __ZL18FromTypeDefinitioni (https://192.168.1.114/Build/0.1.wasm:wasm-function[37764]:0xdd0126)
    at _GC_call_with_alloc_lock (https://192.168.1.114/Build/0.1.wasm:wasm-function[39292]:0xe0133e)
    at Object.dynCall_ii (https://192.168.1.114/Build/0.1.framework.js:27543:37)
    at invoke_ii (https://192.168.1.114/Build/0.1.framework.js:17360:30)
    at __ZL34GetTypeInfoFromTypeDefinitionIndexi (https://192.168.1.114/Build/0.1.wasm:wasm-function[37763]:0xdcfdf6)
    at __ZN6il2cpp2vm14GlobalMetadata21GetTypeInfoFromHandleEPK27___Il2CppMetadataTypeHandle (https://192.168.1.114/Build/0.1.wasm:wasm-function[37824]:0xdd184b)
    at __ZN6il2cpp2vm14GlobalMetadata19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37823]:0xdd183e)
    at __ZN6il2cpp2vm13MetadataCache19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37820]:0xdd17fc)
    at __ZN6il2cpp2vm4Type8GetClassEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37724]:0xdcebaf)
    at __ZN6il2cpp2vm5Class14FromIl2CppTypeEPK10Il2CppTypeb (https://192.168.1.114/Build/0.1.wasm:wasm-function[37706]:0xdce56f)
    at __ZL18FromTypeDefinitioni (https://192.168.1.114/Build/0.1.wasm:wasm-function[37764]:0xdd0126)
    at _GC_call_with_alloc_lock (https://192.168.1.114/Build/0.1.wasm:wasm-function[39292]:0xe0133e)
    at Object.dynCall_ii (https://192.168.1.114/Build/0.1.framework.js:27543:37)
    at invoke_ii (https://192.168.1.114/Build/0.1.framework.js:17360:30)
    at __ZL34GetTypeInfoFromTypeDefinitionIndexi (https://192.168.1.114/Build/0.1.wasm:wasm-function[37763]:0xdcfdf6)
    at __ZN6il2cpp2vm14GlobalMetadata21GetTypeInfoFromHandleEPK27___Il2CppMetadataTypeHandle (https://192.168.1.114/Build/0.1.wasm:wasm-function[37824]:0xdd184b)
    at __ZN6il2cpp2vm14GlobalMetadata19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37823]:0xdd183e)
    at __ZN6il2cpp2vm13MetadataCache19GetTypeInfoFromTypeEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37820]:0xdd17fc)
    at __ZN6il2cpp2vm4Type8GetClassEPK10Il2CppType (https://192.168.1.114/Build/0.1.wasm:wasm-function[37724]:0xdcebaf)
    at __ZN6il2cpp2vm5Class14FromIl2CppTypeEPK10Il2CppTypeb (https://192.168.1.114/Build/0.1.wasm:wasm-function[37706]:0xdce56f)
    at __ZL18FromTypeDefinitioni (https://192.168.1.114/Build/0.1.wasm:wasm-function[37764]:0xdd0126)
printErr @ 0.1.loader.js:69
callMain @ 0.1.framework.js:29112
doRun @ 0.1.framework.js:29135
run @ 0.1.framework.js:29147
runCaller @ 0.1.framework.js:29083
removeRunDependency @ 0.1.framework.js:1163
(anonymous) @ 0.1.loader.js:697
Promise.then (async)
(anonymous) @ 0.1.loader.js:680
callRuntimeCallbacks @ 0.1.framework.js:1000
preRun @ 0.1.framework.js:1029
run @ 0.1.framework.js:29125
runCaller @ 0.1.framework.js:29083
removeRunDependency @ 0.1.framework.js:1163
receiveInstance @ 0.1.framework.js:1261
receiveInstantiatedSource @ 0.1.framework.js:1276
Promise.then (async)
doNativeWasm @ 0.1.framework.js:1289
(anonymous) @ 0.1.framework.js:1359
unityFramework @ 0.1.framework.js:21076
(anonymous) @ 0.1.loader.js:674
Promise.then (async)
loadBuild @ 0.1.loader.js:673
(anonymous) @ 0.1.loader.js:717
createUnityInstance @ 0.1.loader.js:702
script.onload @ (index):93
load (async)
(anonymous) @ (index):92

MRTK 2.7.3 Support

Do you know of any blockers for supporting 2.7.3? I can take a stab at it, but would love some guidance if it's already been attempted. Thanks!

How to enable teleportation?

Hello,
Thank you for this very useful package.
I am new to WebGL, but I have some experience with MRTK.
I am trying to use teleportation in the Oculus browser. But I can't get it to work.
In MixedRealityToolkit it is active.

image

Do I have to do something else to activate it?
Merci!

Regression. VR scale no longer matches Unity editor scale on Oculus Quest

I recently tried the latest version of your plugin, and found that the scale of the scene is now based on the height of the headset at player start. The camera in my editor scene is at a seated height. If I start the build when I am standing, scene scale is huge and I feel like a hobbit. If I start the scene when crouched, scene scale is tiny and I feel like a giant. It is very important to my use (showing clients models of real world exhibit spaces) to have the scale in VR match the scale in Unity. A previous version of your plug-in that I have used (dated Dec 3) did not have this issue.

Painter not working on Smartphone (Android)

Hey there,

I was looking for an webxr exporter for my projects (mainly AR on phones) and on testing the examples I saw that the painter is not working on my device (Samsung S8) in any of the browsers. Camera has passthrough but there is not paint working.

spectator example: an insecure websocket connection may not be initiated from a page loaded over https

I have problems to make the spectator example work.

Desktop:
After entering ip address of hololens the browser shows a message "an insecure websocket connection may not be initiated from a page loaded over https".
In Chrome this can be bypassed by site settings > Insecure content > Allow.
After this bypass the example works

Ipad:
Nothing happens after entering the ip address. I suspect the socket connection is also blocked but without message.

Android:
Somehow I can only load the app in Firefox, but not in Chrome because of memory limitations.
Firefox also fails with the message "SecurityError: The operation is insecure". I didn't find a way to bypass this on Firefox.

Is it possible to switch to secure websocket in the spectator example?

Visualize controller 3D model and animate it

Stuck on loading

Hello, I add the SimpleWebXR.unitypackage, and build Paint scene. But I stuck on loading.
image

Unable to do hand tracking MRTK on browser

I tried your project Simple-WebXR-Unity Hand Detection Example and MRTK Hand Interaction. But both of them just can't do hand tracking on my browser. The MRTK Hand Interaction only can interact with the 3d object using controller. I use Magic Leap Helio browser. Do you know why i can't do the hand tracking ?

This is forcing resolution really low for some reason

Without this package, my build loads webgl in mobile and desktop browser at the same resolution as the assets are set to in unity. For example, a picture at 1080p is 1080p on mobile and desktop. Once this package is attached to my project, the same build with no additional changes will visually look like maybe 720p on desktop and like 140p on mobile browser. Is this forced somewhere in a script? I know it is not my webgl template because I use the same one, the only difference is adding this package? Can I remove this forced reduction manually without breaking anything? Thanks.

Use several shared arrays between jslib and Unity

There are now 2 shared arrays (float and byte).
To limit the number of index computations and bugs, it would be interesting to have the following shared arrays:
Byte arrays :

  • left controller info
  • right controller info
  • left view info
  • right view info
  • global info

Float arrays :

  • left controller poses
  • right controller poses
  • left view poses / matrix
  • right view poses / matrix

Fails to compile in Unity 2021.3.3

Really cryptic error from unity.

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\tools\acorn-optimizer.js:1845
  throw err;
  ^

SyntaxError: Unexpected token (4460:62)
  var textEncoder={encoding:"utf-8",encode:encode(input = '') {
                                                              ^

    at Parser.pp$4.raise (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2927:15)
    at Parser.pp.unexpected (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:698:10)
    at Parser.pp.expect (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:692:28)
    at Parser.pp$3.parseObj (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2563:14)
    at Parser.pp$3.parseExprAtom (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2302:19)
    at Parser.pp$3.parseExprSubscripts (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2129:21)
    at Parser.pp$3.parseMaybeUnary (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2106:19)
    at Parser.pp$3.parseExprOps (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2041:21)
    at Parser.pp$3.parseMaybeConditional (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2024:21)
    at Parser.pp$3.parseMaybeAssign (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:1997:21) {
  pos: 166718,
  loc: Position { line: 4460, column: 62 },
  raisedAt: 166719
}
emcc2: error: '"C:/Program Files/Unity/Hub/Editor/2021.3.3f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/node/node.exe" "C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\tools\acorn-optimizer.js" C:\Users\KEVINA~1\AppData\Local\Temp\emscripten_temp_gz1uwi0k\build.js.pp.js AJSDCE minifyWhitespace' failed (1)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I found a related thread, where the issue was happening in another javascript plugin, but the solution seems unrelated.
endel/NativeWebSocket#53

black flickering on mesh

UpdateCamera(WebXRViewEyes eye) is causing black flickering

When I disable that function, no flickering

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.