Search Unity

UnityAR - ARToolkit Interface

Discussion in 'Made With Unity' started by Christian, Sep 22, 2009.

  1. andresp

    andresp

    Joined:
    Aug 12, 2011
    Posts:
    38
    +1
     
  2. rogeliopuig

    rogeliopuig

    Joined:
    Dec 29, 2011
    Posts:
    13
  3. shaneseuring

    shaneseuring

    Joined:
    Apr 21, 2012
    Posts:
    1
    To use a camera connected to the computer through a usb port, or maybe even Record something on a camera and then have the AR go over the video later?
     
  4. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8
    Dear All,

    Here is trying to bring all up-todate on this forum looking for some Augmented Reality options using Unity 3D

    1. The Downloads with which Christian started this forum thread, have now moved onto here, at the time of writing this
    - http://www.weltenbauer-se.com/pages/de/portfolio/unityar
    However, my personal use of the same (Please note i work on a mac platform) - didn't lead to any usable result. So while this sets the record straight for anyone looking for these files, i recommend you look at the next points.

    2. Meanwhile, UART got launched - which is available here
    - https://research.cc.gatech.edu/uart/ (the documentation on the project)
    - http://uart.svn.sourceforge.net/ (the actual files and plugin)
    Again, personal experience - it is badly documented, but IT WORKS. However the performance (frames rates) will be very low and you'd get about 10FPS. But cheers to these guys for making this work. Although, you'd need UNITY PRO since these projects need plugin library support.
    However for good news, please look ahead.

    3. Meanwhile, and just in time, NyARToolkit for Unity got launched. This deserves a few words
    a. It doesn't require Unity Pro
    b. It uses the new webcam features of unity, hence you get a better performance, and ability to use a USB connected camera
    c. It is not perfect, so you have to tweak the code. But all the information lies there if you know where to look
    d. It can be found here at http://nyatla.jp/nyartoolkit/ (three cheers for the developer).
    e. I made a sample game which was used in a roadshow of the Indian Air Force - and the game and some pictures from the event are available for download at this blog post : -
    http://www.anuragrana.com/blog/augmentedrealitygameonindianairforce
    f. I did three important modifications to the code, first: ability to use a PS3eye in place of standard isight camera, second: use two markers in place of one (in my game, first marker is tracked to a helicopter, while the second marker triggers its guns), and third, create a mirrored flip image.

    4. Another important development meanwhile is, ARToolworks, the grand daddy of them all and which started the basic AR inputs, has released a unity plugin for AR, and you can read about it here.
    http://www.artoolworks.com/support/library/ARToolKit_for_Unity

    However, it is a pro only feature and it comes at a cost too. To buy the same - you'd need to send a email to ben.vaughan@artoolworks.com. In my opinion, its the easiest way to get AR work across standalone, iOS and android platforms but comes at the cost.
    I also believe that it allows you to run a stored movie as a webcam feed, but not sure.



    In the end, right now what i'd recommend is - if you got the money (for unity pro and paid pluggins), got for ARtoolworks unity plugin, that is option 4 above.
    If you don't have the money - instead, go for the option 3 and get the NyARToolkit, but you'd have to tweak the code.
    - And you get more or less same performance in both cases. I was getting about 30-40FPS on my game.


    Hope this corrects a lot of what people were looking for. Else, send me an email on anurag.rana@gmail.com and i'd try to be more helpful.

    Edit: please see below for a video tutorial series on the same !

    Yours,
    Anurag.
    www.anuragrana.com/about.
     
    Last edited: Nov 4, 2012
  5. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    Its strange that nobody mentioned commercial licensing of ARToolkit

    Which indeed i emailed requesting the information which was a year ago and could run you 100/month + royalties of 5% on sales. Perhaps you're quote will be different?

    http://www.hitl.washington.edu/artoolkit/license.html
     
  6. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8
    Hi Runner !

    - The option 4 in my above post, is the commercial licensing of ARToolkit. There is a GPL version available, but it is hopelessly outdated and i doubt if it works with unity !
    - You are right about the cost - it will run you up close to i guess $1000 per year plus royalties

    But thanks for contributing ! lets make this thread useful.

    Anurag.
    www.anuragrana.com/about
     
  7. matiasjaure

    matiasjaure

    Joined:
    May 27, 2011
    Posts:
    39

    Vuforia is not even an option?
     
  8. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8
    @ Matiasjaure,
    - Vuforia is an option indeed, but Vuforia is designed to only run on iphone/android: and here i've assumed that the discussion here pertains to mostly standalone players: generally what is available in the 'free' version of unity.
    - Also, Vuforia will need Unity to access the the 'plugins' folder: which is only possible either in the paid PRO version of unity or like i said, iOS/android versions.

    But thanks for pointing out.
    Anurag.
    www.anuragrana.com/about
     
  9. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8
    Dear Reality Augmenters...
    Further to my posts above.. i received a lot of email requesting further elaboration over the use of Unity3D and ARtoolkits (various versions) to realize an augmented reality application... I've started doing a series of video tutorials which will cover some examples, theory, tools and techniques of using Augmented Reality for interactive applications...

    Here is part 1 of the series... will keep on updating as i post more videos
    http://youtu.be/j2TVlFAl9-M

    Here is part 2A of the series... will begin to get geeky, and please bear with me while we trudge through processing, as the route to good augmented reality in unity3d might very well lie through fundamentals there
    http://youtu.be/p79TzXGo2-k

    Part 2B - this will conclude working in processing and also detail out how computer vision works for pattern detection.. next video will take use to unity3D, and the fun will start !
    http://www.youtube.com/watch?v=Xdq-vnM86lY&feature=youtu.be

    Part 3 - And here, finally the result which we've been working towards - achieve augmented reality in unit3D - you will be surprised how quickly this will happen with all the knowledge beneath your belt from past videos.
    http://www.youtube.com/watch?v=kcOKPnWxqwU&feature=youtu.be


    Enjoy,
    Anurag Rana
    www.anuragrana.com/about
     
    Last edited: Nov 25, 2012
  10. bluemirco

    bluemirco

    Joined:
    Nov 8, 2012
    Posts:
    1
    hello anuragrana ,about your sample game, I met the problem
    “ NullReferenceException: Object reference not set to an instance of an object
    jp.nyatla.nyartoolkit.cs.markersystem.NyARSensor.getGsImage () (at Assets/NyARToolkitCS/src.markersystem/cs/markersystem/NyARSensor.cs:135)”

    the exception happen at the line “this._rgb2gs.convert(this._gs_raster);”
    but i dont know why there isnt a reference

    hope you can tell it , much thanks
     
  11. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8

    Dear Blue,
    The only place where i think an error being made right now will be 'not using' a playstation eye camera (which i had used). Hence, by default the program searches for webcams - sees atleast two are attached (one laptop internal, and second playstation) and used the 'second one'. To fix this, find the ARCameraBehaviour.cs file, and find the below code

    void Awake()
    {
    //setup unity webcam
    WebCamDevice[] devices= WebCamTexture.devices;
    for (i = 0 ; i < devices.Length ; i++ )
    Debug.Log(devices.name);

    WebCamTexture w;
    if (devices.Length > 0){
    w=new WebCamTexture(devices[1].name, 640, 480, 30)


    and make it 'devices[0].name' instead of devices[1].name - which should use the first possible camera available ! and that should be the solution
     
  12. cel

    cel

    Joined:
    Feb 15, 2011
    Posts:
    46
    Hi Anuragrana,

    Congrats on a set of brilliant tutorials... just a quick question, is it possible to use more than one marker and different from the hiro one? if so could you explain how to achieve this?

    Also, how can we have something, (let's say text or a gui) being drawn on the camera texture that doesn't follow a marker?

    Thanks for your time, and keep up the good work
     
    Last edited: Nov 20, 2012
  13. anuragrana

    anuragrana

    Joined:
    May 13, 2012
    Posts:
    8
    Dear Cel,
    Thanks for the good words, will surely help me in putting up a sustained effort. Yes.. it is possible to use multi-markers/different markers than the hiro one. But while i figure that out.. could you please help me in understanding what you mean by text/gui being drawn on the camera texture but not following a marker ??? it is so easy to do texture/gui in unity3D ! what might be different you are trying to achieve here??
     
  14. cel

    cel

    Joined:
    Feb 15, 2011
    Posts:
    46
    Hi Anuragrana,

    I meant drawing elements in front of the camera feed other than the ones being displayed by the marker... but i think i figured it out, just place them in front of the plane that has the camera feed as a texture.
     
  15. Mozza

    Mozza

    Joined:
    Nov 29, 2012
    Posts:
    135
    edit
     
    Last edited: Nov 30, 2012
  16. nanozip

    nanozip

    Joined:
    Dec 13, 2012
    Posts:
    3
    I have been experimenting with this AR thing for a while. It worked well using my Logitech camera (with approx. 30 fps on my i3 laptop), but when I change the camera to PS3 (which can reach 60-70 fps on 640 x 480 res. using its bundled application, ie. PS3 Eye Test App), the framerate drops to 9 fps in Unity. Does anyone have any workaround for this?
    Thanks in advance.....
     
  17. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    I have ps3eye that comes with move bundle. It works with cl-eye-test and nst-debut, but it does not work with nrARtoolkit. I am having problem with it, and it does not work with any camera settings. Please help.
     
  18. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    http://www.artoolworks.com/support/library/Creating_and_training_new_ARToolKit_markers#Training_using_the_online_marker_generator

    This applies same for nyARToolkit patterns too. You will find full detail for making patterns there.

    BTW I bought a webcam for my project, as I dont see a solution for ps3eye - move bundle cam not working yet. It would be better to use the ps3eye cam as it's much better than a webcam for image processing projects.
     
  19. Malek Maazoun

    Malek Maazoun

    Joined:
    Mar 1, 2013
    Posts:
    3

    UnityAR - ARToolkit Interface !!! does it includes , the f " AR Toolkit for Unity Pro !!??

    http://www.artoolworks.com/products/integrated/artoolkit-for-unity/
     
  20. Omar K Aly

    Omar K Aly

    Joined:
    May 26, 2013
    Posts:
    1
    Is there a way to create Augmented Reality webapp with unity

    using a tool or even did the code myself

    Thanks
     
  21. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    Hi, I'm trying to run ARToolkit on Windows stand alone. I am having a hard time setting the specific web cam I want to use by 'friendly_name' The wiki page says to use -device=WinDSVL <?xml version="1.0" encoding="UTF-8"?><dsvl_input>......
    Is it possible to enter this -device switch into the ARController's Video Windows config in the Unity editor? Will that accept a string of xml data? If not, where does this config xml go in order to get built into the app?
    Thanks for any help!
     
  22. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    Ok I got my xml string typed into the ARController field. It mostly gets read correctly when building to the machine. The only issue I'm having is that the camera I need to use on the desktop has "Front" in the name of it so I think that ARToolkit is set to mirror the horizontal axis automatically. I put into the xml string
    <pixel_format><RGB32 flip_h=“true” flip_v=“false”/></pixel_format>
    but it is still flipping the camera view in x incorrectly ( I tried it with 'false' as well.) I tried changing the flip_v to true as a test and it ignored that setting as well. Does anyone have any idea why my xml settings all make it across to the camera device except the flip bools? Ive been able to hide the dialog window, set the resolution, the fps, the friendly name of the camera....just no luck on the flip bools.

    thanks
     
  23. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Does this support Windows 8 Phones? And if not, are there plans to?
     
  24. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    415
    Is there any multiplatform AR solution that supports Windows Phone 8 and Surface tablets?
     
  25. dimasdx07

    dimasdx07

    Joined:
    Jun 29, 2015
    Posts:
    5
    hi, I am a beginner in aughmented reality, if I may ask? I have trouble about shadows in unity 3d while making the AR project. I want to create a shadow of a moving object, but I have trouble when I make a shadow without plane / terrain then shadow it does not appear. but if I use a plane / terrain shadow appeared. I want to create a shadow moving object but without plane / terrain or perhaps by plane transparent, can some one help me? thanks
     
  26. dimasdx07

    dimasdx07

    Joined:
    Jun 29, 2015
    Posts:
    5


    Like shadow in this video
     
  27. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    Try using this shader on a plane level with the ImageTracker
    Code (CSharp):
    1. Shader "Transparent/Diffuse with Shadow" {
    2. Properties {
    3.     _Color ("Main Color", Color) = (1,1,1,1)
    4.     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    5. }
    6.  
    7. SubShader {
    8.     Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    9.     LOD 200
    10.     Blend SrcAlpha OneMinusSrcAlpha
    11.     CGPROGRAM
    12.     #pragma surface surf Lambert addshadow
    13.    
    14.     sampler2D _MainTex;
    15.     fixed4 _Color;
    16.    
    17.     struct Input {
    18.         float2 uv_MainTex;
    19.     };
    20.    
    21.     void surf (Input IN, inout SurfaceOutput o) {
    22.         fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    23.         o.Albedo = c.rgb;
    24.         o.Alpha = c.a;
    25.     }
    26.     ENDCG
    27. }
    28.  
    29. Fallback "Transparent/VertexLit"
    30. }
     
  28. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    68
    Hello,

    I have a problem with ARToolkit in Unity on Win 7 with a webcam. First it happened automatically but also when I call StartAR() manually the app freezes more or less every second time I try. Sometimes I see the first camera image, sometimes the window stays black. I googled already for that issue but all I found was a similar problem some people had on Android.
    The problem doesn't appear on all machines (tested on other ones with Win 7). Did anybody else have this problem? Any idea what I could try to fix it?

    Thanks!