gltf文件未在Aframe中显示 [英] gltf file not showing in Aframe

查看:86
本文介绍了gltf文件未在Aframe中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件,一个glTF和OBJ文件。我正在使用Glitch进行开发,并将它们都上传到了我的资产文件夹。

I have two files, an glTF and OBJ file. I'm using Glitch to develop and I uploaded both of them to my assets folder.

当我读取标记时,仅显示OBJ文件。

When I read my marker, only the OBJ file is displayed.

<!DOCTYPE html>
<html>
<script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
<script src="https://raw.githack.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js"></script>
<script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script>

<body style="margin : 0px; overflow: hidden;">
    <a-scene embedded arjs="debugUIEnabled: false;" vr-mode-ui="enabled: false" light="defaultLightsEnabled: true">
        <a-assets>
            <a-asset-item id="tree-gltf" src="https://cdn.glitch.com.....gltf"></a-asset-item>
            <a-asset-item id="db-mtl" src="https://cdn.glitch.com.....mtl"></a-asset-item>
            <a-asset-item id="db-obj" src="https://cdn.glitch.com....obj"></a-asset-item>
        </a-assets>
        <a-marker preset="kanji">
            <a-gltf-model src="#tree-gltf"></a-gltf-model>
            <a-obj-model src="#db-obj" mtl="#db-mtl" position="0 1.8 0"
                animation="property: rotation; to: 0 360 0; loop: true; dur: 6000"></a-obj-model>
        </a-marker>
        <a-entity camera></a-entity>
    </a-scene>
</body>
</html>

我的控制台没有任何错误。只是没有出现。

I don't get any errors in my console. Is just not showing up.

推荐答案

如果打开 .gltf 文件-您会发现 .bin 和纹理是通过相对文件路径引用的。

If you open up the .gltf file - you will find the .bin and textures are referenced with relative file paths.

故障 assets文件夹不是真实目录-内的文件具有不同的路径,可能彼此之间距离很远。

The glitch "assets" folder is not a real directory - the files within have different paths, that possibly are nowhere near each other.

尝试:


  1. 将模型转换为仅包含所有资源和依赖项的.glb

  2. 将模型扔到路径相对的github仓库中

  3. 通过替换 .gltf 文件来编辑 .gltf 文件code> .bin ,以及带有故障资产链接的纹理路径。

  1. Converting your model to .glb which just contains all resources and dependancies
  2. Throwing the model on a github repository, where paths are relative
  3. Editing the .gltf file by replacing the .bin, and texture paths with glitch asset links.

这篇关于gltf文件未在Aframe中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆