Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Wrote an article about Unity WebGL less known tips and tricks

Discussion in 'WebGL' started by De-Panther, Sep 21, 2021.

  1. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    552
    Just published https://medium.com/@depanther/unity-webgl-secrets-b6ddf214f1fd
    I wrote there about the tools Unity WebGL use to build for the web, and some useful ways to use them.
    Some of the frequent users in this forum might know some of them, but I hope it'll help you all.

    Let me know if you'll like more of those articles.
    I'm thinking about diving more into the framework.js file in the next one.
     
  2. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    @De-Panther Loved the write-up on improving messaging performance and laying out exactly what's going on with the WebGL builds, this information is invaluable! We're thinking of writing our own slam tracking so that we can get iOS support in addition to your work with WebXR for Android, so this is very useful.
     
    De-Panther likes this.
  3. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    552
    Thanks!

    Writing your own SLAM sounds interesting.
    Not sure if it'll be better if it'll be in a separate wasm or in the same one as Unity.
     
  4. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    Dunno yet, so far I've been looking around to see if there's already an open-source project that is tackling this so that we'll have some kind of fallback for iOS surface tracking since Apple seems hellbent on not supporting WebXR. But due to the nature of my work, it would probably end up being closed-source if our team tackles it ourselves.

    Right now if you wanted to add full WebAR capabilities, you would need to cobble together a package that combines the following separate WebAR technologies.

    Surface Tracking
    Android - WebXR via your open source repo
    iOS - ???

    Image Tracking
    Android & iOS - MindAR.js (Open source, no UnityWebGL port or iOS testing done yet)

    Face Tracking
    Android & iOS - Banuba (Paid, but relatively inexpensive and has built-in Unity WebGL support)

    Either that or pay for Zappar/8th Wall's API's, but for my use-case that's not really feasible.
     
  5. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    491
    I wasn't aware of MindAR.js...very cool!

    There is also UniversalAR, but it's paid as well. It has image tracking, face tracking, and instant tracking.
     
  6. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    @Marks4 Yeah UniversalAR is Zappar's AR API with their own custom surface tracking solution (so it works on Android & iOS for WebGL)
     
  7. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    552
    There are some progress of the WebXR API in Webkit, and some Apple people tweeted that they intend(or something similar) to push WebXR in iOS when they proposed the <model> tag.
    So I think WebXR would be supported on iOS, now the question is what would be faster, for a developer to develop their own SLAM / image tracking solution using WASM, or to wait for Apple to support WebXR...

    Regarding image tracking and plane detection, I know that there's already an API for them in WebXR, I'm just not sure if those are still experimental or not.
    I hope to finish with the XR SDK support in WebXR Export soon, so it'll be easier to implement those APIs.

    Regarding other tracking solutions, there's also https://handsfree.js.org/ for hands tracking.
     
    KamilCSPS likes this.
  8. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    @De-Panther I hadn't seen that updated Apple dev discussion regarding WebXR in Webkit, after a quick Google search I did indeed find the Bugzilla report and other devs saying there are only 1-2 more tasks related to WebXR support remaining. So it does indeed seem like the Safari devs are working towards it, so scratch my earlier thoughts on the matter. Still not clear when it would land but if it's in 2022 then there's no point in developing an alternative surface tracking solution to WebXR as that would take the better part of a year anyway.

    Surface Tracking
    Android - WebXR via your open source repo
    iOS - via WebXR in ~2022'ish based on estimates from Bugzilla page

    Image Tracking
    Android & iOS - MindAR.js (Open source, no UnityWebGL port or iOS testing done yet)
    - Alternatively use AR.js, which runs an older version of ARToolkit than MindAR.js but has been around a while

    Face Tracking
    Android & iOS - Banuba (Paid, but relatively inexpensive and has built-in Unity WebGL support)
    - Alternatively use no-cost HandsFree.js, which has hand, body, & face tracking, no Unity WebGL support yet
     
    De-Panther likes this.