gltf - Ar.js 无法显示 glb 模型
问题描述
我无法使用 ar.js 显示用于图像跟踪的 glb 请检查我的网站https://ignaciostellino.github.io。/ 我能够识别图像但无法显示 3D 模型。我想应该与比例和位置有关,但无法弄清楚。这是我的代码:
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
<style>
.arjs-loader {
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.arjs-loader div {
text-align: center;
font-size: 1.25em;
color: white;
}
</style>
<body style="margin : 0px; overflow: hidden;">
<!-- minimal loader shown until image descriptors are loaded -->
<div class="arjs-loader">
<div>Loading, please wait...</div>
</div>
<a-scene
vr-mode-ui="enabled: false;"
renderer="logarithmicDepthBuffer: true;"
embedded
arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
>
<!-- we use cors proxy to avoid cross-origin problems -->
<!-- url="https://arjs-cors-proxy.herokuapp.com/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/trex-image/trex" -->
<a-nft
type="nft"
url="ignaciostellino.github.io/smoothie-peque/smoothie-peque"
smooth="true"
smoothCount="10"
smoothTolerance=".01"
smoothThreshold="5"
>
<!-- gltf-model="https://arjs-cors-proxy.herokuapp.com/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/scene.gltf" -->
<a-entity gltf-model="Water/out.glb" scale="5 5 5"
position="50 150 0" crossorigin="anonymous">
<a-animation attribute="rotation" to = "360 0 0" dur="3000" easing="linear" repeat="indefinite"> </a-animation>
</a-entity>
</a-nft>
<a-entity camera></a-entity>
</a-scene>
</body>
解决方案
I'm not sure what the problem is, perhaps your model is too small or too large. How can you be sure the marker is detected? Try using <a-gltf-model>
instead of <a-entity>
. You can also use our platform echoAR to upload your models and immediately get an AR.js experience link (learn how here). You can compare your code with the auto-generated one or just use the ARjs link that you get.
推荐阅读
- node.js - 尝试使用 Node js 将多个图像上传到 AWS 时遇到错误
- sql - 计算与日期范围相关的天数列
- python - 输入、sys.stdin 和函数
- javascript - 如何在没有突变的情况下按功能创建有效的组?
- reactjs - 跟踪 useState 的第二个结果
- google-sheets - 检查一个单元格是否包含在一组单元格中[Google表格]
- android - JSONObject 在 Android 10 中返回 null?
- javascript - AWS SES InvalidParameterValue:本地地址包含非法字符
- php - 将 Woocommerce 购物车项目自定义数据保存为订单项目元数据,在订单和电子邮件中显示它
- azure-active-directory - 如何为用户选择子字段?