【问题标题】:GLB/GLTF model will not display correctly in Google AR but shows no errors in other viewersGLB/GLTF 模型在 Google AR 中无法正确显示,但在其他查看器中未显示错误
【发布时间】:2020-10-16 08:41:56
【问题描述】:

我正在使用 three.js 生成 3D 模型并使用 THREE.GLTFExporter 将其导出为 GLB 或 GLTF。目标是使用 google AR 使其在我们的网站上可见。

https://kaboomlaser.com/pages/ar-test(文件链接)

当我在 https://sandbox.babylonjs.com/ 或其他 GLTF/glb 查看器中查看模型时,它看起来非常好。

请看这里:https://gltf-viewer.donmccurdy.com/#model=https://cdn.shopify.com/s/files/1/0290/5459/9273/files/test.glb

但是当我在 Google 的 AR 场景预览器 https://vr.google.com/scene-viewer-preview 中打开它时,它最终是空的。 我尝试过的其他模型确实出现在场景预览器中,但网格都是尖刺而奇怪的。

在我用来用简单模型重现问题的代码下方。 (这会输出上面链接中的模型)。

我错过了什么?

var x = 0, y = 0;
    var heartShape = new THREE.Shape();
    heartShape.moveTo(x + 5, y + 5);
    heartShape.bezierCurveTo(x + 5, y + 5, x + 4, y, x, y);
    heartShape.bezierCurveTo(x - 6, y, x - 6, y + 7, x - 6, y + 7);
    heartShape.bezierCurveTo(x - 6, y + 11, x - 3, y + 15.4, x + 5, y + 19);
    heartShape.bezierCurveTo(x + 12, y + 15.4, x + 16, y + 11, x + 16, y + 7);
    heartShape.bezierCurveTo(x + 16, y + 7, x + 16, y, x + 10, y);
    heartShape.bezierCurveTo(x + 7, y, x + 5, y + 5, x + 5, y + 5);

    var geometry = new THREE.ExtrudeBufferGeometry(heartShape, {
        depth: 4, bevelEnabled: false,
        bevelThickness: 0.4,
        bevelSize: 0.4,
        steps: 2,
        BevelSegments: 2,
        curveSegments: 10
    });

    var material = new THREE.MeshLambertMaterial({ color: 0xa00A0A });
    var mesh = new THREE.Mesh(geometry, material);

    var scene = new THREE.Scene();
    scene.add(mesh);

    const options = {
        binary: true,
        forceIndices: true
    };

    var exporter = new GLTFExporter();

    exporter.parse(scene, function (data) {
        if (options.binary) {
            savetoFile(data, 'test.glb', 'model/gltf-binary');
        }
        else {
            savetoFile(JSON.stringify(data), 'test.gltf', 'text/plain');
        }
    },
    options);

【问题讨论】:

    标签: three.js arcore


    【解决方案1】:

    我从 Poly 获得的一些模型也遇到了同样的问题。 尝试在 Blender 中导入模型并再次导出。我试过你的模型,效果很好

    【讨论】:

      猜你喜欢
      • 2021-04-25
      • 2017-10-13
      • 2020-09-03
      • 2020-07-24
      • 2022-12-02
      • 2018-07-21
      • 2012-03-06
      • 2018-08-01
      • 1970-01-01
      相关资源
      最近更新 更多