THREE.js 改变整个分支的不透明度 [英] THREE.js Change the opacity of an entire branch

查看:51
本文介绍了THREE.js 改变整个分支的不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以更改所有层次结构(分支)的不透明度/alpha,而不是每个网格材质?

Is there any way to change the opacity/alpha of all hierarchy (branch) rather than per each mesh material?

推荐答案

没有.但是,您可以使用 object.traverse() 来设置对象材质及其子项的不透明度.

No. You can, however, use object.traverse() to set the opacity of an object's material and it's children.

mesh.traverse( function( node ) {
    if( node.material ) {
        node.material.opacity = 0.5;
        node.material.transparent = true;
    }
});

three.js r.56

three.js r.56

这篇关于THREE.js 改变整个分支的不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆