Three.js 版本 0.0.70,blender 版本 2.73a
我有一个场景导出自blender to 三.js json格式使用新的io_three
(not io_three_mesh
)出口商。
我可以使用以下命令将场景导入到 Three.js 中ObjectLoader
:
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://trijs.org/examples/webgl_loader_obj.html http://threejs.org/examples/webgl_loader_obj.html?然而,这是关于使用 ObjLoader (而不是 ObjectLoader),我不确定它是否正确。