【发布时间】:2016-02-27 09:40:00
【问题描述】:
如何从 Blender with Textures 以 json 格式导出到 Three.js?如果我选中“纹理”复选框,我的 json 文件将不会加载到浏览器。这是我的材质在纹理中的样子 checkbox
"materials": [{
"transparent": false,
"DbgIndex": 0,
"mapDiffuseRepeat": [1,1],
"mapDiffuseAnisotropy": 1,
"specularCoef": 50,
"colorEmissive": [0,0,0],
"colorDiffuse": [0.64,0.64,0.64],
"wireframe": false,
"visible": true,
"blending": "NormalBlending",
"DbgColor": 15658734,
"mapDiffuse": "w.jpg",
"DbgName": "Material.005",
"opacity": 1,
"depthWrite": true,
"mapDiffuseWrap": ["RepeatWrapping","RepeatWrapping"],
"depthTest": true,
"shading": "phong",
"colorSpecular": [0.5,0.5,0.5],
"colorAmbient": [0.64,0.64,0.64]
},...
如果我不这样做,它不会加载纹理,但会加载对象,这是我的材料
"materials": [{
"blending": "NormalBlending",
"specularCoef": 50,
"colorEmissive": [0,0,0],
"DbgName": "Material.005",
"colorDiffuse": [0.64,0.64,0.64],
"DbgIndex": 0,
"opacity": 1,
"colorSpecular": [0.5,0.5,0.5],
"shading": "phong",
"wireframe": false,
"colorAmbient": [0.64,0.64,0.64],
"depthTest": true,
"transparent": false,
"visible": true,
"depthWrite": true,
"DbgColor": 15658734
},...
这是我的 json 加载器
loader.load('oddo.js', function(geometry, materials) {
mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
mesh.scale.x = x;
mesh.scale.y = y;
mesh.scale.z = z;
mesh.opacity=1;
var model = new THREE.Object3D();
model.add(mesh);
model.position.set(0,0,0);
//mesh.translation = THREE.GeometryUtils.center(geometry);
group.add(model);
});
and here is an image from blender object and exporter
谢谢!
【问题讨论】:
标签: javascript json three.js blender