Augmented Reality in Unreal Engine 4

Here’s how to set up Unreal4AR from scratch (the documentation gets you to copy an existing small project in and I know some people like to start with a blank canvas).

It’s pretty much as the documentation says, except:

  1. Don’t copy the entire Content directory, just:
    • ARToolkit
    • Blueprints/
      • AR_ACtor_TOUCH.uasset
      • ARToolkitBase.uasset
      • ARToolkitBaseAdvanced.uasset
      • Markers.uasset
      • MarkersNFT.uasset
      • Mouse_GameMode.uasset
      • Mouse_PlayerController.uasset
    • Collections
    • Developers
    • Materials
    • Textures/
      • HUD_Custom.uasset
      • LoadingScreen.uasset
    • UI

In World Settings (Windows->World Settings, this appears in the right hand panel), set the Game Mode to Mouse_GameMode.

Drag an ARToolkitBaseAdvanced into the level (it should appear as a camera with a large square plane in front of it, the camera is the Virtual part of the AR view, the plane uses the BaseFeedScreenNoShadow material to display the real-world/video part of the AR view).

With the ARToolkitBaseAdvanced selected, in the Details panel change the “Auto Activate for Player” from Disabled to “Player 0“.

The important parts of the Level Blueprint are “Transform Camera”, “Actor Visibility”, and “Offset for NFT Marker” (assuming you’re using NFT markers – I am).

Be aware I’m also not using non-NFT markers so I’ve removed the relevant nodes for those.

think that’s everything I did to get it working, let me know if I’ve missed anything. Helpful images below.

"Transform Camera" and "Actor Visibility"
Transform Camera and Actor Visibility
Screenshot 2016-04-11 10.11.23
Offset for NFT Marker
ARToolkitBaseAdvanced settings
The ARToolkitBaseAdvanced Settings panel on the right showing the Auto Player Activation set to Player 0.
Screenshot 2016-04-11 10.16.04
The level screen, showing the World Settings panel on the right with the Mouse_GameMode, HUD_Custom and Mouse_PlayerController.

 

16 thoughts on “Augmented Reality in Unreal Engine 4”

  1. Does this method yield a scene that basically super imposes the model in the middle of your camera view with no need for a marker at all?

    1. Hi 3Deified,

      You can do imposition without a marker if that’s what you want to do, simply don’t refer to the marker for coordinates, set it relative to the camera (“Attach To” the camera and set the coords relative so it appears in front, for example).

      Cheers,

      lith

  2. I’m not able to deploy the package in spite of buying personal license for ARPlugin_PERSONAL_v1_4R1.
    I’m using unreal engine 4.11.2-2946394+++UE4+Release-4.11.
    I’m able to deploy the package for windows but not able to deploy it for android.
    Any kind of help will be highly appreciated.

    1. I had some trouble with this myself until the plugin author pointed me at http://www.unreal4ar.com/documentation/, specifically the section on packaging for Android.
      You have to download and build UE4 from source is the main thing, it won’t work with the stock binary install of UE4.

      Cheers,

      lith

  3. I’ve bought your personal license. The example project of personal license showed webcam init error, with nothing modified

    1. Hi Mengmeng Guo,

      I’m not the owner of the plugin, I just wrote this tutorial for it, sorry!
      In case it helps, check that the camera is attached and not being used by anything else.

      Regards,

      lith

      1. I am using a Macbook pro. The camera is OK on free license plugin, but it’s not OK on persoanl license.

        1. Mengmeng: Is it just giving a “webcam init” error? I don’t know why this would be I’m afraid, it’s odd it would behave differently with free and personal licenses.
          Also I didn’t write the plugin, it would be best to get in touch with the plugin owner at http://unreal4ar.com/

  4. I purchased a commercial license, citing ARToolkit Base Advanced.asset, connect the webcam being given. Editor closes. Help me thank you!

    Error:
    UE4Editor_ARToolkitPlugin
    UE4Editor_ARToolkitPlugin
    UE4Editor_ARToolkitPlugin
    UE4Editor_ARToolkitPlugin
    UE4Editor_CoreUObject!UFunction::Invoke() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\class.cpp:4195]
    UE4Editor_CoreUObject!UObject::CallFunction() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:484]
    UE4Editor_CoreUObject!UObject::ProcessContextOpcode() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1755]
    UE4Editor_CoreUObject!UObject::execLetBool() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1670]
    UE4Editor_CoreUObject!UObject::ProcessInternal() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:698]
    UE4Editor_CoreUObject!UFunction::Invoke() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\class.cpp:4195]
    UE4Editor_CoreUObject!UObject::ProcessEvent() [f:\unrealengine-4.9\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1050]

    1. steven.xu: I didn’t create this plugin, I just wrote this tutorial for it and use it.
      I can’t tell exactly what the problem is here but I can tell you I’ve had trouble with the whole editor crashing if I don’t have the webcam attached before I run it. Is it possible it’s not recognising the webcam?

      Cheers,

      lith

  5. any idea for this error?

    LogStats:Warning: MetaData mismatch. Did you assign a stat to two groups? New //STATGROUP_Threads//

  6. Hello!
    Thanks very much for your tutorial, really helpful!
    I’m trying to show a simple matinee (just move meshes)..
    Do you have any idea how I can achieve that? Is it even possible?
    Hope you can help me!

    Best!
    Victor

    1. Sorry for the several month delay, I don’t seem to be being emailed when these come in!

      It should be possible, the matinee system shouldn’t interfere with the AR system. What are you having problems with?

      Tom

Leave a Reply

Your email address will not be published. Required fields are marked *