Three.js的导出Blender模型中的材料不起作用 [英] Materials in exported Blender model for Three.js not working
问题描述
我正在尝试使用使用Three.js的Blender创建的模型.该模型非常基础,两个立方体相互叠加.一个立方体是红色,另一个立方体是绿色.
I am trying to use a model created with Blender with Three.js The model is very basic, two cubes on top of each other. One cube is red and the other is green.
当我手动将材料分配给对象时,我已经使用Three.js的Blender导出器插件导出了模型:
I have exported the model using the Blender exporter plugin of Three.js When I assign a material manually to the object like:
loader.load("model.js", function ( geometry, material ) {
material = new THREE.MeshBasicMaterial( { color: 0xFF0000 } );
mesh = new THREE.Mesh( geometry, material);
scene.add(mesh);
animate();
});
没有任何问题,如 https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/index.html
但是,当我删除行时:
material = new THREE.MeshBasicMaterial( { color: 0xFF0000 } );
使用模型的材料.这会产生Three.js错误:
the material of the model is used. Which produces an error of Three.js:
TypeError:程序未定义[中断此错误]
TypeError: program is undefined [Break On This Error]
p_uniforms = program.uniforms
p_uniforms = program.uniforms,
您可以在 https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/index2.html
有人知道什么可能导致此问题吗?您可以从 https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/model.blend 下载Blender文件 >
Does anyone have an idea what could cause this problem? You can download the Blender file at https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/model.blend
推荐答案
简单.材料是阵列.您需要执行以下操作:
Easy. The materials is an array. You need to do the following:
loader.load( "model.js", function ( geometry, materials ) {
mesh = new THREE.Mesh( geometry, materials );
scene.add( mesh );
animate();
} );
three.js r.88
three.js r.88
这篇关于Three.js的导出Blender模型中的材料不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!