如何使用带纹理的Blender从json格式导出到Three.js?如果我选中复选框“纹理”我的json文件将不会加载到浏览器。以下是我的材质与纹理复选框
"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
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
谢谢!
答案 0 :(得分:2)
可能涉及的人
我的解决方案是:
答案 1 :(得分:0)
我认为@ Iraklis-Bekiaris建议你不要放置紫外线。如果是这样的话,也许这个视频tut会有所帮助。 https://www.youtube.com/watch?v=kDAxLvtpH0Y
尽管如此,我认为你的质地可能没有正确联系。 w.jpg是你的漫反射贴图。您需要确保w.jpg的副本位于您启动HTML页面的同一目录中。
检查页面上是否有任何错误的一种方法是检查您的控制台。在Chrome中加载HTML页面。如果您无法右键单击页面并且"检查元素",(三个有时会禁用右键单击),您应该可以从菜单栏中选择"查看"> ; "显影剂" > " Javascript控制台"。
我希望有所帮助!