Start a new topic

3D Model Appears Black After Re-Opening The Same View Controller In iOS

3D Model Appears Black After Re-Opening The Same View Controller In iOS



I'm facing an issue with 3D Models. It goes like this:

I'm making an iOS app and currently, just for testing purposes, the first view controller has a button, after clicking on which the user is navigated to another view controller where the camera and the rest of the Wikitude setup is being done. I'm making use of the 3D Model Augmentation, and it works perfectly the way it should. Snap-To-Screen and Rotate perform as expected and even I had modified the snap web-view's contents which also show up properly.

Considering the active camera view, even if the app is minimised and re-opened again (of course, it'll be the same camera view that will be popped up after re-opening), no problems, the 3D Model loads up perfectly over the target images.

Now, if I navigate to the first view controller and then back again to the view controller containing the augmented reality scene, the camera initializes as normal, but when it's pointed at any target image - boom : there's the black broken 3D Model being overlayed over that image.

Till that point I wasn?t destroying 3D Models explicitly. I tried destroying them on ?onExitFieldOfvision? trigger, but still this particular problem persists as explained above.

As I missing something over here? Can anyone please shed some light on this issue.

Many thanks in advance!





Can you please send us your complete project to forum, so we can investigate further internally.

Thx and greetings




Thanks for your reply, Nicola.



Well, actually, I figured it out. Just before navigating from the view controller containing the augmented reality scene to the previous one, I was calling the callJavaScript architect method on the current WTArchitectView instance where I was passing in : ?AR.context.destroyAll();?, so as to destroy all the objects in the AR scene. 


It seems that due to the immediate transition, it was not getting the sufficient time to release memory for all the objects.

So, by making use of NSTimer with a delay of 1-1.2, now it?s working the way it should. The 3D Model doesn?t appear  broken/black at all.


I should have gone through my code carefully once again instead of hurriedly opening a new thread like this..


Apart from this, could you or someone else would please help me guide on the following:


For a Trackable2DObject I?m passing the targetName as a wildcard - *, and want to grab the recognised target name in the onEnterFieldOfVision event. I?ve followed the docs, but seems that I?m going somewhere wrong in the syntax, or placing the code at a wrong place or think that there is some problem with my target collection file. I?ve tried several ways & combinations, but always, either, there?s an error(error, as in, the app runs fine, but no drawables or no 3D Model pops up on any target image ) or I get undefined results for the targetName..

Here?s what I?m doing:



onEnterFieldOfVision: function()

{ Target - ?+this.trackableObject.targetName); //trackableObject is a Trackable2DObject





Could someone please let me know whether this is right or provide some pointers in the right direction for fetching the recognised target name in that event..



Thanks in advance!!





Hi there!

Please check out JavaScript API documentation of AR.Trackable2DObject - I guess using this.targetName in the onEnterFieldOfVision should solve the issue.
I recommend you to use console.log and remote debugging during development.

Kind regards,



Thanks for replying, Andreas.


Well, I've already gone through the documentation for Trackable2DObject, and every time I get stuck at the doc part for onEnterFieldOfVision. Actually, it's clearly mentioned out there that, after firing this event and as part of event payload, targetName will hold the name of the recognised target, but I'm not able to work it out as stated in my earlier response..


I tried using 'this.targetName' as you've suggested, but it's only returning a wildcard symbol, just a '*', and not the entire name of the recognised target, and,  even tried it with the target collection file from the 3D Model Examples and even with my custom target collection files. 


Could you please share some more inputs on this..


Many Thanks In Advance!!




Hi there!

As written in the documentation of onEnterFieldOfVision the first parameter of the function holds the name of the recognized target, whereat this.targetName returns the initially set targetName/filter.

Kind regards


Hi Andreas,

Thanks a lot, it worked!!

The first parameter returns the exact name of the recognised target.

Now, need to look at my code from onEnterFieldOfVision, as currently the 3D Model just doesn't show up only for the first time if the camera is pointed at any target image. Will get back to you on this.




Login or Signup to post a comment