【问题标题】:three.js - How to export MultiMaterial?three.js - 如何导出 MultiMaterial?
【发布时间】:2015-12-21 19:43:20
【问题描述】:

这是我的代码的 sn-p -

materialArray=[];
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture}));
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture}));
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture}));
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture}));
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture}));
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture}));

frontCounterMaterial=new THREE.MultiMaterial(materialArray);
frontCounter.material=frontCounterMaterial;

使用编辑器 (threejs/editor) 可以正确渲染场景,但是导出不起作用。 当我执行以下操作时 -

frontCounter.toJSON()

我得到以下 -

Uncaught TypeError: Cannot read property 'textures' of undefined(…)

我追溯到-

THREE.Texture.toJSON:
if ( meta.textures[ this.uuid ] !== undefined ) {

        return meta.textures[ this.uuid ];

    }

我不明白如何解决这个问题,即导出一个应用了 MultiMaterial 的网格。有什么帮助吗?

【问题讨论】:

    标签: three.js


    【解决方案1】:

    github 上的 PR 表明它目前可以与 MeshPhongMaterial https://github.com/mrdoob/three.js/pull/6509 一起使用,我建议尝试使用它而不是 MeshBasicMaterial。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-01
      • 2012-04-04
      • 2012-09-06
      • 1970-01-01
      • 1970-01-01
      • 2014-07-04
      • 1970-01-01
      • 2014-02-24
      相关资源
      最近更新 更多