【问题标题】:Is three.js ObjectLoader capable of loading textures?three.js ObjectLoader 是否能够加载纹理?
【发布时间】:2015-04-27 16:32:05
【问题描述】:

three.js 版本 0.0.70,blender 版本 2.73a

我有一个场景使用新的io_three(不是io_three_mesh)导出器从 blender 导出为 three.js json 格式

我可以使用ObjectLoader 将场景导入到three.js 中:

var objectLoader = new THREE.ObjectLoader();
objectLoader.load('assets/models/exportedScene.json', function(imported) {
    scene.add(imported);
});

不幸的是,没有纹理应用于对象,只有材质。 正如我从exportedScene.json 文件中看到的,文件中有关于纹理的信息:

"images": [{
    "url": "blue.jpg",
    "uuid": "DFE5BBBF-601B-48EA-9C05-B9CB9C07D92E",
    "type": "Geometry",
    "name": "blue.jpg"
}],
"materials": [{
    "color": 200962,
    "specular": 5066061,
    "shininess": 8,
    "ambient": 200962,
    "depthTest": true,
    "depthWrite": true,
    "name": "partitionMat",
    "emissive": 0,
    "uuid": "A705A33F-68C1-489C-A702-89A0140247AB",
    "blending": "NormalBlending",
    "vertexColors": false,
    "map": "73277351-6CCF-4E84-A9F0-D275A101D842",
    "type": "MeshPhongMaterial"
}],
"textures": [{
    "minFilter": "LinearMipMapLinearFilter",
    "wrap": ["RepeatWrapping","RepeatWrapping"],
    "magFilter": "LinearFilter",
    "mapping": "UVMapping",
    "image": "DFE5BBBF-601B-48EA-9C05-B9CB9C07D92E",
    "repeat": [1,1],
    "name": "carpetTexture",
    "anisotropy": 1.0,
    "uuid": "73277351-6CCF-4E84-A9F0-D275A101D842",
    "type": "Geometry"
}],

但正如我之前所说,没有应用纹理。 我尝试使用js脚本将纹理文件放置在html附近,但没有成功。

也许我最初的方法不正确,我应该导入类似于http://threejs.org/examples/webgl_loader_obj.html 的纹理?但是,这个是关于使用ObjLoader(不是ObjectLoader)的,我不确定它是否正确。

【问题讨论】:

    标签: three.js textures blender


    【解决方案1】:

    查看开发分支。最近提交了对即将发布的 r71 版本的纹理支持。

    【讨论】:

      【解决方案2】:

      最新格式支持如下:

      "images":[
          {
              "uuid": "A430CF4-AD77-11E3-914E-00248C62C323",          
              "url": "../models/1024_tornis.png"          
          },
          {
              "uuid": "eka_tv_2_i",
              "url": "../models/eka_tv_2.jpg"         
          },
          {           
              "uuid": "sala_model_0709_map_i",
              "url": "../models/sala_model_0709_map.png"          
          }
      ],
      
      "textures":[
          {
              "uuid": "1024_tornis",          
              "image": "A430CF4-AD77-11E3-914E-00248C62C323"          
          },
          {
              "uuid": "eka_tv_2",
              "image": "eka_tv_2_i"           
          },
          {           
              "uuid": "sala_model_0709_map",
              "image": "sala_model_0709_map_i"            
          }
      ],
      "materials": [
          {
              "uuid": "3C5CA6AA-055B-417B-97E0-706BA446140B",
              "type": "MeshLambertMaterial",
              "name": "Material.001",
              "color": 16777215,
              "emissive": 0,
              "map": "1024_tornis"
          }]
      

      【讨论】:

        猜你喜欢
        • 2016-05-17
        • 2018-04-28
        • 1970-01-01
        • 1970-01-01
        • 2014-03-10
        • 1970-01-01
        • 1970-01-01
        • 2013-07-28
        • 2012-10-03
        相关资源
        最近更新 更多