Start a new topic
Solved

Wikitude + Unity ARFoundation + URP

Hello, 


I try to get the sample szene from Wikitude "Simple - Alignment Initialization" To work with the Universal Render Pipeline and ARfoundation. 


I try it with different Unity Version 

Unity 2020.2.2f1

Unity 2019.4.21f1

Unity 2019.4.2f1


and with Wikitude 9.6.0


the first step i try to get Wikitude with URP to work end i get every time the same error.

 

if i build it for Android i dont get a AR Background.


if i try to use the Window -> Wikitude - URP Helper 

i get this error: Packages\com.wikitude.core\Editor\Helpers\URPHelper.cs(11,29): error CS0234: The type or namespace name 'Universal' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?)


also i try to make it manualy like here https://www.wikitude.com/external/doc/expertedition/UnitySupportedPackages.html#manual-scene-conversion


but nothing work i hope anyone can help me


with best regards

Mike



But then it is not using the AR Foundation camera frame. Please delete the device camera and try if all AR Foundation settings are working as expected. You can also create a blank AR Foundation scene (without the Wikitude components) and see if it works.


Kind regards,
Gökhan

ARCamera , Ar Origin and AR Bridge to Plugin is set.


the szene still only work if i had the Device Camera Component


with best regards

Mike 

Can you send me where the UI error occurs?


Kind regards,
Gökhan

This error comes because the SDK initializes an internal Android camera.... but we want to use the frame given by AR Foundation. I just saw that I missed a step.

Added it retroactively to the previous post:


Apply final settings to the "Wikitude SDK" GameObject:

  • Add the "Main Camera" GameObject to the ARCamera field.
  • Add the "AR Session Origin" GameObject  to the AR Origin field.
  • Change the AR Bridge type to "Plugin"


Because of the UI i found one error. 


as i replace the AlignmentInteractionController.cs Script the Buttons in Canvas / Safe Area Handler / Header / Alignment Switch Buttons (Activate Stop Sign Alignment Button and Activate Firetruck Alignment Button) lost 1 OnClick event 


the Button itself are deactived after build and the Loading idicator is to see so that i cant change the object what i want to track


with best regards

Mike

 

Hey Gökhan,


thank you for the good support. 


The URP part works perfect. With The ARFoundation part i still have problems. If I do it like you described, the app crashes immediately after starting.


I installed the package "Android Logcat" to look in the consol what is happens. the Error was:


 2021.03.05 11:55:04.512 14180 14195 Error WKTD >Error: [com.wikitude.camera.android][00:00:00.115.670] > Could not start the camera because no activeCamera has been set. (code 1003)


i try to add the Device Camera GameObject + Comment back to the Wikitude SDK GameObject with that i can Build and interact with the app but i cant use the UI Elements.


with best regards

Mike

Second part: Make an URP ready Alignment Initializer sample scene ready for AR Foundation


Be sure to add the AR Foundation render feature to the URP render pipeline renderer asset (like described in the Unity documentation)

Afterwards, open the URP ready alignment initializer sample scene and follow these points:

  • Add an "AR Session" GameObject with the AR Session and AR Input Manager components to the scene hiearchy's root.
  • Add an "AR Session Origin" GameObject wit the AR Session Origin component to the scene's hierarchy.
  • Link the "Main Camera" GameObject to the AR Session Origin component's Camera field.
  • Set "Main Camera" GameObject's Camera component's Render Type back to "Base".
  • Add following components to the "Main Camera" GameObject:
    • Add the Tracked Pose Driver component and set its Update Type to "Update And Before Render"
    • Add the AR Camera Manager component
    • Add the AR Camera Background component
  • Parent the  "Alignment Initializer" GameObject to the "Main Camera" GameObject (That is important, for the snapping effect upon recognition to work properly.)
  • Add an "AR Foundation Plugin" GameObject with the AR Foundation Plugin component as a child to the "Wikitude SDK" GameObject.
  • Remove the "Device Camera" as well as the "Camera Frame Renderer" GameObjects.
  • Replace the AlignmentInteractionController.cs script with the one attached to this post. This script will eliminate the need for the secondary alignment camera (which's primary use case was for initial alignment in the Editor anyways).
  • Apply final settings to the "Wikitude SDK" GameObject:
    • Add the "Main Camera" GameObject to the AR Camera field.
    • Add the "AR Session Origin" GameObject  to the AR Origin field.
    • Change the AR Bridge type to "Plugin"

A refinement to the alignment initialization sample is planned and will also factor in improvements to better support for AR Foundation and URP.


Kind regards,
Gökhan

cs

Hi Mike,

thanks for pointing that out! The "Alignment Initializer" GameObject itself has a Camera component that is not being set to Render Type: Overlay by the URP helper tool. 

You can do that manually by selecting it in the scene hierarchy and settings its Render Type to "Overlay".

Then select the "Camera Frame Renderer(which is a child of the "Wikitude SDK" GameObject) and add the "Alignment Initializer" to its Camera component's Stack.

I will describe how to make the URP ready alignment initializer sample fit for AR Foundation in the next post.

Kind regards,
Gökhan

Hey Nicola,

thanks for the fast answer.


The URP Helper work now with out error but unfortunately the AR Background still doesnt work :( 


i also try to convert the scene manually but AR Background still doesnt work 


i only have a blue blackground 


with best regards

Mike

Hi Mike,


There is currently a known issue for the URP helper and a way to fix it described in the known issues section in the changelog of the latest release: (https://www.wikitude.com/external/doc/expertedition/CHANGELOG.html#wikitude-sdk-9-6-0-expert-edition).


The URP helper will help with converting the sample scenes to work with URP as there are some modifications necessary.

You can also convert a scene manually to be compatible with URP like described here:https://www.wikitude.com/external/doc/expertedition/UnitySupportedPackages.html#manual-scene-conversion


Greetings

Nicola

Login or Signup to post a comment