【问题标题】:aframe and markerless AR, object flickeringaframe 和无标记 AR,对象闪烁
【发布时间】:2022-10-24 23:39:10
【问题描述】:
我正在学习 AR,我想创建一个没有标记的 AR,只是在设备相机图像上显示一些图元,我做了这个例子,但我的对象在闪烁。我使用了不正确的脚本?我做错了什么?
另外,我正在寻找无标记的 AR 教程,但找不到任何内容。
谢谢!
<html>
<head>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.6.0/aframe/build/aframe-ar.js"></script>
</head>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs renderer='logarithmicDepthBuffer: true;'>
<a-box position="-1 0 -3" rotation="0 45 0" color="#4CC3D9" ></a-box>
<a-box position="1 0 -4" rotation="-90 0 0" color="#7BC8A4" ></a-box>
<a-entity light="type: ambient; intensity: 0.2"></a-entity>
<a-entity light="type: point; intensity:0.8; distance:10" position="0 2 1.5"></a-entity>
</a-scene>
</body>
</html>
【问题讨论】:
标签:
augmented-reality
aframe
【解决方案1】:
始终使用最新的库并使用a-frame site 和您的主要学习资源。
这是一个工作脚本:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>GeoAR.js demo</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-look-at-component@0.8.0/dist/aframe-look-at-component.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
</head>
<body>
<a-scene
vr-mode-ui="enabled: false"
arjs="sourceType: webcam; videoTexture: true; debugUIEnabled: false;"
>
<a-box width="0.25" height="0.25" depth="0.25" position="-0.25 1.125 -0.75" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.3125 -1.25" radius="0.3125" color="#EF2D5E"></a-sphere>
<a-cylinder position="0.25 1.1875 -0.75" radius="0.125" height="0.375" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -1" rotation="-90 0 0" width="1" height="1" color="#7BC8A4" shadow></a-plane>
<a-camera rotation-reader> </a-camera>
</a-scene>
</body>
</html>