【问题标题】:THREE.js Change the opacity of an entire branch三.js 改变整个分支的不透明度
【发布时间】:2013-03-05 10:56:21
【问题描述】:

有没有办法改变所有层次结构(分支)的不透明度/alpha,而不是每个网格材质?

【问题讨论】:

    标签: three.js webgl


    【解决方案1】:

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

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

    three.js r.56

    【讨论】:

    • 拥有乘法不透明度会非常棒,这样子不透明度可以相对于父不透明度,类似于子变换相对于父不透明度。
    猜你喜欢
    • 2016-12-13
    • 1970-01-01
    • 2017-12-18
    • 2015-03-16
    • 2018-02-13
    • 1970-01-01
    • 2015-02-14
    • 2016-11-15
    • 2015-02-23
    相关资源
    最近更新 更多