THREE.js Change the opacity of an entire branch

梦想与她 提交于 2021-02-18 07:46:32

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/15214543/three-js-change-the-opacity-of-an-entire-branch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!