加载 Collada (dae) 模型时如何在 THREE.js 中设置材质?
加载 Collada (dae) 模型时如何在 THREE.js 中设置材质?
我有以下代码:
new THREE.ColladaLoader().load('models/cylinder.dae',
function(collada) {
var model = collada.scene;
model.scale.set(10.0, 10.0, 10.0);
// attempt to set a material - doesn't work...
collada.dae.materials[0] = new THREE.MeshBasicMaterial({
color: 0xff0000,
wireframe: true
});
scene.add(model);
});
感谢您的帮助。
How do I setup materials in THREE.js when loading Collada (dae) models?
I have the following code:
new THREE.ColladaLoader().load('models/cylinder.dae',
function(collada) {
var model = collada.scene;
model.scale.set(10.0, 10.0, 10.0);
// attempt to set a material - doesn't work...
collada.dae.materials[0] = new THREE.MeshBasicMaterial({
color: 0xff0000,
wireframe: true
});
scene.add(model);
});
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将 model_material 设为“未定义”,那么请查看 Collada 对象,
有时子级中有子级,因此您可能必须执行以下操作:
查看 Collada 模型,然后相应地修改它。
if you are getting model_material as 'undefined', then take a look at the Collada object
sometimes there are children inside children, so you might have to do this:
Take a look at the Collada model and then modify it accordingly.