从 Blender 导出到三个带有纹理的 js
Export from Blender to Three js with Textures
如何从 Blender with Textures 以 json 格式导出到 Three.js?如果我选中复选框 "textures",我的 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.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
谢谢!
与谁有关
我的解决方案是:
- 在搅拌机中将对象从 "object mode" 变为 "edit mode"
- 按"u"
- Select "Smart UV Project"
- 按确定
- 检查我图像中的选项
我认为@Iraklis-Bekiaris 是在暗示您没有布置 UV。如果是这样的话,也许这个视频图会有所帮助。 https://www.youtube.com/watch?v=kDAxLvtpH0Y
不过,我认为您的纹理链接可能不正确。 w.jpg 是您的漫反射贴图。您需要确保 w.jpg 的副本位于您启动 HTML 页面的同一目录中。
检查页面上是否有任何错误的一种方法是检查控制台。在 Chrome 中加载您的 HTML 页面。如果您不能右键单击页面和 "inspect element",(三个有时会禁用右键单击),您应该可以 select 从菜单栏 "view"> "developer" > "Javascript Console".
希望对您有所帮助!
如何从 Blender with Textures 以 json 格式导出到 Three.js?如果我选中复选框 "textures",我的 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.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
谢谢!
与谁有关
我的解决方案是:
- 在搅拌机中将对象从 "object mode" 变为 "edit mode"
- 按"u"
- Select "Smart UV Project"
- 按确定
- 检查我图像中的选项
我认为@Iraklis-Bekiaris 是在暗示您没有布置 UV。如果是这样的话,也许这个视频图会有所帮助。 https://www.youtube.com/watch?v=kDAxLvtpH0Y
不过,我认为您的纹理链接可能不正确。 w.jpg 是您的漫反射贴图。您需要确保 w.jpg 的副本位于您启动 HTML 页面的同一目录中。
检查页面上是否有任何错误的一种方法是检查控制台。在 Chrome 中加载您的 HTML 页面。如果您不能右键单击页面和 "inspect element",(三个有时会禁用右键单击),您应该可以 select 从菜单栏 "view"> "developer" > "Javascript Console".
希望对您有所帮助!