Augmented Reality for UE4

Right now I’m only worried about iOS so I didn’t worry about messing up anything else with my changes. Basically all I did was change the few places where it was creating paths with upper case characters and used lower case instead. My gut tells me the real problem has something to do with iPhoneLaunched not being set correctly, seems there are 2 code paths based on it being set… One that uses caps and one that doesn’t. I’m not sure what the reason for that is based on my brief time looking at the code though. For it to work correctly on iOS iPhoneLaunched should be true. Rather than figuring out why it was not getting set to true I just modified the “else”.

I believe the changes I made were to the following lines
124
679
971

I’m not using NFT but you’d probably have to change 1056 as well.

hi ,
Thanks for sharing.Love your AR plugin…But may i know is there any step by step tutorials to follow?i have download the demo version.But seriously i dont know how to implement it,especially when i want to make my own model to AR.Please help me…Thanks

Hi,

I am using the demo version of this plug-in and am finding problems to package the project for windows. Please could you help me to detect the problem/s? It might be something very basic as I am not very experienced with UE4. These are the errors that come up in the ‘output log’ window:

UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool: ERROR: No modules found to build. All requested binaries were already part of the installed engine data.
UATHelper: Packaging (Windows (64-bit)): Program.: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:5): C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\DotNET\UnrealBuildTool.exe UE4Game Win64 Development -remoteini=“C:\Users\xxxxx\Documents\Unreal\ARPlugin_DEMO
_v1_7\ARSampleUEv4_15” -noxge -generatemanifest -NoHotReload. See logfile for details: ‘UnrealBuildTool-2017.04.17-11.43.00.txt’
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults:Error: Error Unknown Error

I also get this message in the ‘message log’ window but not sure what it means:
Warning AttachTo: ‘/Game/Maps/ARToolkitSimple.ARToolkitSimple:PersistentLevel.ARToolkitBase_C_0.SceneComponent’ cannot be attached to itself. Aborting.

Thank you

Hi,

It’s not possible to package your project with the DEMO version. It only works from the editor.

Does the plugin support android 7?
The same build which works on androids between 4.4 and 6 doesn’t work on 2 devices with android 7, both devices show white screen and the GUI, and there is no “webcam init error” message i you ask.

Hi,

Did you try to run the demo project from Google Play ?

Hi, the demo project works fine. Any ideas what to check? same build on some devices work fine, on android 7 devices white screen.

Last time I had a similar issue, the solution was to update CodeWorks for Android to the most recent version.

Unfortunately, i’ve updated everything yesterday, so it’s not the case :frowning:

Will the plugin compile to website via HTML5/JavaScript ? And will it then also support the picture image recognition via ARToolkit ?

HTML5 is not supported.

Is this already working with GearVR?

Is the lag problem with the GearVR camera solved?

Cheers and thanks for the answers!

Finally, found the reason of the black/white screen: when installing through unreal engine, unreal engine copies required files to sdcard folder including ARToolkit folder. When the app is installed this way it can locate camera_para.dat file and works fine.
And if the app is installed other way after UE copied the files to the folder it also works.
However when the app was never launched on a device through unreal engine it includes the folder to APK, but the app can’t locate it because it’s trying to locate it in a wrong folder.

I have checked your code and it seems the path to the file is generated in ARToolkitDevice.cpp:
111: FString AbsoluteContentPath = GFilePathBase + TEXT("/UE4Game/") + FApp::GetGameName() + TEXT("/") + FString::Printf(TEXT("%s/Content/"), FApp::GetGameName());

05-01 04:26:41.899 12831 12845 E libar : Error (2): unable to open camera parameters file “/storage/emulated/0/UE4Game/ARCHON/ARCHON/Content/ARToolkit/Data/camera_para.dat” for reading.
Guess what? /storage/emulated folder is empty.

‘/storage/emulated/0/’ - this part of the path is taken from GFilePathBase extern variable. But i can’t find the code which sets it.

Is this ARToolkitDevice class is made by you or artoolkit community?
Do you know where the variable is set?
Any help would be very much appreciated.

Hi,

Do you have the .obb file too ? Also you need to install using the generated .bat file.

i’ve tried both options with obb and with single apk, doesn’t matter it can’t find the camera params.

First of all, i need this app to be downloadable from the google app store, i can’t tell users “you can install it only if you install android sdk and will use the bat file”, right?
Anyway the bat file doesn’t help.
Let me explain in details.

There are 3 ways how i can install an unreal app to a phone:

  1. Attach it through USB and press “” in UE Editor
  2. Package the app and install it through USB using the bat file
  3. Package the app and upload the apk (and if needed obb) file(s) to the google app store and download it from the store.

And see what happens:
It seems the app is looking for the files in 2 places: /storage/emulated/0/ and /sdcard/
When i have clear device and install the app using option 2 or 3, there are no artoolkit files neither in /storage/emulated/0/ nor in /sdcard/ and the camera doesn’t work.
If i use option 1, UE copies the files to /sdcard/ folder and the app works.
Even if i unuinstall the app the /sdcard/ fodler is still here with its content and further installations using any of the methods work, because the app is able to find the files in /sdcard/ folder.
I’ve checked the apk i install, it does contain assets folder with .zip (named as .obb.png), which contains the artoolkit folder and myappname-android.pak.
When I the app it displays GUI and for a second displays 3d model i use, only the camera fails. So it seems the assets are unpacked and used by the app with no problems except the artoolkit folder.
So it seems there is no problem with obb, but only with the artoolkit folder which is added as ‘additional’ folder to pack.

One more thing: I installed the unreal4ar demo from the store and it has content folder in ‘UE4Game/ArPluginV4_15/ArPluginV4_15’ which does contain the artoolkit folder. My app has all folders and similar structure except the content folder. Any ideas why it can be so?

Ok, here it is:
I created brand new project and copied the plugin into it, everything according to the tutorial for full version and it has the same problem.
Here is the apk, you can install it using the bat file and see the app doesn’t work on any android device:
https://ufile.io/aelc6
Please keep in mind it doesn’t matter if it’s single apk or apk + obb, the result is the same.

Ok, so you have uploaded your project it without the .obb file. I told you it won’t work …
Can you upload your project with the .obb file ? I can’t test without it.

The .bat file is required only for testing, not for publishing your project on google play.

The only modification you need to make before uploading to the store is to change one line:

In SampleProject\Plugins\ARToolkitPlugin\Source\ARToolkitPlugin\ARToolkitPlugin_APL.xml there is a line:

String obbPath = Environment.getExternalStorageDirectory() + “/obb/”;

Try to change it to:

String obbPath = Environment.getExternalStorageDirectory() + “/Android/obb/”;

Can you please try the demo on the store ?

I’ve uploaded it using the same method, and tested with many samsung / lg phones, and worked without any issues.

That would save so much time if the line would be in your documentation as well as the requirement to use obb.

Thank you, it works now.

Here are the brief results of the testing:
There are 3 things which affect on the ability to init camera:

  1. If you ever launched the app using button in unreal editor
  2. If “Package game data inside apk” checkbox is checked
  3. If the line described above is changed

So if you the app using unreal editor it copies artoolkit folder to sdcard folder and then doesn’t matter if you checked “package game data inside apk” or not, the app will work, doesn’t matter if you installed it using bat file or through the store.
If you didn’t and the folder is not in the sdcard folder then if the checkbox is checked the app won’t work. However if the checkbox is NOT checked it will work only being installed through the bat file and not through the appstore. And to make it work through the appstore the ARToolkitPlugin_APL.xml should be changed as described above.

Please add these 2 things to your manual, to save other people time. Thank you!

Thanks for your feedback! I am glad it’s working now. I’ve updated the manual accordingly.

the link is not working