【问题标题】:gltf file renders incorrectly in aframegltf 文件在 aframe 中呈现不正确
【发布时间】:2020-05-08 05:03:13
【问题描述】:

谁能帮我调试一个 glTF 文件?它在 Don McCurdy 的 glTF 查看器https://gltf-viewer.donmccurdy.com/ 中看起来不错(尽管它与在 Blender 中的外观有很大不同)但是当我使用 aframe 查看它时,它的大部分部分都丢失了:https://sgouros.com/scorpii/index1.html。模特在https://sgouros.com/scorpii/data/scorpii3.glb

【问题讨论】:

    标签: aframe gltf


    【解决方案1】:

    发生这种情况是因为模型in most cases should have 的透明节点禁止通过其材质写入深度缓冲区。

    引用Khronos wiki(或引用 Don McCurdy 引用 wiki):

    处理半透明对象的标准方法...包括禁用对深度缓冲区的写入以及根据与相机的距离对透明对象和/或多边形进行排序。

    所以你可以只遍历网格并为透明对象禁用 depthWrite:

    model.traverse(node => {
        if (node.isMesh) {
               node.material.depthWrite = !node.material.transparent;
        }
    });
    

    就像我对 this glitch 中提供的模型所做的那样。

    【讨论】:

    • 这很有道理,你很乐意告诉我答案。非常感谢!我在这里足够新,它不会让我投票给这个答案,但我试过了。
    猜你喜欢
    • 2020-04-03
    • 2018-11-16
    • 1970-01-01
    • 2019-09-16
    • 1970-01-01
    • 2022-12-02
    • 1970-01-01
    • 2018-09-10
    • 2018-08-27
    相关资源
    最近更新 更多