Search Unity

How was this done... AR on the web?

Discussion in 'General Discussion' started by prankard, May 5, 2010.

  1. prankard

    prankard

    Joined:
    Mar 24, 2010
    Posts:
    19
    Ok, I've looked around the forums and try to figure out how to re-create the same effect.
    Obviously, I know AR can be done on the web with unity3d. You can see so here:
    Release the Kraken

    I've been looking around, and found a fantastic post that has UnityAR which uses .dll files. I've read in the Unity docs that the .dll plugins cannot be used on the web for security issues.

    Does anyone know how this effect was achieved and point me in the right direction of accessing the webcam on the web and accessing a AR library.

    Thanks,

    James
     
  2. RoboZombie

    RoboZombie

    Joined:
    Jan 19, 2010
    Posts:
    23
    I've been wondering the same thing about how they did that little AR thing.

    What I do know is how they made Clash a horrendous movie. Just PM me if you want a guide on "How to Make a Really Bad Movie That Will Sell Millions." :)
     
  3. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Check the post about it on their blog.

    So not a solution you and I can use :?
     
  4. rouhee

    rouhee

    Joined:
    Dec 23, 2008
    Posts:
    194
  5. burnumd

    burnumd

    Joined:
    May 27, 2008
    Posts:
    367
    I'm guessing FLARTK would still need Flash's security systems to access the camera, and it worked even though I had disallowed mic/camera access in Flash (in fact, I didn't get any prompts before it started accessing my hardware, which I find a little discomforting). I'm inclined to believe the dev blog, but I'm not sure what they mean by "custom [...] webplayer," since I didn't have to download a separate executable.
     
  6. amigo

    amigo

    Joined:
    Feb 20, 2010
    Posts:
    51
  7. amigo

    amigo

    Joined:
    Feb 20, 2010
    Posts:
    51
    I guess I jumped ahead of myself in enthusiasm... :)

    Even if we can use the player, we still need to get the API documentation and updated unityengine-debug.dll so that we can compile scripts that include ARTK.

    Perhaps someone from UT can shine some light on the matter?
     
  8. ianim8

    ianim8

    Joined:
    May 10, 2010
    Posts:
    4
    Any updates on this topic? I see that Boffswana is using Unity for web based AR applications. Other Unity solutions seem to require a plugin which if I'm not mistaken (I'm a Unity newbie) will not work with unity projects created for web usage. Boffswana also doesn't appear to be using Flash as part of the process either as their sites don't ask for access to the web cam.

    Any help would be greatly appreciated.

    Thanks.

    Glen
     
  9. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    If Unity made the custom webplayer, that means that Unity's developers have this tech under their belt.
    Then its not a big stretch of the imagination to have this included in the upcoming Unity 3.0.
    I'd say all AR fans need to get lobbying for this feature to be included.
    When the standard webplayer can use video, implementing the C# version of ARToolkit under Unity is just a matter of hammering it out.
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Does not meant that it license wise is allowed for them.
    UT also did the work on Fusion Fall yet stuff tickles back slowly or not at all (asset bundles are a consequence of that work, but so is also the not publically sold but available addon license for unity asset cache usage on 2.6+)
     
  11. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Come on, I just saw that game and its performance on my laptop.

    This webcam tool just rocks, so I really hope it'll make it in 3.x
     
  12. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    It's a custom feature offered to and available for Boffswana only at this time. General use and availability of those features is just not something we can offer right now but we're obviously hoping to do so in the future.


    Feel free to lobby, but we already get the point about this sort of functionality (it's not difficult to understand why this would be great functionality to have!). But also keep in mind that just because you see it in a custom player today for Boffswana does not guarantee we can or will include it in the 3.0 release. At times features like this get accelerated and supported in unique ways by 3rd parties, and with that comes public exposure to the features (like y'all seeing the blog post and content it describes today, or as in the case of FusionFall like dreamora cited) while public access and use takes a bit longer to arrive. Such is this case now, so hang in there as we too want to see this sort of capability in the general public player at some point.
     
  13. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    So close, yet so far...
    Keeping fingers crossed for a speedy trickle-down.
     
  14. darthdjx

    darthdjx

    Joined:
    Oct 30, 2009
    Posts:
    1
    i've unpacked the webplayer and i see the following dll's inside

    UnityWebPlayer\mono\2.x.x-boffswana\mono-1-vc.dll
    UnityWebPlayer\mono\2.x.x-boffswana\Data\lib\mscorlib.dll
    UnityWebPlayer\mono\2.x.x-boffswana\Data\lib\UnityDomainLoad

    UnityWebPlayer\player\2.x.x-boffswana\
    UnityWebPlayer\player\2.x.x-boffswana\wrap_oal.dll
    UnityWebPlayer\player\2.x.x-boffswana\webplayer_win.dll
    UnityWebPlayer\player\2.x.x-boffswana\Data\unity default resources
    UnityWebPlayer\player\2.x.x-boffswana\Data\lib\UnityScript.Lang.dll
    UnityWebPlayer\player\2.x.x-boffswana\Data\lib\UnityEngine.dll
    UnityWebPlayer\player\2.x.x-boffswana\Data\lib\Boo.Lang.dll


    some things i found

    wrap_oal.dll <-- "wrapper" OpenAL library

    http://unity3d.com/files/mono/monochanges.html

    some spare info about mono-1-vc.dll

    it seems to be the mono visual c runtime

    anyway unity default resources seems to be pretty interesting

    sorry if i posted old news but i'm a newbie

    btw is a pro feature make a custom installer?
     
  15. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    For your own desktop (Mac or Win) games and content you can and likely should create your own installing routine, but that's not a built-in feature found in Unity (you must handle that externally). As to the web player, we are the only people allowed to distribute Unity Web Player installers, you are not allowed to create nor distribute your own custom web player installers. The existence and availability of a custom web player, like that in use by Boffswana, is based on agreements they have with us.
     
  16. Jon Martin

    Jon Martin

    Joined:
    Jun 24, 2010
    Posts:
    2
    I managed to find a way of getting the webcam image from Flash to Unity through sockets in the web-browser, very early stages though, still testing functionality so would appreciate feedback, a link to my blog post and demo of it hopefully working for you below:-

    http://www.fusedworks.com/blog/development/688
     
  17. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    :D Congratulations man :D
    I tried the javascript and sockets route myself, but got stumped on the flash policy stuff.
    Hopefully your development will progress smoothly.
    Looking forward very much to your planned release.

    Now stop reading forums and get back to coding ;)

    Ciao, Patrick
     
  18. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Very cool Jon, well done!
     
  19. Deleted User

    Deleted User

    Guest

    What's AR? :oops:
     
  20. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    Augmented Reality
     
  21. Jon Martin

    Jon Martin

    Joined:
    Jun 24, 2010
    Posts:
    2
    Thankyou for the feedback, most appreciative, as for the policy stuff, I can share this part of the code which should hopefully help others, although I am looking into making this more efficient and into a class. This should make sense to those in the know about threads and listeners:-

    In Flash send webcam data using localhost, I used port 8080, in Unity use TCP listener localhost same port, in your thread in the while listening loop,

    Code (csharp):
    1.  
    2. mySocket = tcp_Listener.AcceptTcpClient();
    3. TcpClient(Host,Port);
    4. stream = mySocket.GetStream();
    5. bytesReceived = 0;
    6. receivedBytes =0;
    7. if (setpolicy) {
    8.    byte[] flashpolicy  = System.Text.Encoding.ASCII.GetBytes("<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\"/></cross-domain-policy>");
    9.  while(shouldRun) {
    10.    byte[] bytes = new byte[mySocket.ReceiveBufferSize];
    11.    receivedBytes = 0;
    12.    receivedBytes = stream.Read (bytes, 0, (int)mySocket.ReceiveBufferSize);
    13.    if (receivedBytes>2) {
    14.       stream.Write(flashpolicy, 0, flashpolicy.Length);
    15.       setpolicy=false;
    16.       break;
    17.    }
    18.    if(receivedBytes == 0) {
    19.       break;
    20.    }
    21.  }
    22. } else{
    23.  
    24. // Read your image bytes and process into texture
    25.  
    26. }
    27.  
    essentially flash's first communication to unity will be a string asking for a policy "<policy-file-request/>", it first asks on port 843 then the port you've tried to open, if you reply with the string above, it starts to send your data across otherwise blocks flash from communicating.

    Hope this helps, Jon.

    p.s. thanks HiggyB I will wear you comment round the office as a badge of honour.
     
  22. lalli143

    lalli143

    Joined:
    Jul 30, 2012
    Posts:
    33
    HI , I am new to AR and working on it.Currently ,I am using vuforia .It is supporting for ios and android .But I would like to know which one is useful for webbuild
     
  23. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    Neither, vuforia, like any other actual plugin is not supported in webplayer, indeed several AR solutions such as Vuforia don't even support standalone builds either.

    From memory read through the thread as it discusses methods of using non-plugin versions of Artoolkit to accomplish AR with marker cards.