three.js版本0.0.70,搅拌机版本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),我不确定它是否正确。
答案 0 :(得分:1)
查看开发分支。最近有关于即将推出的r71版本的纹理支持提交。
答案 1 :(得分:1)
最新格式支持如下:
"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"
}]