AR.js icon indicating copy to clipboard operation
AR.js copied to clipboard

Can't load more than 50 Pattern markers

Open henriquefer opened this issue 4 years ago • 9 comments

Do you want to request a feature or report a bug? Bug/Issue

What is the current behavior? I am using AR.js with multiple patterns, each one for a different 3D structure. Everything work perfectly when I have approx. 50 structures, then I add more patterns and it does not work. The following errors appear: [error] loadMarker(): Error loading pattern file /marker_50. [error] ARToolKitJS(): Unable to set up AR marker. [error] Out of memory!!

Here is part of my HTML file:

<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="aframe-ar-nft.js"></script>
<head>
</head>
<style>

</style>
<body style='margin : 0px; overflow: hidden;'>
<!--	<div id='hideMe'>Loading...</div>-->
	<a-scene embedded arjs='sourceType: webcam;'>
   		<a-assets>
   			<a-asset-item id="aspirin" src="molecules/aspirin/file.glb">
   			<a-asset-item id="water" src="molecules/water/file.glb">
   			<a-asset-item id="ammonia" src="molecules/ammonia/file.glb">
   			<a-asset-item id="carbon-dioxide" src="molecules/carbon-dioxide/file.glb">
   		</a-assets>
   		<a-marker type='pattern' url='molecules/aspirin/aspirin1.patt'>
			<a-entity gltf-model="#aspirin"></a-entity>
		</a-marker>
		<a-marker type='pattern' url='molecules/water/pattern-marker.patt'>
			<a-entity gltf-model="#water"></a-entity>
		</a-marker>
		<a-marker type='pattern' url='molecules/ammonia/pattern-marker.patt'>
			<a-entity gltf-model="#ammonia"></a-entity>
		</a-marker>
		<a-marker type='pattern' url='molecules/carbon-dioxide/pattern-marker.patt'>
			<a-entity gltf-model="#carbon-dioxide"></a-entity>
		</a-marker>
		<a-entity camera></a-entity>
	</a-scene>
</body>

Can someone help me please?

henriquefer avatar Sep 15 '20 14:09 henriquefer

i have a same problem here https://github.com/fitriani1021/coverbookar/blob/master/index100.html

fitriani1021 avatar Nov 02 '20 18:11 fitriani1021

This is the error code:

ARToolKitJS(): Unable to set up AR marker. aframe-ar.js:2:23009
Uncaught abort() at jsStackTrace@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:2:41099
stackTrace@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:2:41282
abort@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:19:4866
_abort@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:2:106279
Vj@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:9:1
Je@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:10:1
Ke@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:10:1
Sf@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:10:1
kh@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:10:1
sk@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:12:1
dynCall_iiii_12@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js line 2 > Function:4:12
_addMarker@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js line 2 > Function:9:17
addMarker/<@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:1496:20
writeByteArrayToFS@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:1602:11
ajax/oReq.onload@https://fitriani1021.github.io/coverbookar/build/aframe-ar.js:1619:22
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

error-lebih-50-marker

meizano avatar Nov 04 '20 01:11 meizano

Probably it reach the reach the maximum amount of memory allowed? Maybe you could recompile Jsartoolkit5 with a higher values, tweaking this value: https://github.com/kalwalt/jsartoolkit5/blob/244b2b23286403e78fa24805b34509dc5a88052f/tools/makem.js#L30

kalwalt avatar Nov 14 '20 22:11 kalwalt

@kalwalt after changing the the line and building the project using docker will work on NFT markers? or should i need to change any parameters for making it to work on NFT?

ragavendranbala avatar Nov 15 '20 17:11 ragavendranbala

@kalwalt after changing the the line and building the project using docker will work on NFT markers? or should i need to change any parameters for making it to work on NFT?

@ragavendranbala I never tried, just try to re-build jsartoolkit5 with that increased memory option and replace the lib.

kalwalt avatar Nov 15 '20 18:11 kalwalt

To @meizano @henriquefer i think that is not a memory issue. There is a limit of 50 Pattern markers https://github.com/artoolkitx/artoolkit5/blob/5bf0b671ff16ead527b9b892e6aeb1a2771f97be/include/AR/arConfig.h#L82 if you want to try you can re-build the libs with a higher value. Hope that helps.

kalwalt avatar Nov 16 '21 13:11 kalwalt

@ragavendranbala this issue has nothing to do with NFT. :slightly_smiling_face:

kalwalt avatar Nov 16 '21 13:11 kalwalt

Did anyone find the workaround beside of rebuilding lib? I tried to rebuild but it's painful. Docker is not working for me.

keetruda69 avatar Sep 01 '23 19:09 keetruda69

除了重建库之外,有人找到解决方法吗?我尝试过重建,但很痛苦。 Docker 不适合我。

现在找到解决方案了吗

csq0668 avatar Apr 01 '24 05:04 csq0668