Playcanvas AR with NFT

Hi, i’m trying to acess some Augmented Reality templates to use with NFT, but all of then give this error when launch:

I tried these projects:
https://playcanvas.com/project/534315/overview/ar-starter-kit-nft
https://playcanvas.com/project/525905/overview/ar-starter-kit-nft-fork
https://playcanvas.com/project/521708/overview/testar

All of them return this error (the last one seens to be alright when play directly form dashboard, but when i fork it give the same error).

What i’m missing here? Maybe some engine updates missing from these projects?

I want to ask if someone have an working AR NFT project template like these to share or some way to implement it.

Many thanks!

I’ve forked and fixed the first one: https://playcanvas.com/project/679183/overview/ar-starter-kit-nft-fix

The fonts need re-processing for some reason. I think something was changed in the engine and broke order projects :thinking: @ray Can you think of anything that has changed recently that would break older projects?

I have a feeling that some font assets that were imported a long time ago might not work with the latest engine. I haven’t seen this error in a long time, but I have a sneaky suspicion you just have to re-import the TTF and it’ll be fine again.

@yaustar - the new font asset version PR hasn’t been merged - so it can’t be causing this issue - however, the font asset loading code: https://github.com/playcanvas/engine/blob/master/src/resources/font.js does look like it supports older font asset versions - so maybe there is a bug in this versioning code? (Github’s Blame feature can help identify the person to ask :slight_smile: )

2 Likes

Hey guys, reviving this topic for good!

I’ve tried AR Toolkit 5 / PlayCanvas NFT examples, and it seems like detection performance is much poorer than their ThreeJS integration. Basically, from my measurements getNFTMarker event gets fired only 2 - 3 times per second, while ThreeJS works pretty well in realtime (see NFT marker example with Three.js + pinball test image).

Has anybody experienced the same issue and / or tried to fix it? Would be happy to have a chat. Cheers!

It’s possible that the project is using an outdated version of https://github.com/artoolkit/ARToolKit ?

I’ll double check, but seems like not the case - NFT support was added in AR Toolkit 5 a year ago or smth.

@yaustar Ok, here is what I’ve found:

When using official artoolkit.min.js build + updated PlayCanvas AR script with NFT markers - it throws error that loadNFTMarkerEX function isn’t found. That’s expected, because NFT feature requires loading multiple marker data files (.fset, .iset, .fset3) from a path which is problematic with PlayCanvas, so @dyangrun proposed a fix: https://github.com/playcanvas/playcanvas-ar/issues/6

But turns out artoolkit.min.js version with added loadNFTMarkerEX is extremely slower on all markers and detection modes. I simply tested them side by side against matrix markers and hiro markers as well.

So seems like this modified artoolkit.min.js with added loadNFTMarkerEX is problematic. Someone probably recompiled it with wrong flags or modified it improperly (since it’s 1.53MB vs 1.19MB original) and now it’s used by all other PlayCanvas NFT projects:

https://playcanvas.com/project/679183/overview/ar-starter-kit-nft-fix
https://playcanvas.com/project/788666/overview/ar-toolkit-with-nft
https://playcanvas.com/project/707268/overview/ar-starter-kit-nft
https://playcanvas.com/project/521708/overview/testar

I’ll continue researching and may be will try modifying the original lib myself to see if I can add loadNFTMarkerEX without causing issues

2 Likes

@underlight how did your research go?

Maybe artoolkit was compiled for debug, not release. 10 times speed boost for release. Bigger filesize would also suggest that. You can find out by checking if some asserts are present (mentioned here: https://github.com/Carnaux/NFT-Marker-Creator/issues/81)